Click here for EyeGasm (RL GI) [FULL SRC && DEMO AVA

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

Ok I am now regarding this thing complete and closed.. you can expect another example zip with source code within 72 hours, I just need to remove constants in order for the bake process to be flexible (tile factor is hardcoded into shader) I will also check the Y index reconstruction and put all my ugly hacks into nice structured code

I have finally handled merging/blending GI into the scene

Here are some screenshots (30 odd)
http://project-ninja-star.googlecode.com/files/GI.zip
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Post by ACE247 »

Maybe we should call you 'GI' devsh now.:wink:
Screenshots look really great!
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

thankyou... the GI messes up brightness lol :)
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

haha lol.. I just found a simple solution to the light going through walls issue, allowing me for a smaller normal offset in the previous solution (which messes up small models). It's disabling BACKFACE CULLING!!!

Also i finally have a general idea of how to implement lighting, have 3 sh... Diffuse, normal and depth. Now Tom Forsyth says sh can be added and multiplied just fine by each other which means i can multiply the normal sh by the depth sh (normal sh is 3 shs because of xyz) to find xyz distance from cEntre of the harmonic. Next we pretend that the light position minus the harmonic centre coordinate is a harmonic (using standard conversion scheme but using only one sample) and we can add this harmonic to the normal*depth one resulting in a light vector from surface encoded for the cubemap in 3 sh. We can then dot product it with the normal harmonic obtaining a single channel harmonic giving us the lambertian lighting coefficient, which can be multiplied with the diffuse harmonic and the result added to the main ambient harmonic. All this can be done on hardware directly if presenting shs as lookup textures.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

If shadowmapping was to be carried out, then buffers diffuse would have to stay separate for each light and the shadowing carried out each time a sh coefficient is fetched because it is a bool operation.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

To have a physically correct solution you should also make sure that if a mesh is closed, when you disable the backface culling, the polygon seen from the inverted normal (when the viewDir and Normal vectors give a negative dot product) is totally black, else, you could be receiving light from inside an object, which is another source of light leaks.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

Thanks i will be on the lookout for this. I wont be able to avoid negative lighting, clamping the dot product will have to be done when an object samples it's illumination because clamping would gently caress up a spherical harmonic
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

mmm.. almost done with cleaning up code.... Now I am baking normals into SH and trying to get some lighting response
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

This is kind of nitpicking, but see the edit button? Double (and even triple) posts clutter up the boards unnecessarily.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

sorry....

P.S. I got a demo with lighting dont try to change the spacing between spherical harmonics or rebake the data... I hardcoded the shader and the bake process will only bake diffuse maps (although you could figure out how to do normal maps easily)
Post Reply