POV-Ray : Newsgroups : povray.advanced-users : Spherical camera upside-down : Re: Spherical camera upside-down Server Time
12 May 2024 07:51:09 EDT (-0400)
  Re: Spherical camera upside-down  
From: Mike Horvath
Date: 8 Sep 2016 17:59:55
Message: <57d1df5b$1@news.povray.org>
On 9/8/2016 4:10 PM, clipka wrote:
> Am 08.09.2016 um 14:44 schrieb Mike Horvath:
>
>> It is a LDraw model, which has an inverted y axis or handedness. The
>> problem is when I render the scene, it appears upside-down. Even though
>> I already compensated by making the y axis negative. Anyone have an idea
>> what is going on?
>
> To me it looks like you're trying to achieve via camera up, right and
> direction what someone else has already cared for via the matrix
> transform, so effectively the two cancel out.
>

As I said, I tried totally removing the matrix transformation, and the 
result was the same upside-down orientation.



> My recommendation would be to try and start from scratch:
>
> - The `sky` vector should be set to whatever is really "up" in the
> scene; the default is `y`, but you most certainly want `-y`.
>
> - The `up` vector should also be set to whatever is really "up" in the
> scene, possibly multiplied by `image_height/image_width`(*).
>

I tried setting both the "sky" vector and the "up" vector to "-y", but 
the result was no different.


> - The `right` vector should be set to whatever is "right" according to
> the orientation you find the scene easiest to visualize, possibly
> multiplied by `image_width/image_height`(*). You might pick `+x`.
>

The camera is spherical. Do I really need to scale the "up" and "right" 
vectors to the image dimensions? I was under the impression that the 
spherical camera already automatically fills a 2:1 aspect ratio image.


> - The `direction` vector should be set to whatever is "forward"
> according to your choice of "right", possibly multiplied by a zoom
> factor. (Alternatively, you can keep the `direction` vector constant and
> apply a factor to both `up` and `right` for zooming.
>
> - The `location` should, for now, be a place from where, given the above
> settings, you should be able to see something in the scene.
>
> (*only one of `up` or `right` should be multiplied with the stated
> factor; note that one is the inverse of the other)
>
>
> Once you get something remotely useful out of this straightforward
> camera setup, you can proceed to tweak the perspective to your liking in
> one of the following manners:
>

Here's my non-spherical version of the camera, which works perfectly 
well and without problems. I am generating panoramic images, and this is 
the cube mapped version.

		#declare Camera_Up		= -y*2;
		#declare Camera_Right		= +z*2;
		#declare Camera_Location	= <0,0,0>;
		#declare Camera_Direction	= -x;
		#declare Camera_LookAt		= Camera_Location + Camera_Direction;		// does 
nothing right now
		#ifndef (view_direction)
			#declare view_direction = frame_number;
		#end
		#switch (view_direction)
			#case (0)
				#declare Camera_Rotate	= <0,000,0,>;
			#break
			#case (1)
				#declare Camera_Rotate	= <0,090,0,>;
			#break
			#case (2)
				#declare Camera_Rotate	= <0,180,0,>;
			#break
			#case (3)
				#declare Camera_Rotate	= <0,270,0,>;
			#break
			#case (4)
				#declare Camera_Rotate	= <0,0,090,>;
			#break
			#case (5)
				#declare Camera_Rotate	= <0,0,270,>;
			#break
		#end
		#declare Camera_Transform = transform
		{
			rotate		Camera_Rotate
		//	matrix <0,0,-1,0,1,0,1,0,0,0,-88,-640>		// front entrance
			matrix <0,0,-1,0,1,0,1,0,0,0,-88,100>		// courtyard
		//	matrix <0,0,-1,0,1,0,1,0,0,0,-88,-180>
		//	matrix <0,0,-1,0,1,0,1,0,0,-280,-88,-180>
		//	matrix <0,0,-1,0,1,0,1,0,0,280,-312,140>
		//	matrix <0,0,-1,0,1,0,1,0,0,200,-312,-140>
		//	matrix <0,0,-1,0,1,0,1,0,0,-200,-312,-140>
		//	matrix <0,0,-1,0,1,0,1,0,0,-360,-312,140>
		}
		camera
		{
			up		Camera_Up
			right		Camera_Right
			location	Camera_Location
			direction	Camera_Direction
			transform {Camera_Transform}
		}

I don't understand why with the spherical camera I need to "tweak the 
perspective" further. I know I can fix the scene by simply rotating it 
180 degrees in GIMP. But I can't shake the feeling that there's a bug in 
the spherical camera code.


Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.