Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Persian_Gamer

Per Pixel Lighting....Heeeeeelp lol

This topic is 5315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on per pixel lighting and i've come to a problem which i can't find a solution for it. That is whenever the light goes near a low poly object's surface, up to a distance intensity of the light grows but after that it seams to fade away as we go nearer. I'm calculating the light vector on Vertex shader and passing it as oD0 or the color register. and on pixel shader i do a DOT product with the bump map. My suspect is that the light vector is not gettin' interpolated properly or somthin' like that... any ideas? well the result with attenuation and without bump maps (which requires light vector) is this: with the bump map and light vector i get somthing like this(when ever the light goes near to a wall for example look at the blue color and compare with the last image) [edited by - Persian_Gamer on February 29, 2004 12:11:25 AM]

Share this post


Link to post
Share on other sites
Advertisement
This has to do with the light vector:
Once you are in the center of a big poly, the light vector gets unnormalized ( the lightvector gets too "short" ) as a result of the interpolation. Since you multiply it with the bumpnormal, your diffuse coefficient will be a lot lower than normal. You can solve this problems in 3 ways:
a) Use a normalization cubemap as texture and do a lookup to renormalize your lightvector
b) Renormalize your lightvector in your shader with real calculations ( this can only be done in ARBFp I believe , not fp20 or anything like that )
c) Renormalize your vector using the newton raphson approximation

Best results can be achieved using b... They look a little "sharper" than the other 2 in the final output

Share this post


Link to post
Share on other sites
Oki thanx Dtag, thanx alot... its fixed now... but i''ve got a question... right now i''m burning 2 texture stages to simulate attenuation. I''ve read that using a cubemap its also possible. I wanna use the cubemap attenuation so i can make another slot availabe for specular map... do we use the same 2D Attenuation texture and put it on all cube''s surfaces? i read Sim Dietrich article on attenuation maps... his solution is to calculate S,T and R same way we do for 2D Attenuation maps:

(Light-Vertex)/LightRane

i don understand this part.. how can this work since STR for Cubemap is a vector and v(a,b,c) and v(na,nb,nc) will produce the same results.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!