PDA

View Full Version : Nodal: bounding box dimensions?



jeric_synergy
06-01-2012, 04:58 PM
Is there a nodal method which would allow me to determine the bounding box size of a given mesh?

A given Part?


Thanks.

Sensei
06-01-2012, 05:09 PM
x * y * z ?

Volume in m3.

jeric_synergy
06-01-2012, 05:14 PM
x * y * z ?

Volume in m3.
I mean, is there a node that returns measurements from the mesh?

Displaced and undisplaced.

Sensei
06-01-2012, 05:18 PM
Such node would be incredible slow..

evenflcw
06-01-2012, 05:39 PM
For sure it is slow in comparison to what you are getting - just a handful of values. But it's not worse than a simpler deformer. Albeit they be slow in LW too.

Then again it is something the system should provide(!), as it is such a fundamental value, to save everyone from fetching/calculating it themselves. Hopefully it's coming soon. If you've checked the bounding boxes in Layout opengl lately, they actually adapt to the displaced mesh (they used to be static). Unfortunately I saw nothing in the 11.0 sdk proving it exposed. I'm not an opengl pro... it couldn't just be done on the video card?

PS. I'm assuming the simplest - axis aligned bounding box (in items local space). Ie what the opengl shows.

Sensei
06-01-2012, 06:25 PM
Wait a minute..

You want to:

- analyze polygon and polygon, and return volume of closed mesh?
e.g. for sphere return (4/3)*PI*R*R*R?

- or return minimum of all vertex positions and maximum of all vertex positions (after max-min= size).

The last one is in

typedef struct st_LWObjectInfo {
[..]

void (*bounds)( LWItemID objectitem, LWDVector min, LWDVector max ); /* added for version 8 */

jeric_synergy
06-01-2012, 06:40 PM
Let me clarify: BOUNDING BOX. Exactly the same thing as when you set the viewing mode to Bounding Box. Returns 2 coordinates: the lower xyz and its diagonal.

Perhaps I shouldn't have thrown in "Parts" (the DPKit type part, not LWM Part). Although that would be extremely handy too.

And, since I noticed, as Evenflcw points out, that bounding boxes are now dynamic, it seemed prudent to ask about undisplaced/undistorted b.box versus displaced ones. Again, a handy value to have, especially if you are making motion-graphic template Scenes.

This would seem to this nonprogrammer to be a very low-level thing. Why would it be slow? There's b.box functions in LScript, for example. Are they particularly slow?

Then again it is something the system should provide(!), as it is such a fundamental value, to save everyone from fetching/calculating it themselves.
Indeed, a very fundamental, simple, and useful value.

I can think of at least 3 values animators might find useful from a BoundingBox node:

unrotated (LWM) box (i.e., unanimated, undisplaced)
p/r/s box in Layout (i.e., as animated, but undisplaced))
displaced box


Specfic uses would include fully generalized motion-graphics templates requiring no input tweeking from the user. Similar to AE Text Animation Templates.

Sensei
06-01-2012, 06:46 PM
Why would it be slow?

You don't want to scan all points of mesh inside of renderer every single pixel, do you?

If scanning won't be done in Evaluate() function (per spot), due to speed, but in NewTime() (per frame), then it's unknown what mesh will return LW - whether it'll be before deformations, or after some deformations, or final..

If such node is will be called from displacement Node Editor- it's called for every vertex. And again complete unknown about state of mesh..
What if node is asked for returning bounding box of item that has not been yet processed by LW and their vertex positions are not ready..

jeric_synergy
06-01-2012, 06:57 PM
So, a function that's a single short line of text in LScript is some horrendous headache in the node system???

Sensei
06-01-2012, 07:40 PM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_18_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_18_x64.zip

Extended Item Info > Box Min/Max/Size

jeric_synergy
06-03-2012, 11:30 AM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_18_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_18_x64.zip

Extended Item Info > Box Min/Max/Size

Thanks Sensei! (And thanks for your patience too.)

Ooooo, so close! :beerchug: The Box Size output seems to output the displaced bounding box size.

For my purposes, it is possible to access the undisplaced bounding Box Size?

click click click
W.I.P.:
Would this work?: Envelope the displacement effect to zero at, say, frame -100, and use that frame to 'read' the Box Size, using the Extended Item Info TIME input to get the value.

Sensei
06-03-2012, 11:33 AM
For my purposes, it is possible to access the undisplaced bounding Box Size?

No..

I am just returning what LWSDK LWObjectInfo->bounds() returns..

No custom calculation, because of issues that I have already described..

In Displacement Node Editor LW is in middle of calculation of displacements, so it's unknown what bounds() will return, if it's already after displacements or not (for this particular item, so for other item it might return something else). What was first egg or chicken?



Would this work?: Envelope the displacement effect to zero at, say, frame -100, and use that frame to 'read' the Box Size, using the Extended Item Info TIME input to get the value.

No way..
bounds() doesn't take frame or time as input, just itemid and outputs min and max vectors, current bounding box (but only reliable from Surface Node Editor).

What you can do:
scan all frames, get bounding box, store somewhere.
So, it'll be (custom) baked.

Sensei
06-03-2012, 11:56 AM
Master handler is receiving events after calculating every step of displacements. So, if somebody will place there code scanning all points, he can get true min-max vectors, then they need to be stored somewhere f.e. envelope. Then run Play in Layout, will bake all values, all frames. Later you can read baked envelope from nodes, from any Node Editor.
Amount of work needed I am pricing 300-500 usd..

jeric_synergy
06-03-2012, 12:07 PM
No way..
bounds() doesn't take frame or time as input, just itemid and outputs min and max vectors.
Just so that I understand your meaning: the Box Size output is always 'dynamic', accurate as to the current frame, and ignores the Time input of the node?

(Rats!)


What you can do:
scan all frames, get bounding box, store somewhere.
So, it'll be (custom) baked.
??? If the Box Size of the item is constantly changing, how does this work? That is, how to know which value is the one to use?

+++
BTW, in case it isn't clear, this question is a follow-on from the "text in a circle (http://forums.newtek.com/showthread.php?t=128504)" thread. I find it inelegant that the user has to measure the text object themselves (sheesh!) when there's a whole damn computer right in front of them. Also, if it were automatic, users could throw any text object in there and it would work. This would be useful in motion-graphic text manipulations, similar to how AE Text Animation Presets can accept any text string and still work.

I'm trying to replace the Scalar node that contains the text object's X-length with a node that will provide that value automagically. Of course, that's the undisplaced X-length, as the object comes fresh from Modeler.

Sensei
06-03-2012, 12:24 PM
Just so that I understand your meaning: the Box Size output is always 'dynamic', accurate as to the current frame, and ignores the Time input of the node?

Time input is of course ignored.. Bounds() function doesn't have such input.



??? If the Box Size of the item is constantly changing, how does this work? That is, how to know which value is the one to use?

That's why I am saying it's unreliable at all, without first baking..

jeric_synergy
06-03-2012, 12:36 PM
Time input is of course ignored.. Bounds() function doesn't have such input.
Well, OK, but the NODE has a Time input.

To someone who didn't write the node, it's not apparent that the Box Size output would be ignoring the Time input. How would the user know?

evenflcw
06-03-2012, 02:37 PM
LWSDK LWObjectInfo->bounds() very good! Missed that one.

jeric_synergy
06-03-2012, 03:36 PM
::beating head against keyboard::
Perhaps Pom's Nodes' STORE function could hold the value, if I could prevent the value from updating somehow.

jeric_synergy
06-04-2012, 08:14 AM
While Sensei is correct (of course) about the displaced bounding box dimensions being a moving target, and introducing race conditions/loops into the nodal displacement evaluation, the actual value I'm concerned with here is always a static value: the bounding box size of the undisplaced mesh, as one gets it directly from Modeler.

Now, whether or not it's accessible is another thing, an SDK issue, but the value itself is static.

So, is it accessible?

Sensei
06-04-2012, 08:30 AM
Post #13

jeric_synergy
06-04-2012, 08:42 AM
Post #13
Beyond my comprehension.

Sensei
06-04-2012, 08:44 AM
Read it- possible, but not as easy as using LWObjectFuncs->Bounds(). A lot additional work needed making "bounding box baking coords plugin"..

jeric_synergy
06-04-2012, 08:53 AM
Read it- possible, but not as easy as using LWObjectFuncs->Bounds(). A lot additional work needed making "bounding box baking coords plugin"..
Sensei, I'm just not a programmer. I don't have the background to understand it.

But if the untouched mesh bounding box is not available to an SDK function (see, I'm probably even saying that wrong), I understand.

Sensei
06-04-2012, 09:27 AM
Such bounding box of original mesh is completely useless for LW.

Even bounding box of displaced mesh has only one usage- while calculating global kd-tree (if LW has two kd-trees- global for scene and local for each object, if it has just one kd-tree for everything then bbox of mesh is not needed at all). I don't see other uses for it in renderer..
But render is/should calculate bbox while making local kd-tree while regular scanning mesh- so no need to prepare it in advance! Actually it's slowing down by couple milliseconds/mesh, because of doing something that's not needed for 99,99999% of cases.

jeric_synergy
06-04-2012, 10:09 AM
Such bounding box of original mesh is completely useless for LW.
How peculiar: I have a use for it.

Any displacement network that relies on knowing the undistorted width, height, and depth of a mesh could use this info. To craft generalized displacement networks that work with any arbitrary object, this would be handy info to have access to. Otherwise the user is forced into pointless donkey-work of measuring the object and entering the values by hand, when there's an advanced computer sitting right in front of him.

For one thing, this would help address the advantage C4D currently has over LightWave in the text manipulation arena.

The renderer is not everything.

Sensei
06-04-2012, 10:16 AM
You can place Nulls on every corner, and parent to base mesh. Then when mesh is transformed by move, rotate, scale, Nulls are still in the corners. Null 1 Position - Null 2 Position = Size.

jeric_synergy
06-04-2012, 10:59 AM
You can place Nulls on every corner, and parent to base mesh. Then when mesh is transformed by move, rotate, scale, Nulls are still in the corners. Null 1 Position - Null 2 Position = Size.
Okay, thank you for that technique. :beerchug:

It's still not "drop in a new object and it just works", ie not generalizable, so I'm going to make a Feature Request to NewTek to:


a) create such a node and
b) add such a function to the SDK.

Sensei
06-04-2012, 11:21 AM
if there is node returning position of some point at index XX, then in any Node Editor you can take position of that point. Math > Vector > Distance will return distance between pair of such points.

evenflcw
06-04-2012, 07:17 PM
Jeric, your forum message box is full so I cant message you back. Email me your email instead, the forum message system is stupid. You'll find mine in the link in the signature below.

evenflcw
06-05-2012, 01:53 AM
Ahem... what is wrong with me. I meant it's limited, not stupid. It is very good for getting in touch with anyone in the forum. But it requires constant maintenance if you use it for longer conversations. Better than nothing though.

AbstractTech3D
06-05-2012, 04:54 AM
Just so that I understand your meaning: the Box Size output is always 'dynamic', accurate as to the current frame, and ignores the Time input of the node?

(Rats!)

??? If the Box Size of the item is constantly changing, how does this work? That is, how to know which value is the one to use?

+++
BTW, in case it isn't clear, this question is a follow-on from the "text in a circle (http://forums.newtek.com/showthread.php?t=128504)" thread. I find it inelegant that the user has to measure the text object themselves (sheesh!) when there's a whole damn computer right in front of them. Also, if it were automatic, users could throw any text object in there and it would work. This would be useful in motion-graphic text manipulations, similar to how AE Text Animation Presets can accept any text string and still work.

I'm trying to replace the Scalar node that contains the text object's X-length with a node that will provide that value automagically. Of course, that's the undisplaced X-length, as the object comes fresh from Modeler.

I did wonder if that was why you were trying to do this!

jeric_synergy
06-05-2012, 09:29 AM
Again, not a programmer, but:

Wouldn't knowing the bbox information be handy when constructing a network that's designed to clone objects?

Or instance objects?

jeric_synergy
06-05-2012, 09:32 AM
Ahem... what is wrong with me. I meant it's limited, not stupid. It is very good for getting in touch with anyone in the forum. But it requires constant maintenance if you use it for longer conversations. Better than nothing though.
I think 'stupid' is fair.

Not only does it have a ridiculously low limit to the number of messages (hey NewTek, here's $2.73, please double that limit for everybody), but you cannot attach files to messages. That's pretty dumb right there.