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.
Page Index Toggle Pages: 1
Lights and peasyCam (Read 1595 times)
Lights and peasyCam
Jan 19th, 2010, 1:09pm
 
When I move the cam and have lights on, the color of my object will change significant until the cam stops moving. Is this a bug of the library?
Re: Lights and peasyCam
Reply #1 - Jan 19th, 2010, 2:01pm
 
Mhmm, if I call camera.feed() inside draw() it seems to work, maybe someone can explain it.
Re: Lights and peasyCam
Reply #2 - Jan 19th, 2010, 2:47pm
 
I don't think so. I noticed the same problem and it seems that the relative positions of the object being illuminated and the light are constant i.e. PeasyCam rotates both the object and directional lights.

I assume the effect you want is to rotate the object without changing the light direction. If this is the case then

Code:

// Declare a variable for camera matrix
PMatrix3D baseMat;

void setup(){
 size(400, 400, OPENGL);
 baseMat = g.getMatrix(baseMat);

 pCamera = new PeasyCam(this, 300);
 pCamera.lookAt(0, 0, 0, 110);

 // etc.
}

void draw(){
 background(20);
 // Save PeasyCam matrix and reset original
 pushMatrix();
 g.setMatrix(baseMat);
 // stage lighting
 directionalLight(200, 200, 200, 100, 150, -100);
 ambientLight(160, 160, 160);
 // restore PeasyCam matrix
 popMatrix();
 
 // draw objects

}


was a solution I came up with some time ago, there may be better ones now.
Smiley
Re: Lights and peasyCam
Reply #3 - Jan 19th, 2010, 4:15pm
 
I use this...
ambientLight(255, 255, 255, 0,0,0);
Re: Lights and peasyCam
Reply #4 - Jan 19th, 2010, 7:10pm
 
Peasycam only moves the camera. If you are only lighting your world from one side, then, as you move the camera, you will expose the dark side of your model. The changing "color" you see is I'm guessing some artifact of diffuse shading?
Re: Lights and peasyCam
Reply #5 - Jan 20th, 2010, 12:31am
 
But why the color only changes when the cam is moving. After stopping once, the color switch to the initial state. Here is a pic that shows the situation: http://www.flickr.com/photos/eskimoblood/4289564371/
Re: Lights and peasyCam
Reply #6 - Jan 20th, 2010, 11:44am
 

Hello,

I had a similar problem (until the moment I switched to processing version 1.09 and then from P3D to OPENGL and my program has stopped working at all   Cry   ).

Till then I had the following problem:

I used beginHUD and the changing light was not only on the object (which I find ok) but also on the HUD, which is bad since the HUD should not be part of the scene.
The HUD should provide textual output or buttons or whatever which should have a constant light when turning the scenery behind it.

Thanks!

Greetings!

Chrisir


Page Index Toggle Pages: 1