Help with Lambert shading

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Mitth'raw'nuruodo

Help with Lambert shading

Post by Mitth'raw'nuruodo »

Hi, its Mit, for some reason I'm having a real difficult time with Lambert shading, I can program (rotate, translate, project, sort, find normals, and fill) in 3D but the Lambert shading is getting at me. All the colors get messed up when I try it. I've look at many tutorials and sawt help online, but this is my last choice to find out on how to put Lambert in my sick program (accualy its not that sick because this is my "trial program" or first program for 3D stuff). Ok so here are my specific questions (if they weren't ovious already):
1) How do you define a light sorce
2) How do you find and rotate the normals for the polys
3) How do you use 1 and 2 above to find the intensity of each color(intensity of each color is on a 0 to 15 scale)
This is a VERY difficult topic and I would really appreciate it if anyone would reply expecialy those who know what they are talking about :wink:
Thank You
-Mit
Mitth'raw'nuruodo

Post by Mitth'raw'nuruodo »

Hi,
Feel free to still answer this question,
but I decided to not put lambert shading
in my program. But I would Still appresiate it
if someone would answer for any possible future programs...
I know there is no easy answer for this but the tutorials
I looked at were no help, so even if you don't want to answer to this,
instead, if you could point out a helpful tutorial on it that would be great.
thanks,
-Mit
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

Sorry 4 replying, the only 3d stuff I know is the basic parts of raycasting, but have you tried this post on the QBnews forum, they got tons of QBers that sould know what your talking bout? :wink: well maybe not a ton, that 2000,.. but close..
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
Mitth'raw'nuruodo

Post by Mitth'raw'nuruodo »

No, I haven't but I will try.
Thanks for the adivice.

-Mit
P.S. I never expected you to know about it anyway,
not many programmers accually get involved in it
now a days. I'm just a little crazy for trying this 3D
in QB also, the SLOWEST of all languages (Something to do with DOS... :wink: )
but I like QB and its fun. Oh yeah, I'm not saying that as a bad thing but
thanks for replying. :D
Rel

Post by Rel »

Here:

http://rel.betterwebber.com/junk.php?id=21

Read chapter 3, example is in the examples folder.

Chapter 5 is in this site as an article.
Mitth'raw'nuruodo

Post by Mitth'raw'nuruodo »

Its Rel, as in Relsoft? :shock:

If it is, your arcticles were most helpful for a person like me who has
no experiance in Trig, and were the main arcticles I looked at. :D

The Lambert shading confused me on those though. :?

If those are the same articles that I've seen on this site then I've already
seen them and are still confused. Sorry about that. :(
-Mit
Guest

Post by Guest »

Yep, I'm Relsoft, just a il lazy to type my whole nick .:*)

Yes, they're the same. What problem with lambert are you having?

If it's calculating the face normals, just get 3 points off a face and calculate the normal by using the cross product. Then normalize your normal by dividing it by its length.

After that you multiply that normal with 255 to get the color of the face. Be sure to make your pal a gradient from dark to bright.
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

:shock: Your to lazy to just type "Relsoft",.. I wish I thought up one as short as yours, lol,.. try Rattrapmax6, or x.t.r.GRAPHICS, or the unabreived form of x.t.r.GRAPHICS,.. :wink:

:roll: Never mind me,. get back to whatever that was you just said.. :)
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
Mitth'raw'nuruodo

Post by Mitth'raw'nuruodo »

Or try mine: Mitth'raw'nuruodo :)
But never mind that.

I don't understand the 3 points of the light vector,
I mean where the light sorce will show from with different points.

I didn't gradient my palette, mabey thats the problem so i'll try that.

Now when multipling the norm by the color range how does that
get a specific color I want?

Oh yeah, how does the light vector come in to these equations?

Well those are my questions for you as you requested.

-Mit
Post Reply