Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Radiosity (Oh no not again!!!!!)

This topic is 5438 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello again. (This is irrelevant with the subject but i have to start somehow!!!!!So...) A week or two ago, i had posted my final post on a radiosity thread i''d started. Some of you may remember it! Since then i rewritten all my code, made it clearer etc. All this time i was searching on the subject. I found some things, so i''m here to ask again... First of all, the radisity to color conversion. I searched the net for everything on color and color theory, as well as light physics and light transfer in general. I have found some things (very general), but they didn''t helped a lot. One book i found, made it clearer, but i''m still a little confused. The book is "The Computer Image" by Alan Watt and Fabio Policarpo, and at chapter 25 it deals with color. Also on the accompaying CD-ROM there is a program called SpectRay, which uses the whole visible spectrum (around 300 samples, from 360nm to 760nm with an interval of 1 nm), for color manipulation, in raytracing. From there i tried to understand how it works, and i tried to use it on my radiosity solver. The "problem" is that i used only 3 wavelengths, one for each color component (RGB), but this is not a real problem. The real problem is that. As i was playing with initial radiosities, i found that for a "correct" spectral_to_rgb conversion, spectral values must be small. It seams to work right, but i can''t find the best input for initial radiosities, so i can have a correct result. Questions on that. What''s the input dimensions (Watt, lumens etc.) for "relevant spectral intensity", so the conversion work as it should?? "Relevant spectral intensity" appears on the CIE charts, as the y-axis, or at least i think so! I know the Radiosity is W/m^2, but how can i convert it to Intensity? Because everyone uses exposure, i tried to "exposure" my RGB radiosity values, and then pass those values in the spectral_to_rgb function. Any other ideas, or better the correct one??? Whats the appropriate value for total energy - radiosity for a common light??? Must i calculate it using the tempreture of the light, or i can do it in a different way? (One more time). How can i setup initial radiosities, when i have colors, luminosity, reflectance as input??? Other ways of doing this "conversion", is with some "tone reproduction operators" i found in a book called "The design of a realistic images synthesis system" (it is availiable on-line, and if somebody cares, i''ll post the url. It is from a university, and its free.I dl it, afterall!!!) There, some simple operators where used, such as "Maximum to white", Reinhard''s non linear operator, etc. They seam to work in some way, but the problem is that everyone of them needs different input data, for correct-looking results!!! But i have nowhere found an operator that uses exposure!!! One more thing is the difference between intensity and power of a patch. Why there are two things for - my point of view - the same thing??? Where should i use intensity, and where power??? Another thing. I hope Yann reads this. Yann you have posted some pictures of extremely realistic enviroments, rendered with radiosity, reflections, etc. Are those pictures captured in real-time? Because reflections are view-depended, and they need raytracing for making them (if i''m right!!!). I saw a demo in the above book''s cd-rom, which is doing just that. It lights the world using radiosity, and then it raytrace it, for reflections. And if, one in a million, your reflections is real-time, what''s the "lightmap" dimension''s for having this kind of detail (no need to answer that!!!). Finally, i realized that my radiosity solver is veeeeeery slow. Any thoughts on speeding it up??? Adaptive subdivision tuts would be great, if someone has something to suggest. And what''s the best spatial subdivision algorithm for that kind of use (BSPs, Octrees etc.)??? I found that in raytracing, octrees are used, but why BSPs aren''t suitable for that??? Should i use Octrees for visibility checking??? Because BSPs are a little difficult to manipulate, from the point of view, that you need to seperate the models that will make the BSP from the polygons that will be pushed to the tree. You can''t have a spherical light part of the BSP, can you??? And for those who wants to know this spectral_to_rgb function, here it is (as it appears in the book''s source)

// Uses only 3 wavelengths, one for each color component. If someone wants the whole range i''ll upload it. The three wavelengths are (446, 545, 605)

GEColor	X_tristim(1.0456f, 0.3597f, 0.3463733f);
GEColor	Y_tristim(0.5668f, 0.9803f, 0.03131083f);
GEColor	Z_tristim(0.0006f, 0.0134f, 1.7829682f);

float matXYZtoRGB[3][3]= { { 2.043f,-.568f,-.344f },
                           { -1.035f,1.939f,.042f },
                           { .011f,-.184f,1.078f } };

void spectral_to_xyz(GEColor *sc,GEColor *xyz)
     GEColor temp;

	float xyz_scale = 1.0f / Y_tristim.Area();

     temp = *sc * X_tristim;
     xyz->r = temp.Area() * xyz_scale;

     temp = *sc * Y_tristim;
     xyz->g = temp.Area() * xyz_scale;

     temp = *sc * Z_tristim;
     xyz->b = temp.Area() * xyz_scale;

void spectral_to_rgb(GEColor* sc,GEColor *rgb)
	GEColor xyz;


	rgb->r = (matXYZtoRGB[0][0] * xyz.r) + (matXYZtoRGB[0][1] * xyz.g) + (matXYZtoRGB[0][2] * xyz.b);
	rgb->g = (matXYZtoRGB[1][0] * xyz.r) + (matXYZtoRGB[1][1] * xyz.g) + (matXYZtoRGB[1][2] * xyz.b);
	rgb->b = (matXYZtoRGB[2][0] * xyz.r) + (matXYZtoRGB[2][1] * xyz.g) + (matXYZtoRGB[2][2] * xyz.b);
	rgb->r /= 1.130924f;
	rgb->g /= 0.9459907f;
	rgb->b /= 0.9053899f;
The GEColor::Area() function is returns the area below the spectral function and the wavelength axis. It can be computed with any numerical integration method. Trapezoids, rectangles, etc. I hope it seams as clear as i wanted to be!!! My english are bad, and i''m a little confused, so sorry if something makes no sense!!! I appreciate any advise on the above stuff, and especially on the "speeding it up" part. Thanks in advance. HellRaiZer

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!