Page 1 of 1
CAMERA VIEW
Posted: 20 Mar 2018, 10:27
by sribas
Hi guys !
I would like to know if there is a way, to control camera like video games?
For example, actually, if i rotate my camera with Pan, it work well but if i move camera above X,Y or Z Position, it dont move where camera was looking at..
STEP 1 TO 3, i don't want camera to go to red arrow, but green arrow, following Pan rotation (step2)
Thanks
Re: CAMERA VIEW
Posted: 20 Mar 2018, 12:37
by Agalar Ragimov
Hi Sribas!
Very interesting topic.
As an option, I can suggest to rotate the world instead of the camera, if it is possible in your project.
Of course it will not look with Global Light or HDR lighting but works well with some futuristic environment.
Re: CAMERA VIEW
Posted: 20 Mar 2018, 13:10
by sribas
Agalar Ragimov wrote:Hi Sribas!
Very interesting topic.
As an option, I can suggest to rotate the world instead of the camera, if it is possible in your project.
Of course it will not look with Global Light or HDR lighting but works well with some futuristic environment.
Thanks for your reply, but i think there is a way to solve my problem trough camera...
here is my WIP (on X and Z for now) :
BLACK : POSITION OF CAMERA
BLUE : ROTATION ANGLE OF CAMERA (PAN)
GREEN : RATIO OF USE BETWEEN X AND Z POSITIONS(this ratio will make camera to moves on the exact angle given by PAN)
And now i have to found an expression to regulate X and Z positions uses with this 0-100%...
Re: CAMERA VIEW
Posted: 20 Mar 2018, 17:52
by sribas
So, finally, i used my scheme and find a ratio between X and Z to control camera.
Now camera allways follow rotation and position (here i made a video where i control camera with keyboard) :
https://youtu.be/W6OBg14Drr8
the ratio is clipped Ax0 to Ax1 matching with 0-100% angle each 90°.
Re: CAMERA VIEW
Posted: 21 Mar 2018, 06:43
by Agalar Ragimov
sribas wrote:So, finally, i used my scheme and find a ratio between X and Z to control camera.
Now camera allways follow rotation and position (here i made a video where i control camera with keyboard) :
https://youtu.be/W6OBg14Drr8
the ratio is clipped Ax0 to Ax1 matching with 0-100% angle each 90°.
Well done! can yous share .vza file with us?
Thanks
Re: CAMERA VIEW
Posted: 22 Mar 2018, 14:07
by sribas
Agalar Ragimov wrote:sribas wrote:So, finally, i used my scheme and find a ratio between X and Z to control camera.
Now camera allways follow rotation and position (here i made a video where i control camera with keyboard) :
https://youtu.be/W6OBg14Drr8
the ratio is clipped Ax0 to Ax1 matching with 0-100% angle each 90°.
Well done! can yous share .vza file with us?
Thanks
There is still problem with this camera...
I have to fix it :
when i move Pan rotation, then move position, then move Pan rotation and then when i move again position, it jump back to the 0 position.
Re: CAMERA VIEW
Posted: 22 Mar 2018, 16:32
by sribas
I have seen this video where the guy used Unity and Ventuz (
https://www.youtube.com/watch?v=KHf0IkeMiUc )
is it possible to use unity to control ventuz camera only?
Re: CAMERA VIEW
Posted: 25 Mar 2018, 06:31
by Agalar Ragimov
Yes, you can control camera by sending values for the camera via OSC.
Will it behave same as in Unity? I don't think so.
Anyway you have to add new expressions to the values that you will receive from Unity.
Re: CAMERA VIEW
Posted: 26 Mar 2018, 08:37
by sribas
Agalar Ragimov wrote:
Yes, you can control camera by sending values for the camera via OSC.
Will it behave same as in Unity? I don't think so.
Anyway you have to add new expressions to the values that you will receive from Unity.
OSC ? so my problem still the same...
I think i need to go through C# to get a camera controller like games.
Re: CAMERA VIEW
Posted: 26 Mar 2018, 13:16
by stephen
Hey guys,
doing this in C# is a lot easier of course, since you can easily store values across frames in a script node. Thus it is very easy to keep the old Pan and Position of the Camera and just add the changes to it every frame.
But you can achieve this with expressions as well. You can use the Loopbreaker Node to keep a value for a frame and additionally you can bind it to the Expression it came from.
Also I do not know if it is clear, but if you are rotating around the Y Axis you can calculate the forward vector easily using the Rotation, assuming that 0° has a forward vector of (0,0,1):
Forward.X = Sine(Angle), Forward.Z = Cosine(Angle).
I have attached a scene that does something similar like you need using expressions.
Also with this approach you can think of simulating more natural behavior like acceleration/deceleration, etc. You can compensate for frame drops by using a delta time (current time - last update).
For reference the scene contains a second 3D layer doing the same with a script plus adding acceleration behavior to it.
The examples are very rough and I have simplified the problem for your special case but you should get an idea of how to extend it in case you need to. For example you can use the Relative coordinates of the Direct Mouse Input Node to rotate the camera with the mouse instead of the keyboard. And of course doing stuff like acceleration is also possible with expressions - you just need to do some work for it.
Side Note:
Using Unity for such cases is pure overkill - although you could just send the values of View Matrix via OSC and put them together in a Manual Matrix Node. Both the effort for implementing and the performance during runtime are probably not worth calculating just some values.
Anytime you want to calculate data outside Ventuz it is a better idea to write a small command line tool that sends OSC commands.