28 diciembre 2011

Diffuse Convolution

Ambient light in UDK comes from 3 possible sources:
  1. SkyLight
  2. Spherical Harmonics 
  3. Lightmaps
Another way for static models is to use  Diffuse Convoluted cubemaps. It helps to integrate our model with our scene color. For me this is the best solution to fake GI without baking light. Its a fast and 'easy' process and correct color is ensured. Perfect for model showoff.

As first example, I just made a Phong+Lambert*DiffuseConvolution:

At first, I had a problem, because UDK rotates cubemaps  -90 in X axis. So I had to do some matrix rotation in the pixel shader to find what was wrong there.

Rotation in X=90 was my first attempt, so it was fast. Once I known that, I had to find a software to do this. HDR Shop was the solution.

The next step was made in CubeMapGen. I imported the hdr file created in HDR Shop and applied the needed filters. Then, export CubeMap as images and we are done, ready to import to UDK.
I used public Light Probes, just for now, for testing. But the idea is to export your UDK cubes and create the convolved offline. There is a plugin called Diffuse_sh designed for that. It doesnt work for me. HDR Shop too, but my results weren't good. A sloppy solution would be a Blur in CubeMapGen... but it cant be correct.

I applied the trick to my translucent shader. The difference is barely noticeable due to the light algorithm I made there, but in a Lambertian one, is very notable.

No hay comentarios:

Publicar un comentario