We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › understanding spotlights
Page Index Toggle Pages: 1
understanding spotlights (Read 471 times)
understanding spotlights
Jun 20th, 2008, 6:50am
 
dear members,

I started to play with spotlights, and I am trying to understand them and the 3d space used by Processing. I can't see why the square turns black in the code below. What I can understand is that the spot is not moving, and the square has a fixed Z coordinate; so, the lighting shouldn't be being transformed, should it? I also tried to add a "translate (0,0,150)", to see if the transformations were added along multiple draw() calls, but nothing changed.

thanks for your time,
andrei



void setup() {  
 size(300, 300, P3D);
 colorMode(RGB,255);
 background(128);
}

float i = 1;
float aresta;

void draw() {  
 
 spotLight(255, 128, 0, 100, 100, -50, 0, 0, -1, PI/2, 2);

 aresta = 100*i;
 
 translate(0,0,-150);
 fill(255,255,255);    
 rect(0,0,aresta,aresta);
 
 i += .001;  
}
Re: understanding spotlights
Reply #1 - Jun 23rd, 2008, 1:50am
 
that is what I would like to achieve with processing:
http://www.andreithomaz.com/arquivos/hipersonica/luz_branco01.htm

This is just the start. For now, Flash seems to give the best graphical results. Spotlight in Pure Data are not great... And in Blender Game Engine and in vvvv, it seems that I would need to deal with shaders...

The problem with Flash is that I would really like to use the graphical card to increase speed. Processing in OpenGL would be great, if I could understand how to achieve this kind of effect with spotlights.

thanks,
andrei
Re: understanding spotlights
Reply #2 - Jun 23rd, 2008, 12:04pm
 
You'd need to use GLSL shaders to get per pixel spotlight effects unfortunately.

Also the lighting is additive, so you'd not be able to get coloured lights in a bright scene.. it'd have to be black outside the areas covered by the spotlight .
Re: understanding spotlights
Reply #3 - Jun 24th, 2008, 3:08am
 
thanks, that was what I wanted to know. I looked at vvvv, and I would also need to use shaders with it... So, for now, I will try to go with Flash as far as my cpu can Smiley
Page Index Toggle Pages: 1