PDA

View Full Version : Radiosity lightmap generator (Delphi).


Georgy
11-19-2005, 04:17 AM
I've updated source code. Any ideas on how to make it faster and look better are welcome.

Here is screenshots (PNG format, 1:1):

http://www.cnt.ru/users/coding/cornell-up.png

http://www.cnt.ru/users/coding/cornell-down.png

source code (185kb) (http://www.cnt.ru/users/coding/glrnew.zip)

roel
11-19-2005, 05:05 AM
Can you maybe post a picture of the original scene, without radiosity, just to compare them? I think that things look a bit odd now, but I can't really say that without knowing what the original scene looks like. For example, the left side of the right cube looks way too red, assuming that the cube was originally white, but when it was originally red it could be okay, that makes it hard to judge.

Georgy
11-19-2005, 05:46 AM
although it is possible to write some code for correction
(make color values less aggressive).
It's easy. We have full control of incoming color values:
for I :=0 to RadW-1 do // По всем точкам памяти RadiosityPointer
for J :=0 to RadH-1 do
begin
Pixel:=Pointer(Integer(RadiosityPointer) + 3*(i*RadW + j));
R:=R+Pixel^.R * formFactor[i,j]; // применяем FormFactor
G:=G+Pixel^.G * formFactor[i,j]; // и увеличиваем компоненты R,G,B
B:=B+Pixel^.B * formFactor[i,j]; // на значения КОМПОНЕНТА*ФОРМФАКТОР
end;

result.R:=R/(RadW*RadH*255); // Переводим в Single
result.G:=G/(RadW*RadH*255); // Знечения 0...255 в 0...1
result.B:=B/(RadW*RadH*255); // и усредняем делением на RadW*RadH
So we can do absolutely everything with this incoming colors.
If some color value (R,G,B) is much bigger than another then change it.

Original scene:
http://www.t800.ru/original.jpg
only walls are colored