Jump to content
  • Advertisement
Sign in to follow this  
3dreamer

spotlight jagged edge

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

3dreamer Member since: 11/23/2007 Posted - 11/23/2007 2:41:54 AM I am trying to create a pixel shade spotlight by using the theory of inner cone and outer cone, but I get a spot light with jagged edge. It's not big but noticable, especially when I set the inner cone same as the outer cone (same angle) I see a zigzag edge, instead of a smooth edge. I also see black lines in and out crossing the edge. It's annoying. Here is what I did in the Pixel function. After I calculate the direction of the object to the light, I dot it with the normal of light direction, then I used smoothstep function to interplate the cos value: float3 objTolight = light.posW - IN.posW; float spotDot = saturate(dot(normalize(-objTolight), normalize(lightDir))); float spot = smoothstep(cos(phi), cos(theta), spotDot); IN.posw is passed from Vertex function. I think it maybe caused by the floating point calculation. maybe some points within the edge are rounded to the outside? any help will be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
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!