Roughness in a Reflection

Started by
4 comments, last by Chetanhl 8 years, 10 months ago

I came across this site

http://www.chocofur.com/6-shadersamptextures.html

And I want to write a shader that uses a cubemap for reflection but I want to take into account the roughness of the reflection. Essentially it looks like the roughness more or less blurs the texture. This model seems to be used in Physically based shaders. I am curious if anyone can point me to an article that explains the formula for adding roughness to augment a reflection vector in a shader. Thanks!

xdpixel.com - Practical Computer Graphics

Advertisement

This is the best blog that describes this irradiance convolution.

https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/

For a gentler introduction follow some of the references and in particular the AMD presentations on this.

So if I understand correctly, from a shader perspective, we sample a cubemap just like we would as normal. The only difference is that the cubemap is been blurred offline. Perhaps we have multiple versions of the blur per mip map.

xdpixel.com - Practical Computer Graphics


Perhaps we have multiple versions of the blur per mip map.

Often one will use the mipmaps themselves as the blurred image.

Mipmaps are just box-filtered versions of the image, at progressively lower and lower resolutions, after all. You often need to take some care when generating the mipmaps to avoid artefacts, but once the mipmap chain is generated, you can cheaply sample the blurred image by varying which mipmap level you sample from.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Like swiftcoder mentioned, the common way to do this is pick a roughness per mip level and pre-convolve with the corresponding specular lobe for each mip level. As roughness increases you end up with lower-frequency information (AKA blurrier data), and so it makes sense to use the lower-resolution mip levels for higher roughnesses.

If you want to try to approximate more physically-based BRDF's, then you have to go further and try to incorporate a fresnel term as well as a geometry term. Unfortunately you can't pre-integrate those terms into a cubemap, and so you have to use approximations in order to try get the correct reflection intensity. There are two courses from SIGGRAPH 2013 that go into the details of doing this: the Black Ops II presentation, and the Unreal Engine 4 presentation.

Here's another good old link on the topic - http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html

My Game Development Blog : chetanjags.wordpress.com

This topic is closed to new replies.

Advertisement