Showing posts with label lighting. Show all posts
Showing posts with label lighting. Show all posts

11/14/2007

SH experiments continued

My first spherical harmonics experiments were quite interesting ! I managed to include them in production quite quickly, in the form of irradiance volumes.

I currently use a set of volume textures to encode 3rd order RGB SH coefficients. This allowed me quickly have a convincing diffuse lighting on the animated entities in my project. As the lighting in smooth enough, the SH encodes both direct & indirect lighting with good enough results.

I also experimented with SH for other purposes :
  • obtaining convincing specular colors. The preliminary results were interesting but I lacked time to properly integrate this feature.
  • obtaining lighting for volumetric lighting effects. While I managed to have some nice atmospheric effects, this method is not directly applicable to reconstruct clearly visible "light beams". Moreover, the ray marching code in fragment shader is quite costly, so for now, I discarded it.
  • lighting vegetation planes. This is a nasty hack, but the vegetation now have a subtle view dependent lighting that contributes to reduce a tiling effect ; and the vegetation now better integrates with surrounding geometry.
I'm quite happy with the possibilities lying ahead !

10/12/2007

VRay exposure control formula

While browsing some code, I remembered that I wanted to share some code reproducing VRay exponential exposure control.

I had to work out the formula myself as I did not find any documentation about their 'dark multiplier' and 'bright multiplier'.

This is what I eventually found out (GLSL code) :

uniform float exposure_gain;
uniform float exposure;
uniform float dark_multiplier;
uniform float bright_multiplier;

vec3 exposure_control(vec3 base_color)
{
vec3 dark = vec3(0.5) - base_color;
dark = 0.25 - (dark * dark);
vec3 bright = base_color - dark;

vec3 color = dark_multiplier * dark + bright_multiplier * bright;
color = exposure_gain * (vec3(1.0) - exp( -exposure * color ));

return color;
}

Edit:: to those you that come here by accident, looking for 'vray' and 'sea', all I can tell you is to look at this, even though it is probable that it won't help you !

10/10/2007

Spherical harmonics tryout

Today, I finally took some time to experiment with spherical harmonics ! It is a logical progression as I was toying with irradiance cube maps.

For now, SH only permitted me to build those cube maps faster, and to get rid of the noise generated by GI sampling, but, hey ! It's a start !

I mainly referred to 'standard' SH resources ::
Hm, I really gotta keep moving towards more data driven rendering code to have, hm, let's say, SH compressed signal as a mesh attribute !...