Jump to content
  • Advertisement
Sign in to follow this  
toasterthegamer

Lighting a view aligned billboard in HLSL.

This topic is 3347 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

Hi, I have a randomly generate tree that I've made and I have billboarded leaves randomly placed on the tree. The problem I'm having is that I always rotated them towards the camera so when I go to light the model the lighting rotates weirdly. when you move around the leaves. To fix this for directional lighting I used something like: float3 diffuse = dot(light, float3(0, 1, 0)); This kind of works but now when I've added point light support to my shader it doesn't look so good anymore. this is because the point light is under the leaves thus they don't get shaded. The light could be above the leaves though and so I need some sort of dynamic normal generator biased on the point lights position. I figure there is a better way to doing all this then what i'm doing now. Any help will be great! -Toaster

Share this post


Link to post
Share on other sites
Advertisement
Assuming that 'light' is in view-space, the normal should probably be facing towards the viewer:
float3 diffuse = dot(light, float3(0, 0, -1));

Do you do your point-light calculations in world-space or view-space?

Share this post


Link to post
Share on other sites
Thats probably my problem the light is in world space I should move it to the view space and then use a normal of 0, 0, -1.

I will try this out! Thanks,
-Toaster

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!