Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

CAMERA VIEW

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

Post Reply
sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

CAMERA VIEW

Post by sribas » 20 Mar 2018, 10:27

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)
Image

Thanks

User avatar
Agalar Ragimov
Posts: 33
Joined: 02 May 2017, 11:29
Location: UAE - Dubai

Re: CAMERA VIEW

Post by Agalar Ragimov » 20 Mar 2018, 12:37

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.
*_* - You gotta do what you gotta do (even if you don't like it)

sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

Re: CAMERA VIEW

Post by sribas » 20 Mar 2018, 13:10

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)

Image

And now i have to found an expression to regulate X and Z positions uses with this 0-100%...

sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

Re: CAMERA VIEW

Post by sribas » 20 Mar 2018, 17:52

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°.

User avatar
Agalar Ragimov
Posts: 33
Joined: 02 May 2017, 11:29
Location: UAE - Dubai

Re: CAMERA VIEW

Post by Agalar Ragimov » 21 Mar 2018, 06:43

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
*_* - You gotta do what you gotta do (even if you don't like it)

sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

Re: CAMERA VIEW

Post by sribas » 22 Mar 2018, 14:07

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.

sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

Re: CAMERA VIEW

Post by sribas » 22 Mar 2018, 16:32

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?

User avatar
Agalar Ragimov
Posts: 33
Joined: 02 May 2017, 11:29
Location: UAE - Dubai

Re: CAMERA VIEW

Post by Agalar Ragimov » 25 Mar 2018, 06:31

sribas wrote: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?
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.
*_* - You gotta do what you gotta do (even if you don't like it)

sribas
Posts: 34
Joined: 21 Oct 2016, 09:34

Re: CAMERA VIEW

Post by sribas » 26 Mar 2018, 08:37

Agalar Ragimov wrote:
sribas wrote: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?
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.

stephen
Posts: 74
Joined: 06 Aug 2013, 14:11

Re: CAMERA VIEW

Post by stephen » 26 Mar 2018, 13:16

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.
Attachments
firstpersoncam.vzs
(27.87 KiB) Downloaded 217 times

Post Reply