PDA

View Full Version : How to use a reference object as curve node's input?



mewnow
02-28-2019, 06:50 AM
I mean I don't need the default world x coordinate as input, but a null's local x coordinate as input, just like the pic shows, I want the pink color starts at null's x=2.5m:
144253

Here is my simple scene file: 144254

Thanks for help.

raw-m
02-28-2019, 07:52 AM
You could try and add an expression via the envelope of that key. Personally I’d use a gradient instead, although it’s harder to visualise than the Curve.

squarewulf
02-28-2019, 07:55 AM
Have you tried using a gradient instead?

gar26lw
02-28-2019, 08:09 AM
yeah gradient with distance to object and pick null. or just a gradient in x with step value.

i have to say i prefer the curve for clarity.

mewnow
02-28-2019, 08:39 AM
I think you all misunderstand my question, its a matter of orientation, the null's local x axe is not point to the world x axe, maybe my English is not good enough to express it clearly, please download the scene file for a better understand my meaning. Thanks

RebelHill
02-28-2019, 09:06 AM
Its because the Xcoord input you're choosing is the box mesh's local X co-ord, in its own object space. Youll want to use a bit of trig to get the intersection point in object space with the nulls local space at the required value.

MonroePoteet
02-28-2019, 10:14 AM
If I understand what you're trying to accomplish, you might be able to use the Null's X Position to control a Gradient's Key (2) Position:

144258 144259

144260 144261

MOV file: 144262

Here's the node setup:

144255

A sample LW2015 scene is attached. The Box object has a single Surface whose Color is controlled by a Gradient node. The range on the Gradient is the minimum and maximum range the Null may be moved. In the sample scene I used -2.5m and +2.5m. Key 2 is set to Step mode, so it's a hard line between the magenta and green colors. Note that the Show Input button is checked on for Key 2 so its Value, Position and Alpha inputs are shown on the Gradient node.

There is an Item Info node which is setup to get the information about ColorControlNull. The Position output is passed into a Vector to Scalar node set to the X Channel. Note that the Position output is the Null's local coordinates relative to its parent...the World Position output is the global position with all the Null's parent tree positions added in. The X Channel is then input to the Key(2) Position, causing the key position to slide between -2.5 and 2.5 based upon the Null's X position.

Hope it works for you!
mTp

mewnow
02-28-2019, 06:51 PM
I think RebelHill got it. But how to do it?
Thanks MonroePoteet's scene file, but it's not what I want. Your gradient still use the default "X Coordinate" as input which is a world coordinate, but I want to use a null's local x coordinate as input, whatever a curve node or a gradient node. I attach a new picture to show what I mean. As you can see, I have pink color input at 2.5m in default x coordinate, but the pink color do not start at null's 2.5m in loacl x axis:
144273

gar26lw
02-28-2019, 08:28 PM
make the null a child of the object you want the gradient on?

or make two nulls and have the colours be dictated by word space between the two. have them as children of the object.

or what about you make a curve and have the gradient a function of the distance along it or a motion path?

or use a uv map to dicatate the gradient, with 0-1 in U = the gradient start and end.
make that object be 1 and scale it x2.5 so its now at 2.5m or whatever unit you want?

shove a camera as a child of the object and front project an image into the side. paint where you want the colours. use the camera view in modeller to help.

make a procedural checker with a grid size of the end value you want and set the link and green colours, set it to use the position of the object as reference. scale the other axis to a very large number. x being once you want, y anz z very large.

make two objects. one green, one pink. parent one to the other, have one be slightly larger thann the other, turn off cast shadows. have both be 1 unit. scale each in x to the desired amount.

any use?

MonroePoteet
02-28-2019, 11:29 PM
Well, the setup I posted seems to do what your second image requires:

144275 144276

MOV file: 144274

mTp

mewnow
03-01-2019, 12:35 AM
mTp:
I am not sure, maybe your still model is align to the world coordinate? Then you animate the box model to get the look?
My still model(not this simple one) do not align to the world coordinate, that's why I need a reference object as a input.
Would you please redo this with my attached scene file but do not modify my model?
Thanks for help

raw-m
03-01-2019, 01:02 AM
Ah, I see. Someone mentioned uvs. Try Weight Outwards in Modeler to create a uv (you can specify an end weight value if you want to marry up end value with depth) and use that as an input.

mewnow
03-01-2019, 07:23 AM
I build up this node setup, so far so good to me.
144278

Any advice is appreciated.

RebelHill
03-01-2019, 08:40 AM
Yep, thats about it... dont forget though that the reference point is still in the mesh's object space, so I suspect that if u tilt your light down to illuminate the top, youll find the line going across in line with the axis alignment, and not forming a right angle in terms of the mesh alignment itself. If you want to do that, youll have to account for the angle that the mesh is turned in modeller, and throw that into the mix.

MonroePoteet
03-01-2019, 09:18 AM
Yes, sorry I misunderstood the scenario.

mTp

MonroePoteet
03-01-2019, 10:26 AM
Again, assuming I understand what you're trying to do, I think you're going to have to rotate the Box's Object Spot positions to be oriented along the X axis as if the Box was *not* "pre-rotated" in Modeler. Because you pre-rotated the box geometry in Modeler, the Object's local coordinates are still aligned with the X,Y,Z axes in Modeler and must be "rotated back" as if the geometry wasn't pre-rotated in Modeler.

In other words, I *THINK* you want to have the color change from green to magenta with a perpendicular line across the Box:

144285

If this is what you want, you need to take each Object Spot on the box's geometry (a "spot" being a single place on the surface to be rendered), rotate it to be aligned with the X axis based upon the carefully rotated Null (1), and then use that position's X coordinate as input into the Gradient.

The Wikipedia article on vector rotation here:

https://en.wikipedia.org/wiki/Rotation_matrix

gives the 2-dimensional rotation equations as:

x' = x*cos(angle) - y*sin(angle)
y' = x*sin(angle) + y*cos(angle)

In this case, it will be the X and Z coordinates rather than the X and Y coordinates that need to be rotated because of LW's coordinate system, and the <angle> is the Heading of the carefully rotated Null (1). The nodal implementation of these equations is:

144288

by extracting the X,Y,Z components of the Object Spot and the cos() and sin() of the Null(1) Heading rotation, doing the appropriate multiplication, addition and subtractions, forming a resulting vector, and then extracting the X component. Yes, I realize I only had to calculate the X component and didn't need to pass through the Y component, but this is a general rotation node network so if you wanted to use some other Position component, it's just changing the final Vector to Scalar channel.

Your scene modified as described is attached. As well, I moved the Ruler modifier onto the Null (1) rather than Null (2) so the ruler is relative to the box object, and then moved the Null (2) to 2.5 in X, and used the Null (2) Position's X channel as the Gradient's Key (2) position as before.

Hope it's what you're looking for!
mTp

MonroePoteet
03-01-2019, 11:12 AM
I should note that DP Kit provides a LW2015 Rotate node to do the same job, available here:

http://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html

which makes the node network MUCH simpler: :)

144290

Be sure to support Denis financially if you can!

mTp

mewnow
03-02-2019, 12:12 AM
Thank you very much, mTp. Really huge help.

For "localX_RotateSpotToXAxis" solution, yes, a lot of nodes to use, I think just did a little part(x*cos(angle)) by myself, as Rebel metioned, it has some problems, your node setup works perfectly. Big thanks.

For DP solution, as you said, it's much simpler. Sure, I will support Denis as much as I can.

I think if "curve" or "gradient" node has options like other procedural texture node, this kind of work will become much pleasure:
144291144292

gar26lw
03-02-2019, 01:02 AM
you know, i see a tool that creates a null, with a box shape for example and links it up to the selected node(s) to drive the scale, pos, rotation etc as being useful. like modos texture guides

MonroePoteet
03-02-2019, 09:07 AM
Thank you very much, mTp. Really huge help.

For "localX_RotateSpotToXAxis" solution, yes, a lot of nodes to use, I think just did a little part(x*cos(angle)) by myself, as Rebel metioned, it has some problems, your node setup works perfectly. Big thanks.

For DP solution, as you said, it's much simpler. Sure, I will support Denis as much as I can.

I think if "curve" or "gradient" node has options like other procedural texture node, this kind of work will become much pleasure:
144291144292

Glad to help! The DP Kit nodes are absolutely invaluable for nodal setups in LW, IMO.

RE: the "Reference Object" option, I completely agree. For me, the default choices for Input for the Gradient node (and the Curve node) is very disappointing. Distance to Object, Reference Object, Weight Maps, Camera Incidence etc. are all removed, requiring a nodal setup to achieve:

144299

Makes it easy for LWDG, but harder for the users! IMO, providing "convenience" layers for the users (e.g. a rich Input list for these nodes) should be a priority for high-efficiency productive pipelines.

For example, to me it is very disappointing that I have to CONSTANTLY add three (3) separate Vector to Scalar nodes to get the X,Y and Z (or H,P and B) components of a Position, Rotation, Scale or other 3D vector. Clearly, the internal nodal code exists and it would be (reasonably) easy to produce a Vec2xyz node or some such, but user convenience doesn't seem to be a priority for LWDG.

mTp

gar26lw
03-02-2019, 11:10 AM
totally agree mTp.

LW should be simple and fast to use with complexity and control when you need it.

itís been mentioned elsewhere that 2018-19 is a step back in that regard compared to previous releases.