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