Hi all
Does anyone know how to caculate the radius of the camera from the center point in octane. I am trying to figure out a fixed horizonel orbit path divided by 16 positions (images) around an object.
Not sure if you can snap to center view with octane.
(I wish the x,y,z was in degrees make life so much easier) and a point to center of object option for the camera.
Also a round up to 1.X/1.xx/1.xxx decimel or by exact degree.
Any suggestions or tools to work this out would be welcomed.
how to calculate radius points of camera positions x y z ?
Forum rules
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
- gpu-renderer
- Posts: 106
- Joined: Sat Jan 30, 2010 9:45 am
i7 920 2.66ghz quad core, gtx 285, asus p6t, 6gb OCZ 1600mhz ram, Windows 7 64bit ultimate. Nvidia cuda Driver v3 Nvidia display drivers V193.13. Octane beta 2
you have to project them onto a sphere.
leave the look at to the origin, eg 0, 0, 0.
then project your theta and phi onto a sphere.
first you convert your degrees to radians for theta and phi (theta is angle up/down and phi the rotation horizontally),
then map them to a sphere with trigonometry, and the distance from the origin is the scale:
x = scale * sin(theta) * cos(phi);
y = scale * sin(theta) * sin(phi);
z = scale * cos(theta);
Radiance
leave the look at to the origin, eg 0, 0, 0.
then project your theta and phi onto a sphere.
first you convert your degrees to radians for theta and phi (theta is angle up/down and phi the rotation horizontally),
then map them to a sphere with trigonometry, and the distance from the origin is the scale:
x = scale * sin(theta) * cos(phi);
y = scale * sin(theta) * sin(phi);
z = scale * cos(theta);
Radiance
Win 7 x64 & ubuntu | 2x GTX480 | Quad 2.66GHz | 8GB
If i understood well what you wanna do here, it's a geometry problem 
A spherical to cartesian coordinate conversion is what you need, which you can calculate (if i remember well) with these formulas:
x - x0 = r * sin(θ) * cos(φ)
y - y0 = r * sin(θ) * sin(φ)
z - z0 = r * cos(θ)
http://upload.wikimedia.org/wikipedia/c ... m_SZ_0.svg
where
x,y,z = camera position you're looking for,
x0, y0, z0 = target position (i suggest you take these coords from your modelling app, not easy to track in octane)
r = distance between target and camera - calculated via formula r = sqrt[ (x-x0)^2 + (y-y0)^2 + (z-z0)^2 ]
watch out! angles theta (θ) and phi (φ) are calculated in radians, not degrees! you have to convert that too
-thank god i'm greek and can easily type these characters! So in your case, you want to take shots of a constant r and θ, and a φ changing from 0 to 360 degrees, divided by 16 positions, so your φ step is 360/16= 22.5 degrees. which in rads is --> rad = degree*π/180 so your φ step is 22.5*3.14159/180= 0.3927 rads!!
suppose your camera is at (3,2,5) and your target at (2,0,4) :
r = sqrt[ (3-2)^2 + (2-0)^2 + (5-4)^2 ] = sqrt[1+4+1] = 2.4495 meters
and constant θ can be automatically calculated through these distances too according to this formula:
θ = atan[ (z-z0) / sqrt[(x-x0)^2+(y-y0)^2] ] = atan[ 1 / sqrt(1+4) ] = atan[1/2.2361 * π/180] = 0.0078 rads
so finally all you have to do is....
[position n in your fly-around path]
x = x0 + r * sin(θ) * cos(φ) = 2 + 2.4495 * sin(0.0078) * cos(n*0.3927)
y = y0 + r * sin(θ) * sin(φ) = 0 + 2.4495 * sin(0.0078) * sin(n*0.3927)
z = z0 + r * cos(θ) = 4 + 2.4495 * cos(0.0078)
replacing n with 0 to 16, you'll get all your 16 camera positions....
looking back at all this... what a mess!!! that's why quaternions were invented
good luck!
Edit: I think i was typing this at the same time with radiance. just took a bit longer to explain hehe

A spherical to cartesian coordinate conversion is what you need, which you can calculate (if i remember well) with these formulas:
x - x0 = r * sin(θ) * cos(φ)
y - y0 = r * sin(θ) * sin(φ)
z - z0 = r * cos(θ)
http://upload.wikimedia.org/wikipedia/c ... m_SZ_0.svg
where
x,y,z = camera position you're looking for,
x0, y0, z0 = target position (i suggest you take these coords from your modelling app, not easy to track in octane)
r = distance between target and camera - calculated via formula r = sqrt[ (x-x0)^2 + (y-y0)^2 + (z-z0)^2 ]
watch out! angles theta (θ) and phi (φ) are calculated in radians, not degrees! you have to convert that too

suppose your camera is at (3,2,5) and your target at (2,0,4) :
r = sqrt[ (3-2)^2 + (2-0)^2 + (5-4)^2 ] = sqrt[1+4+1] = 2.4495 meters
and constant θ can be automatically calculated through these distances too according to this formula:
θ = atan[ (z-z0) / sqrt[(x-x0)^2+(y-y0)^2] ] = atan[ 1 / sqrt(1+4) ] = atan[1/2.2361 * π/180] = 0.0078 rads
so finally all you have to do is....
[position n in your fly-around path]
x = x0 + r * sin(θ) * cos(φ) = 2 + 2.4495 * sin(0.0078) * cos(n*0.3927)
y = y0 + r * sin(θ) * sin(φ) = 0 + 2.4495 * sin(0.0078) * sin(n*0.3927)
z = z0 + r * cos(θ) = 4 + 2.4495 * cos(0.0078)
replacing n with 0 to 16, you'll get all your 16 camera positions....
looking back at all this... what a mess!!! that's why quaternions were invented
good luck!
Edit: I think i was typing this at the same time with radiance. just took a bit longer to explain hehe

- BroAugustine
- Posts: 31
- Joined: Sat Mar 20, 2010 4:39 pm
Hi,
For those not into trigonometry, I've added a little tutorial in the Resources and Sharing forum for visually matching camera positions in Blender and Octane. It should work with other modeling packages too. See http://www.refractivesoftware.com/forum ... =21&t=1040
For those not into trigonometry, I've added a little tutorial in the Resources and Sharing forum for visually matching camera positions in Blender and Octane. It should work with other modeling packages too. See http://www.refractivesoftware.com/forum ... =21&t=1040
Win 7 64 | I7-2600K 3.7 GHz | GTX 460, GTX 760 / Driver 347.09 | Cuda 7.0.18