Jump to content
  • Advertisement
Sign in to follow this  
Solid_Spy

OpenGL Light vs Mesh culling causes specular discontinuities.

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

Yo. I'm having a bit of trouble finding a way to work around this issue.

 

First off, I am making a forward rendering engine with dynamic light support. The lights will be collision tested against every mesh to see which meshes the light actually illuminates, in order to reduce rendering time and speed up shadow cube map rendering. It is made in C++ with Opengl.

 

This seems to work just fine, except it does not handle the specular highlights very well, resulting in the specular highlights being 'sliced off' by the borders of the objects that were detected after collision detection.

 

The distance of the light is only for the diffuse lighting, and the specular seems to expand much farther than the lights sphere radius used for light vs object culling.

 

I cannot just decide to skip the light vs object culling for lights with specular, because my meshes can only handle up to 8 point lights, and I may wish to have more than just 8 of them in my maps. So that is not an option.

 

I would imagine that this would be easier to solve if I just switched over to deferred rendering, but how would I solve this by just using a forward renderer?

 

Here is an image that shows the problem (note, there are two floor objects. One lit with the specular highlight, and the other that does not, even though it should).

 

Untitled-1_zpspapmddwl.jpg

Edited by Solid_Spy

Share this post


Link to post
Share on other sites
Advertisement

Is your falloff function actually going to zero? Squared inverse is correct falloff but it does never result zero. You need to modify function somehow. I have used this: max(0, (1/distance^2) - epsilon)

Share this post


Link to post
Share on other sites

Ok, I managed to solve it. I forgot to add falloff to the specular. I swore I already added it, but I didn't for some reason. I added it to the diffuse light but not the specular tongue.png.

Edited by Solid_Spy

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!