Author Topic: renderVR(...) and RenderPanoramicFrames issue  (Read 3420 times)

0 Members and 1 Guest are viewing this topic.

Offline fsong

  • Newbie
  • *
  • Posts: 7
renderVR(...) and RenderPanoramicFrames issue
« on: February 26, 2016, 09:48:38 am »
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?

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 128
  • Software Engineer, Luxion
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #1 on: February 28, 2016, 04:12:11 am »
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.

Offline fsong

  • Newbie
  • *
  • Posts: 7
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #2 on: February 28, 2016, 01:01:52 pm »
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?


Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 128
  • Software Engineer, Luxion
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #3 on: February 29, 2016, 02:50:49 am »
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)



Offline fsong

  • Newbie
  • *
  • Posts: 7
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #4 on: March 14, 2016, 07:36:28 am »
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)

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 128
  • Software Engineer, Luxion
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #5 on: March 16, 2016, 03:55:14 am »
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.

Offline fsong

  • Newbie
  • *
  • Posts: 7
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #6 on: March 16, 2016, 02:52:20 pm »
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?

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 128
  • Software Engineer, Luxion
Re: renderVR(...) and RenderPanoramicFrames issue
« Reply #7 on: March 28, 2016, 05:45:31 am »
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