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 !

11/06/2007

FreeImage lib clumsiness

I've been using FreeImage lib for some years now, always with a bad feeling about the architecture and the scalability of its features.

I keep on using it as I didn't find another more convincing image loading library ; but today I had the proof that my feelings were right !

While loading a small 11x11 32bits TGA file, FreeImage reported it as being FIC_RGB and not FIC_RGBA, thus leading my wrapping code to remove the alpha channel... After a quick investigation, I found out that the 'FreeImage_GetColorType' function, when called, actually scans all pixels of RGBA images, and reports FIC_RGB if the alpha channel of every pixel is 255 !

Uh...

11/05/2007

Adobe/boost GIL vs. image resampling

After my first experiments with GIL a few months ago, I'm quite convinced that I'll have to take a closer look at it.

My first experiments allowed me to cleanup somehow my image support libs, and the wrapping of FreeImage library.

Having now the objective of a total makeup of my texture generation/compression pipeline, I'd like to have a solid framework to back up my algorithms, that would allow me to be more "data-format agnostic".

I've got to refresh my C++ template metaprogramming tricks as I'll have to face horrendous error messages ; I'll make sure not to drink too much coffee and have some aspirin nearby !

I'll tackle first with some image resampling algorithms, I hoped to find someone kind enough to publish something... Apart the limited resample extension to GIL, I didn't have any luck so far...

I hope GIL will be worth the time I'm going to spend with it ! If anyone who happens to read this have some GIL user experience to share, I'd be glad to be enlightened !

10/28/2007

Texture atlas gaps filling

I've come to change my gaps filling default algorithm for my generated atlas textures (mainly light maps).

I was not satisfied of my previous algorithm that did some dumb iterative texel replication of the nearest non-empty texel. This process lead to visually satisfying results when using the resulting textures, but the iterative process was too long on big textures (above 4M texels).

I tried to implement something like pull-push method, which turns out to have a better performance.

I'm quite glad with the results, except for the first texels at the immediate border of the charts boundaries. As my rasterization process is not exactly perfect for texture generation (it was designed for screen rasterization, and the rounding rules does not match texture access rounding rules), those texel are unfortunately visible during rendering...

I suppose I will try to mix both worlds : have a few iterations of border "fattening" followed by the pull-push gap filling...

Eventually, when I have some time, I'll change my whole texture atlas rasterization process to improve accuracy ; I'll perhaps follow the leads open by Casey Muratori's work for Granny 3D.

10/14/2007

CEDEC 2007 presentations

Following the Lost Planet technical presentations, I found out some other presentations on Tri Ace research web site. Unfortunately, I don't have the slightest notion of japanese....

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 !...