Sign in to follow this  
bobjones9190234324

World specular cubemaps

Recommended Posts

So i have been trying to understand this concept of being reading about in this document: http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf


The part im having trouble with is the "World specular lighting", I googled all yesterday and could only find vague information about it. The basic concept I understand is that you precalculate specular lighting into cube maps at environment probes. Can someone give me more information about how this data is precalculated and how that is applied to the world? Or does anyone else know of some other methods for precalculating specular lighting?

Thanks!

Share this post


Link to post
Share on other sites
johnchapman    601
The scene is rendered from the perspective of the environment probes, once for each face of the cube, then each face is blurred. When rendering objects in the specular lighting pass each object finds the most appropriate cubemap available (probably the nearest) and reads into it using the view direction reflected around the surface normal. This is then combined with the specular factor and added to the final lighting result.

That's the impression I got from looking over the document you linked to, hope it helps :)

Share this post


Link to post
Share on other sites
MJP    19754
Yeah it's exactly as johnchapman decribes it. It's actually not terribly complicated to implement...you can use your renderer to render the 6 cubemap faces for each probe. However for it to look good you'll want to properly filter the cubemaps to blur them and generate mipmaps (standard mipmap generation won't filter across cube faces, which creates seams). ATI CubeMapGen can do this for you if you want. However if you want it to be *really* good, you'll want generate each mip by convolving the source map for a particular specular power so that you can use the material glossiness to select a mip level. But CubeMapGen is a good place to start.

Once you've rendered probes, choosing which map an object uses can be a bit tricky. Simply choosing the closest probe is one way do it, but it definitely won't work for all cases. You would definitely want to allow a way to manually specify which probe an object uses, or allow probes to specify which regions they affect. Another alternative you can use if you have a deferred renderer is to do what Crytek does, and render probes in a deferred manner. Basically you render the probes with a volume like you would a deferred light, and have some falloff that attenuates the amount towards the edges of the bounding volumes. This lets you arbitrary blend together the probes, which means you can avoid hard edges where objects switch from one probe to another, or when a dynamic object transitions from one probe to another. It also means that you don't need to explictly associate your objects with probes...well at least for you opaque objects. :P

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