Sign in to follow this  

spotlight jagged edge

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this