- Thu Nov 02, 2017 6:30 pm
#395891
Hello
this is a script to add cameras around an object ; i have a problem with the top and the bottom cameras
both of them have roll angle = 20520 (360*57) and the view rotated by 180°; when i change this value the resolution became 0 x 0 and this problem fixed when i change the x or the y value to : 0.00001 but it is not precise.
in studio a top or a bottom camera with this settings:
position(x=0,y=n,z=0) , target(0,0,0) , target distance =n
always the resolution width and height = 0
** is there way to control roll angle with pymaxwell ? maybe that fix the problem
this is a script to add cameras around an object ; i have a problem with the top and the bottom cameras
both of them have roll angle = 20520 (360*57) and the view rotated by 180°; when i change this value the resolution became 0 x 0 and this problem fixed when i change the x or the y value to : 0.00001 but it is not precise.
in studio a top or a bottom camera with this settings:
position(x=0,y=n,z=0) , target(0,0,0) , target distance =n
always the resolution width and height = 0
** is there way to control roll angle with pymaxwell ? maybe that fix the problem
Code: Select all
from pymaxwell import *
import os
import math
def ibl():
mxsFile = 'F:/change ibl/math/cams.mxs'
camera_name = 'cam'
active_camera = 'perspective'
scene = Cmaxwell(mwcallback)
scene.readMXS(mxsFile)
a = 360 # (degree)
r1 = 10 # sphere radius : variable
n1 = 20 # cameras longitudinal numbers : variable <<<<<<---------------------------------------||
b1 = float(a) / n1 # variable
n2 = 10 # cameras latitudinal numbers : variable <<<<<<---------------------------------------||
b2 = float(a) / 2 / n2 # variable
f = n2/2
l1 = list(reversed(range(0, f))) # half sphere top
l2 = list(reversed(range(f, n2)))
l3 = l1+l2 # full sphere
# top camera
camera = scene.addCamera(camera_name+'0', 1, 1.0 / 800.0, 0.04, 0.035, 400, "CIRCULAR", 0, 0, 25, 400, 300, 1)
camera.setStep(0, Cvector(0, r1, 0), Cvector(0.0, 0.0, 0.0), Cvector(0.0, 1.0, 0.0), 0.035, 8.0, 0)
#for i in range(n2):
for i in l3:
#print i
v1 = b2 * i
if v1 < 90:
pass
#print v1
if v1 > 90:
v1 = v1-180
#print v1
if not v1 == 90:
print v1
v2 = math.radians(v1) # radians
cosa = round(math.cos(v2), 10)
sina = round(math.sin(v2), 10)
r2 = r1 * cosa
z = r1 * sina
# print '------------------------------'
# print 'Radius: ', round(r2, 5)
# print '------------------------------'
for i in range(n1):
# print i+1
c1 = b1 * i
if c1 <= 180:
pass
#print c1
if c1 > 180:
c1 = c1 - 360
#print c1
c2 = math.radians(c1) # radians
#print c2
sinb = round(math.sin(c2), 10)
cosb = round(math.cos(c2), 10)
x = r2 * sinb
y = r2 * cosb
# print(round(x, 5), round(z, 5), round(y, 5))
# print round(z, 5)
# Create 360 cameras
camera = scene.addCamera(camera_name+'1', 1, 1.0 / 800.0, 0.04, 0.035, 400, "CIRCULAR", 0, 0, 25, 400, 300, 1)
camera.setStep(0, Cvector(round(x, 4), round(z, 4), round(y, 4)), Cvector(0.0, 0.0, 0.0),
Cvector(0.0, 1.0, 0.0), 0.035, 8.0, 0)
# perspective active camera
camera = scene.addCamera(active_camera, 1, 1.0 / 800.0, 0.04, 0.035, 400, "CIRCULAR", 0, 0, 25, 400, 300, 1)
camera.setStep(0, Cvector(35, 8, 25), Cvector(0.0, 0.0, 0.0), Cvector(0.0, 1.0, 0.0), 0.035, 8.0, 0)
camera.setActive()
output = 'F:/change ibl/math/cams1.mxs'
print(output)
ok = scene.writeMXS(output)
if __name__ == "__main__":
if ibl():
print ('OK')