A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
Camera Frustrum visualization
Posted: 23 January 2017 03:33 PM   [ Ignore ]  
Total Posts:  434
Joined  2012-01-05

Hello

I’m interested in trying to transform a camera frustrum into renderable geometry.  I can see this is as being an Xpresso setup, wondering if anybody has hints as to how to approach this.

Thanks!

Profile
 
 
Posted: 23 January 2017 04:59 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Alex,

Is that what you are looking for?

Scene File:
https://www.amazon.com/clouddrive/share/r85HU0ZRXZu9CBqPogEhMNtdCwJjQ82NsakeQ7JacbK?ref_=cd_ph_share_link_copy

It follows distance [Focus Distance] and Focal length [hor/vert field of view]
Let me know if there are any questions. I did not integrate any shift [offset] option.

All the best


P.S.: Instead of the :Atom Array, you can use any options with MoGraph of course to create something more to your liking perhaps.

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 23 January 2017 08:25 PM   [ Ignore ]   [ # 2 ]  
Total Posts:  434
Joined  2012-01-05

Exactly!  Thanks Sassi!

Would you mind explaining the Xpresso network a little bit?

Thanks!

Profile
 
 
Posted: 23 January 2017 08:56 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Perfect, thanks for the feedback, Alex.

To get this going we need three main values:

The Distance, then the Horizontal and the Vertical field of view. Note that the H and V values are in the same ratio as the render-settings.

Those values, plus the location of the camera will give us all we need. As we need five points to describe the pyramid shape. The tip is given already by the camera position.

Which leaves us to determine the four base points.

The main math:

Working with Tangent requires a 90ยบ angle in the triangle, hence the dived by two (or times 0.5) in the Formula. [Always check if radiance or degree is needed!]
In the Formula Node the Tangent Formula is written so the X/2 or Y/2 is expressed as result based on “tan (filed of view/2) times distance”

The points of the base share all the same distance in Z, the Focus Distance [which will, BTW, also work if a focus object is used]
So having divided the field of view by 0.5—leaves us with values that describes the points of the base the X and Y values.

Since the parent of the Pyramid is the camera, it is also its main origin system (considering the objects between camera and Pyramid have not been moved), in this way the focus point is X and Y = zero

To get the four points we need +X+Y, +X-Y, -X+Y, -X-Y Which is always based on the same X or Y values, but in case of a negative value, the Math node multiplies it by -1.

Feeding the Values

The four base points of the pyramid are point number 0-3 (while #4 is the tip), all these four X and Y values are feed into the Point node, while combining them before with the aid of the Real2Vector Nodes. Again Z comes from the camera Focus Distance. The Point Node needs to be set to Local in the Attribute Manager, all four can be set at once while all four are selected.

XPresso Editor

In the XPresso Manager on the left, I sorted the flow accordingly.
The flow of my set up typically works from the left (what I have) to the middle (what needs to be processed) to the right (what I got and counts as result)

XPresso Tag

Typically I set the XPresso Tag to [Attribute Manager] Camera Dependent and to an appropriate Priority if needed.

A screen shot:
https://www.amazon.com/clouddrive/share/FNgMkzssp2yWsGGzgoZNym3jrzCeoXlyH71M3zkd94B?ref_=cd_ph_share_link_copy
______

I hope that helps, let me know if there is anything else

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 23 January 2017 08:59 PM   [ Ignore ]   [ # 4 ]  
Total Posts:  434
Joined  2012-01-05

Fantastic, thanks Sassi.
I wanted to add film offset to this, but how would I convert that to a usable value since it is expressed in percentage?

Profile
 
 
Posted: 23 January 2017 09:17 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Alex, to use the percentage of them, is done by just multiply the values of the Formula and then add them to the results. but, since we got only “half” of the vvalues from the formula we need to multiply this by two.

I have highlighted all the new nodes needed to do that in the screenshot. Please note that the four Add Nodes are set to Vector.

All the best

Screenshot
https://www.amazon.com/clouddrive/share/g4hQNEiSQMSlkikIX1fz81F5Loj88mX72i1759NIfbG?ref_=cd_ph_share_link_copy

Scene File
https://www.amazon.com/clouddrive/share/kl2z8zzxOWBhZgPjAQazBTKSSYbrGTlsLzICTk7aGWX?ref_=cd_ph_share_link_copy

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 23 January 2017 09:19 PM   [ Ignore ]   [ # 6 ]  
Total Posts:  434
Joined  2012-01-05

This is fantastic, thank you so much Sassi.

Profile
 
 
Posted: 23 January 2017 09:20 PM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

You’re very welcome, Alex.

My best wishes for the project

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile