View Single Post
  #1  
Old 06-09-2017, 07:31 AM
Geoffrey Megard Geoffrey Megard is offline
Member
 
Join Date: Jun 2017
Posts: 2
Projecting two cameras on one viewport and alternative solutions

Hello,

I would like to make something similar to this in Vizard:
https://vimeo.com/23607848

Here are the solutions that I thought of and did not succeed to implement with Vizard:

Solution 1:
I wanted to create
- an orthographic camera which is fixed and looks at the array of disks (and the disks only render to that camera)
- a perspective camera which navigates in a 3d scene (and that 3d scene would only render to that camera)
- a window/viewport that shows what both cameras render (with the orthographic camera layer on top)

That is basically the set up I was using when using openGL to program video games where I had to render a GUI on top of a 3D scene.

Unfortunately, I did not find how to make two camera projecting to the same viewport/window in Vizard.


Solution 2:
I tried to render the camera 1 on a plane and then attach the plane to camera 2.
However, doing that the plane is opaque where there is no disks [i.e. it renders the background color], so that we don't see through it.
Thus to make this solution works I would need the background color to be transparent.

Solution 3:
I tried to use only one perspective camera and attached the group of disks to it, but I don't find an easy way for the disk to always face and stay in front of the camera.

I tried to the functions:
<node3d>.link(): then the disks follows the change in position of the camera but they don' t stay in front of the camera if it rotates.
<node3d>.billboard(): then the disks follows the change in rotation of the camera but they don' t follow the change in position, and they won' t stay in front of the camera when it roatates.
<node3d>.setParent(viz.ORTHO): everything is ok after I changed the size of the disks into pixels, except that the non-flickering disks become white while the flickering disk does not follow the good color sequence.
<node3d>.setParent(viz.MainView): I just don't see where are the disks, they seems to be invisible. I tried to place them at every position axis around the camera (e.g. setPosition([1, 0, 0]), setPosition([-1, 0, 0]), and I just cannot see them.

Do you think there is an easy solution to my problem?

I attached the code that I am using to set this up. The main file is:
playgrounds/playground_attached.py

Thank you very much for your help,

--
Geoffrey Megardon
Attached Files
File Type: zip tovizardforum.zip (7.6 KB, 942 views)
Reply With Quote