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 & HelpPrograms › Camera Movements
Page Index Toggle Pages: 1
Camera Movements (Read 705 times)
Camera Movements
Mar 12th, 2008, 5:55pm
 
Hi, i was just wondering if there's anyway to get the viewing area to function like a camera view, or whether there's a library out there that does it?
Re: Camera Movements
Reply #1 - Mar 12th, 2008, 7:35pm
 
The OCD (Obsessive Camera Direction) library should do what you want I think.
Re: Camera Movements
Reply #2 - Mar 12th, 2008, 8:10pm
 
Doesn't it always the working area behave like the camera?

I mean, when using a 3D renderer, the viewing area is actually what the camera sees.

What am I missing here?

@JohnG: What's that library for?
Re: Camera Movements
Reply #3 - Mar 13th, 2008, 8:33am
 
oh yeah, that's the one. Missed it on the extended libraries page.

it's working out great.

aca: it's just an abstraction of the camera() function, so you can use the usual camera paradigms like dolly, truck, roll, pan, tilt, etc.

Re: Camera Movements
Reply #4 - Mar 13th, 2008, 9:27am
 
Oh is there anyway to calculate the width & height of the viewport of the camera? i'm trying to do the fill a white with alpha rectangle trick to clear out the background.
Re: Camera Movements
Reply #5 - Mar 13th, 2008, 10:11am
 
A little funny thing about though, if i draw a rect near the camera position and the alpha is not 255, objects drawn further from the camera z position can be seen -- the alpha of the white rect doesn't seem to affect the further images much. But at 255, it's all opaque ( as it should be).

So basically i'm trying to ask, is there anyway to allow processing to view the entire scene as 2D even though there is a 3D camera?
Re: Camera Movements
Reply #6 - Mar 13th, 2008, 11:29am
 
if you draw a object that is not opaque its transparent so allows to see through it.
as for your question the solution is you should draw transparent objects after you draw your opaque ones and you should sort them out and draw back to front.

to view your scene in "2D", no perspective draw them in Ortho mode.
Re: Camera Movements
Reply #7 - Mar 14th, 2008, 6:11am
 
i was just a little surprised that an alpha of 254 doesn't seem to have much effect on the far objects, but i guess that would be solved by the drawing back to front advice.

i can't use the ortho mode because it's already using OCD. The solution is probably just to create a pimage and draw into that pimage and attach it to a point that turns/rolls/tilts together with the camera and at a distance that covers the width and height of the viewing area.
Re: Camera Movements
Reply #8 - Mar 14th, 2008, 6:05pm
 
well, i suddenly realised that i could just manipulate the pixels[] array and do whatever i needed there.

!!
Re: Camera Movements
Reply #9 - Mar 15th, 2008, 6:43pm
 
[quote author=disablek
aca: it's just an abstraction of the camera() function, so you can use the usual camera paradigms like dolly, truck, roll, pan, tilt, etc.
[/quote]


Ohh. I see. So you can just say like, "pan the camera to the right 300 pixels", instead of replacing all the camera parameters, including eye position, etc?
Re: Camera Movements
Reply #10 - Mar 17th, 2008, 1:30am
 
yeah, though the OCD library seems to have some problems with    trucking in the x direction when the camera has rolled about the z axis. Pop open the java file that comes with the ocd library, it's not really massive and has all the maths.
Page Index Toggle Pages: 1