Original Post
Hey all...
I''m trying to write a radiosity calculator for my lightmaps. My previous experience on lightmaps, is for point lights only, but i think i know the basics. Since now everything in my scenes were lightmaped my spherical or ellipsoid static lights. So, i decided to move forward and try radiosity!!!
My question is simple. How can i convert pathces'' / vertices'' colors into lightmaps'' color values?? What i mean is... (the procedure)
1) i setup my patches (quads)
2) i do one pass for shooting and gathering, using the old way(!!!). No hemicubes, or such things. I just render all the patches from the center of i patch, with a fov of 89.0f degrees, and i check to see if every other patch (j) is in frustum. If it is, i calc a form factor(!!!) between i and j, and then i add the j->Color*FormFactor*j->Area/i->Area to i->Color. This is slow but for beginning, it have good results.
3) i repeat step 2 as many times i want (usually 2 or 3 passes are fine for a semi lit result)
4) i (would like to) save the results in a lightmap!!!!
I know this is not the best way, but i don''t care right now. The problem is that saving to lightmaps appears to be very hard. Do you have any idea how i can do it. If you want more info tell it.
Another question. Why every demo i saw on the net, doesn''t render the resulted "lightmaps" with some textures (multitexturing)??? May be they just render the patches, or they don''t??? Because if they just render the patches, and i see this great-but-fake result (!!!), i just done it so far!!! This was easy. The hard is to save a lightmap, and when you render with multitexturing, you can get the same result!!!!!!
Another. How big must my lightmaps be? Must they be quads, or they can be rectangles too? Because with my point-light-lightmaps, i don''t have this limitation. The variable isn''t lightmap''s width or height, but lightmaps lumels per world unit. So lightmapWidth = 16, doesn''t mean that my lightmaps, will be 16 pixels wide, but 16*polygonWidth pixels wide!!! This way, i can use a very small lightmap, for very small polygon, and a very big for a very big. They just have same lumel density.
And a problem with hemicubes!! I downloaded glutRad and i read the code. I realized that hemicubes'' images must have the same dims as window dims. Can i change that?? Is it necessary to have the same dimensions?? Because i''m working in fullscreen mode (800x600), i think that a hemicude with images with dims 800 x 600 can be very painfull!!! I mean from RAM point of view!
HellRaiZer