Hi guys,
Does anyone know the way to control the output format in renderVR()? Really need png format with alpha channel on.
I noticed that "RenderPanoramicFrames" script is using "path" in the renderImage() to specify the format.
So I tried to add another rotation axis, similar to VR.
But it seems only camera rotates along itself, not orbiting around the object.
for j in range(vframes):
dir = lux.getCameraDirection()
for i in range(hframes):
dir = ((dir[0] * cos(angle) + dir[2] * sin(angle))*cos(vangle),
dir[1]*sin(vangle),
(-dir[0] * sin(angle) + dir[2] * cos(angle))*cos(vangle))
lux.setCameraDirection(dir)
fmth=fmt.replace("%d", str(j),1)
fmtv=fmth.replace("%d", str(i),1)
path = os.path.join(folder, fmtv)
print("Rendering {} of {} frames: {}".format(j+i, vframes*hframes, path))
lux.renderImage(path = path, width = width, height = height)
Then I tired the original RenderPanoramicFrames script again. It doesn't work either. Attached are some images of first few frames. Could it be the issue of my camera position?
Do I need to use setCameraPosition(...) to get this work?
Hello fsong,
You are rotating the camera but not moving it around, which is why you are getting those results. You could use lux.setCameraPosition(). Right now you can't change the output format when calling lux.renderVR(), unfortunately. The Render Panoramic Frames script works just fine, it rotates around its Y-axis. This is not what you want directly.
Hi Morten,
Thanks for the reply.
In the Render Panoramic Frames script, it only uses lux.setCamerDirection() function, not setCameraPosition(), right? How does it work to make it rotate around Y axis in this script?
It only changes the camera direction because it is rendering images "inside" something, e.g. to have a 360 degree look inside a car, for instance.
The rotation itself takes in the camera direction and applies a Y-axis rotation by a certain angle:
# Rotate around Y-axis by angle in radians.
dir = lux.getCameraDirection()
dir = (dir[0] * cos(angle) + dir[2] * sin(angle), # X
dir[1], # Y
-dir[0] * sin(angle) + dir[2] * cos(angle)) # Z
lux.setCameraDirection(dir)
Hi Morten,
So I tried to rotate the part instead. But the problem is that the rotation center is the CAD model coordinate not the center when we use the move tool. Can you advise how to fix this please? Thanks!
axis_x=luxmath.Vector(1, 0, 0)
axis_y=luxmath.Vector(0, 1, 0)
V = luxmath.Matrix().makeIdentity().rotateAroundAxis(axis_x,vangle)
H = luxmath.Matrix().makeIdentity().rotateAroundAxis(axis_y,hangle)
Hello fsong,
In order to rotate around another origin you need to translate your matrix accordingly. Translate to (0, 0, 0), rotate it, and translate it back to where it was. This way you rotate it around itself.
Thanks, Morten..
I tried to apply .Translate on the root node. It translated entire object but didn't change the rotating center.
Only if I apply .Translate on the children node, it would change both.
Is this the case here?
Hello fsong,
It doesn't necessarily make sense to translate the root, but the actual node you want to translate instead. So as I wrote: "Translate to (0, 0, 0), rotate it, and translate it back to where it was."
Thanks