PDA

View Full Version : Fake radiosity



Titus
08-09-2003, 08:50 PM
Following this thread (http://vbulletin.newtek.com/showthread.php?s=&threadid=9226&pagenumber=2) I decided to implement a fake radiosity technique that is widelly used on other 3D programs. This script is far from been complete but I think is showing interesting results.

Titus
08-09-2003, 08:50 PM
// by Felipe Esquivel
// version 0.1 9/8/03


@version 2.1
@warnings
@script generic

curScene;


generic
{

type = 1;
radius = 6.0;
lightNumber = 60;
totalIntensity = 1;
lightName = "dome";
intenScale = 1.0;
reqbegin("Light Doom");
reqsize(332,210);

c1 = ctlstring("Light Name", lightName);
ctlposition(c1,35,34,266,19);

c2 = ctlpopup("Light Type",type,@"Distant","Point","Spot","Area"@);
ctlposition(c2,67,63,232,19);

c3 = ctldistance("Dome Radius", radius);
ctlposition(c3,75,92,225,19);

c4 = ctlinteger("Number of lights", lightNumber);
ctlposition(c4,48,121,252,19);

c5 = ctlpercent("Total Intensity", totalIntensity);
ctlposition(c4,168,150,110,19);


return if !reqpost();


type = getvalue(c2);
radius = getvalue(c3);
lightNumber = getvalue(c4);
totalIntensity = getvalue(c5);


reqend();

var lname, parNull, parId, i, lin=1;
var red, green, blue, mx, intens, x, y, z;
curScene = Scene();
(parNull) = curScene.getSelect();


for(i=1; i<=lightNumber; i+= 1)
{ if(type==1)
AddDistantLight(lightName + "_" + i);
else if(type==2)
AddPointLight(lightName + "_" + i);
else if(type==3)
AddSpotlight(lightName + "_" + i);
else
AddAreaLight(lightName + "_" + i);

parId = parNull.id;
TargetItem(parId);
HController(2);
PController(2);

theta = random(0, 6.2832);
eta = random(0, 3.1416);
x = radius * sin(theta)* cos(eta);
y = radius * sin(theta)* sin(eta);
z = radius * cos(theta);
if (y < 0)
y = -y;



Position(x, y, z);
LightColor(1, 1, 1);
LightIntensity(totalIntensity/lightNumber);
}
}

papou
08-10-2003, 01:16 PM
Hi titus, Overcaster from Eki is something like that u know.
http://www.kolumbus.fi/erkki.halkka/plugpak/
there is a plug named Domelight under construction too.
http://mapage.noos.fr/webto/lscriptInfo2.html

Titus
08-10-2003, 01:31 PM
Hi Papou,

Yes, I know about Eki's scripts but not about Domelight, my initial search didn't find that.

This is really a programming exercise because I wanted to implement a different algorithm. Instead of building a geodesic dome (fixed number of lights) I want to construct the dome with a Hammersley method, this approach allows the user to create any number of lights.

Thanks for your comments, I don't find many users interested.

papou
08-10-2003, 02:14 PM
ups sorry, i didn't want to stop you in your process!
your automatic add of light is interesting.
just wanna warn... u know, Lscript can be time consuming, and sometimes u discover a functionnal script later...

Titus
08-10-2003, 07:23 PM
Not at all ;), I'm writing the script for my own use but if help someone else, good.

I can't find the way to download the DomeLight script.

Tinkertanker
08-11-2003, 01:53 PM
I've been writing a very similar script where the points of an object get turned into lights.

Let us if you take it further.

EyesClosed
08-14-2003, 02:37 PM
Originally posted by Titus
Following this thread (http://vbulletin.newtek.com/showthread.php?s=&threadid=9226&pagenumber=2) I decided to implement a fake radiosity technique that is widelly used on other 3D programs. This script is far from been complete but I think is showing interesting results.

I've made scripts like this in the past (dome light, arrays of lights, etc.)

What LightWave needs is an ambient occlusion shader (a good one), like you'll find in RenderMan renderers or Mental Ray implementations. This method is by far the fastest, most intuative way to fake GI.

Maybe some of the shader gurus can whip one up. Source can be easily found for how to make them.

EyesClosed
08-14-2003, 02:38 PM
Originally posted by Tinkertanker
I've been writing a very similar script where the points of an object get turned into lights.

Let us if you take it further.

LightWave already does this: Luxigons.

Titus
08-14-2003, 06:07 PM
I've worked with occlusion maps with RenderMan before but the LW SDK is really bad documented and every programmer need to dig more than is necesary.

Titus
09-01-2003, 12:04 PM
A little update on the script:

http://www.garagepost.tv/renderman.htm

Look at the bottom of the page.

labuzz
09-01-2003, 01:25 PM
hello Titus,
Nice script! I have a few requests for you:D
It would be cool to have something like 3 colors instead of one and 2 more parameters for each colors :
- weight to control the % of generated lights
- noise for some hue variation

Tell me what you think, and tky for sharing your work!

Titus
09-03-2003, 09:31 PM
I like the idea, this will be implemented shortly. BTW I just updated the script with a bug fix.