Randomness for radiosity

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Randomness for radiosity

Post by omaremad »

Im currently writting a postprocessor gpu radiosity calculator which bakes the results to a texture.

Instead of sampling radiance transfer between diffrent all the fragments on the surface of the object(exceeds instruction limit for big textures), i used a noise texture which cuaeses the shader to sample random fragments.

It works but the noise isnt noisy enough!, since the texture isnt changed for every fragment the noise texture pattern can be seen fogging the lightmap after the radiance has been transferred(its ugly).

Is there a good way to generate per fragment noise without using built in noise functions (most vendor impolemntations are bad, nvidia's glsl one Always returns 0! and they admit it).

Does anyone here have some tips on random number generation etc?
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

you can Xor two short chains of binary noise with differen length to one much longer....
so lets say one chain has 100 bits and another one 99 and you xor always one bit, the first repetition will be after 9900 random(at least as rendom as the chains have been befor) values..
so if you use a noise texture with 2*512 and just leaving the 1024th pixel out, you will have 512*511 random values...
(dunno if this helps.. but I implemetend this for lookup-Tables with random values with 10 different chains^^ so there have been damned much random values...)
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Hmm so you are telling me i should use lots of random textures, do some math on them and it should give more randomness. Im thinking of using each fragments texcoords as a seed for the random number. I think i need to do more reading on this. Thanks for the idea.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

no.. thats the good thing about it...
you can use one singel texture.
If it is for example 1024x2(so very small) it would give you about 1 047 552 random values!
if you use a 1024x3 it would already be 1 070 598 144 values
and with 1024*4 you have about 1 093 080 705 024 random values...
so very much random values with very low computation power and low memory size.. the technic was firstly used to create very long cipher-keys..

you can imaginate the method like two bands, one with 100 digtis on it the other on with 99 digits on it. now both start with digit 1. so the we go to the next digit(xor/adding etc both together) this will be on both bands number two. so on until the shorter band reaches digit 99. then digit 100 of the longer band will be combined with digit 1 of the shorter one. so that the First digit of the longer band will be combined with digti number two in the second cycle...
so if you use this principe with about 100 bands your will realy get very much random values...
(i hope now you can understand better what I mean..)
greetz tgm
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

The problem is there are no bitwaise operations for gpu programs!
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Never mind the fogging was because i was calculating the distance between two points using the normalmap :oops:.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
TheGameMaker
Posts: 275
Joined: Fri May 12, 2006 6:37 pm
Location: Germany

Post by TheGameMaker »

forget about bitwaise operations ^^ adding the two number will do the same :lol: :lol:
Post Reply