Notifications
Clear all

[Closed] render active viewport distance

hi,everyone.
i need some help,

How to obtain the position of the “current render viewport ” , and use this position to get the distance what is ” geometry.max ” in visible range
Whether or not the camera view。

i mean in current render viewport. Whether the camera view or perspective or orthographic viewport.

In fact, I want to use a very clever way to to get this distance, to match ZDepth.max

thankyou verymuchu!

3 Replies

don’t know what you mean by ‘viewport distance’ – do you mean current camera?
here is a small script whereby you canculate the distance between any two scene nodes, including cameras and lights or any objects but I think you need to reword your question more carefully, I don’t really have a clue what you want:


rollout distcalc "Distance " width:162 height:212
(
 pickbutton a " First Object " pos:[38,35] width:82 height:31
 pickbutton b "Second Object" pos:[39,84] enabled:false width:82 height:31
 
 button calc "Distance" pos:[42,130] width:78 height:31
 on a picked obj do
 (
 
  cam = getnodebyname obj.name
  a.text = obj.name
   b.enabled = true;
   )
 on b picked obj do
 (
 
  cam2 = getnodebyname obj.name
  b.text = obj.name
 
   local dist = distance cam.pos cam2.pos 
 
  calc.text = dist as string
   )
 
 
 
)
createdialog  distcalc 162 212
 
 
 

– Unknown property: “pos” in undefined

i mean in current render viewport. Whether the camera view or perspective or orthographic viewport.

In fact, I want to use a very clever way to to get this distance, to match ZDepth.max

haha…
thank you verymuch.

again, not sure what you’re talking about. If you want to know the distance between the rendering camera and an object, my script will do that and I don’t understand how you got the undefined error, unless you picked something that was not an actual scene node.