Page 2 of 3

Posted: Fri Dec 03, 2010 9:42 am
by devsh
wont work.. the values will still be with 255 bit precision

Posted: Fri Dec 03, 2010 12:23 pm
by loki1985
devsh wrote:wont work.. the values will still be with 255 bit precision
i guess you mean 8bit...

Posted: Fri Dec 03, 2010 12:56 pm
by slavik262
devsh wrote:wont work.. the values will still be with 255 bit precision
Not if you spread it across all four channels of say, a PNG. You'd get 32 bit precision. That should be more than flexible enough.

Posted: Fri Dec 03, 2010 1:08 pm
by devsh
I meant 255 possible values... soz

Posted: Fri Dec 03, 2010 1:47 pm
by slavik262
And I'm saying that if you use all 32 bits per pixel (R, G, B, and A channels), you can store a range of 4,294,967,296 possible values between no light and your maximum brightness. That should be more than enough precision.

Posted: Fri Dec 03, 2010 1:56 pm
by devsh
I just rendered the data into a 32 bit floating point texture instead :)

Mel, you can start clapping... here is the first coefficient of every spherical harmonic for the level (7 more maps like that and im done)

Image

Posted: Fri Dec 03, 2010 2:07 pm
by slavik262
You asked about a viable way to save the HDR texture. Unless you just want to save the array of floats in a bitmap-like format, you'd need to do something different like what I suggested or write your own image writer/loader.

Posted: Fri Dec 03, 2010 2:11 pm
by devsh
thats a screenshot... store SH differently (binary file)

Posted: Fri Dec 03, 2010 2:27 pm
by slavik262
:roll: No, I'm not talking about an HDR screenshot. I'm talking about any HDR texture. I'm only responding based on this:
devsh wrote:okay now it seems I only need to find and adapt the HDR image loader so I can finally stick my samples in a texture :)
Like I said above,
slavik262 wrote:Unless you just want to save the array of floats in a bitmap-like format, you'd need to do something different like what I suggested or write your own image writer/loader.
The other advantage of saving via a pair of PNGs is that you can see what the image looks like with any standard image viewer/editor.

Posted: Fri Dec 03, 2010 2:30 pm
by devsh
I was thinking static texture containing the entire level... but it will get more fun if I can update that lookup texture by rendering all the SH in camera frustum into it to achieve higher detail

Posted: Fri Dec 03, 2010 7:55 pm
by devsh
Finally Done IT!

This is my GI atlas
Image
Image

Right still at 200 fps and the whole level is NOT lit, textured, lightmapped in any way what so ever... just pure GI per pixel pass (note: there is a bug.. sometimes the GI "leaks" through walls... normal sensitive interpolation could possibly work)
ImageImageImageImage
ImageImageImageImageImage

And what do we have here???
Image
Oh yes... ambient/self occlusion... how good is that
Image

In conclusion...
The leaks on the walls can be eliminated with normal sensitive interpolation and/or taking more samples (which is not possible until irrlicht handles lock() on RTT without memory leak).
SSGI (small radius/scale GI) can be used for the corners (like SSAO) to aid the SH method as light bleeding is sometimes lost there (related to the first problem)
SSAO will add small scale AO

My method + Screen Space methods will give you best image quality as my method handles big crude scale scattering and the SS methods handle small corners and pixelwise AO/GI

You can stick any model in there, move it around rotate and scale and it will pick up appropriate GI. So this will give you an effect like lightmaps except it will affect dynamic objects :) which is not possible with lightmaps.

Off to read crytech's paper about the bleeding issue

P.S. offsetting the interpolation by normal*3/8 of the distance between probes works wonders to light bleeding

Posted: Fri Dec 03, 2010 9:04 pm
by Mel
Image

Well done, really well done! :) I thought your approach would be another. You've implemented, then, irradiance volumes, right?... That's a really good way to lit not only levels, but dynamic elements. I am impressed, you've done a great job!

Posted: Fri Dec 03, 2010 9:09 pm
by devsh
I'm thinking of actually making a combine/injection stage/filter and some bunnies, cubes and spheres flying around

also volumetric fog lit by spherical harmonics (trust me... interesting) which is not very likely to work out

Also I might add some SSAO+SSGI just to add "2nd bounce"

P.S. However making it dynamic (changing lighting conditions) is black magic to me... like euthanasia I am not touching that with a 20ft pole

Oh damn I got an idea now... second set of Spherical Harmonics encoding a cube map of normals... which can be lit by lights (simple operation) and added to the "ambient" harmonic... oh no must carry out tests now to see if the result of SH(render(light*normals+ambient))==approx==SH(render(normals))*light+SH(render(ambient))

Posted: Fri Dec 03, 2010 10:10 pm
by fmx
Great stuff, looking forward to seeing how you evolve simple SH :D

Posted: Sat Dec 04, 2010 11:56 am
by devsh
3 buffers, ambient, diffuse and normal could allow me to introduce dynamic lighting to global illumination and a shadow map could give me a really eyegasmic effect.

I could also prebake SH for static models which move around, with ambient (and normals+diffuse) encoded with RGBA so i can blend them with static gi buffer as they move around... Sure success