Example - The Input Node
Intro
The Input Node is the replacement for the Spot Info node from LightWave 2015. That provided access to information regarding the current hit point being evaluated. For surfaces, that basically meant for each pixel of the rendered surface.
As a comparison between the two nodes we can color the surface of two objects with the help of a gradient.
First, let's use the World Position output of the Item Info node to control the gradient. Item info returns the position of the object's pivot point. The whole surface has the same color, depending on the position of the object. World Position is a vector output and the Input for a Gradient is only a scalar, but if you move your object around you should see its whole colour change.


Now, let's use the World Position output of the Input node to control the gradient. This gives us an individual colour for each spot of the surface. Since we are using World Position output, the colour here also changes depending on the position of the object.

Maybe it would be useful to collect a few use cases for the input node on this page. The Node Editor context is in brackets.
1. Surface Side (Surface Editor)
Description: Determines if the intersection hit the front (output = 0) or back (output = 1) of the surface. This allows you to separate the front and back sides of a polygon (surface).
A very simple setup, but often usable. Usually a polygon has only one visible side, from the other it is invisible. If you switch it to double-sided, it will have the same material on both sides. With a simple node setup you can assign two different materials to the front and the back side of the polygons.


2. Bounce (Surface Editor)
Description: The number of bounces the ray has taken to reach this intersection (starts at 1). Two simple light gray metallic cubes reflect each other. Bounce output from the input node controls a gradient. With each bounce the cubes change their colour.

3. Instances (Instance Generator)
Ok, this is not an example for the Surface editor but for the Instance Generator. Like the other node editors, this one also has an input node.
Description: Outputs the base position of the instance. In this scene the output is used to determine if the individual instance is inside another object. The Ray Cast Geometry node is used for this purpose. The gradient outputs black or white.

The idea behind this is that all instances that are not inside the object are scaled to 0 (become invisible). What remains visible are the instances that form the shape of the object. Here they are lego blocks...



To be honest, Razor Crest is not the most suitable object for this purpose. It has parts that are too thin.
4. Lights (Light Properties)
This is a really quick example for the light node editor.
Description: Outputs the distance from the light source. We can use this to colour the light beam.
I used a spot light with Affect Volumetrics turned on (enable Volumetric Scattering in Render Properties, too) In the light Node Editor I used a gradient to color the light depending on the length of the beam.

With the help of a Curve node you can shape the light beam. The Curve node controls the size of an image (a white circle on a black background) and thus the diameter of the light beam. The image is multiplied by the gradient.

I added a Ripples texture.


Addendum to Input Node Example 4:
You can, of course, animate the positions of the keys of the gradient and curve.

For the curve node I used Channel Follower to follow a scalar node (scalar(1)) that also controls the position of the last key of the gradient.

Some notes: Since I wanted to have some noise that would not disturb the outer shape of the flame I added a texture only to the key positions of the gradient (not to the curve node).
Because I wanted stripes instead of specks I use a 2D texture in the Z axis (the direction in which a light looks by default).
With a 3D texture (specks):

With a 2D texture on the z axis (streaks):

Some more notes: You can really do crazy things with this setup. This is what it looks like when you take a square image instead of a circle image and rotate it around the Z axis depending on the Distance.

And here combined with the Curve node.

5. Item ID (Surface Editor)
Description: Outputs the Item ID. The Item ID has encoded the item type too (That's why it's so long and confusing). For what I have in mind, I do not need this additional information. Therefore I simply subtract the unnecessary value and get a numbering of the objects starting with 1.
For example, you can use this numbering to control a gradient.


If you clone the object now, you automatically get different surfaces.

Here are only 5 objects, but of course it works for hundreds.
This could be solved with instances too, but sometimes clones are necessary... :)

6. Geometric Normal, Smooth Normal (Surface Editor)
Description: Outputs the un-interpolated geometric normal (Geometric Normal) and interpolated normal (Smooth Normal) as a Vector.
In this example, I blend between the Smooth Normal and the Geometric Normal. An animated black and white image controls the gradient. This simple example could be solved faster in compositing but this method works in 3D space with animated objects too.


Note: In order to use the Smoothed Normal output you need to check Smoothing in the Surface Editor.


You can also control the blending with a weight map.
7. Ray Type (Surface Editor)
Description: Outputs the ray type (Camera ray, Reflection ray, Refraction ray, Dissolve ray, Shadow ray and Occlusion ray). You can use it to switch between materials depending on the ray type. This means that a surface can change its appearance when you look at it through glass, for example.

Note: The Ray Type Switch node seems to work without Ray Type input (The manual is not clear on this). However, it is still useful. You can also use the Ray Type output to control a gradient and switch almost everything depending on the Ray Type. Of course, you can also use it for less noticeable but useful things like enhancing the brightness of a reflection and so on.

8. Item Position (Nodal Displacement)
Description: Outputs the position of the item. The Input Node gives us the pre animated position of the IK controller so we can modify it using the Ray Cast geometry node.

To walk on uneven terrain.

or, um...

With a Ray Cast Geometry node you can calculate the height of the terrain. Now you just add the Y position of the original animation and you get the new height for the IK controller.

Note: In the original example with the spider, I don't use the Input Node at all yet. The example is older and I don't remember why I didn't use it then. But it shows very well what you can avoid with the help of the input node.
9. Current Position (Nodal Displacement)
Description: Outputs the current deformed vertex position in object coordinates (Vector). You need it when you use the Deform nodes (among others).
Here is a simple setup for the Bend node. We hook Current Position from the Input node into Point Position on Bend deformer. Two null objects control the bend (base and handle).

You can plug the individual Deform nodes one after the other. The output goes into the Point Positions input of the next one. Here is a simple node tree with scale, twist and bend deformer. Additionally a Turbulence texture is added to make it more organic. That's all it takes to create the deformation.


10. Ray Weight (Surface Editor)
Description: Outputs the accumulated weight of the ray represented as a color. Here we use it to create an antialiased mask for a surface. The nativ Surface ID buffer is not antialiased (for good reason), but sometimes you need an antialiased surface mask.
To generate a mask, you must first create a custom buffer (Render Properties > Buffer tab).

In the Surface Editor of the desired surface, plug the Ray Weight output into the new created buffer input.

Done.

11. Fixed Random/ID Index (Instance Generator)
Description: Outputs a random scalar between 0 and 1 (Fixed Random) or the ID of each instance (ID Index). In this example I use it to control the rotation of the instances.

Normally, you can easily create a random rotation of instances. To do this, set a minimum and maximum rotation for the desired axis in the Rotation tab.

However, if you want a random rotation in fixed steps, this does not work here.

A simple node setup does the job. You control a gradient with the Fixed Random output. The gradient has two keys with a value of 0 and 314.159 both set to Step. The unit for the rotation is radian. 314.159 means 180° (actually it is 3.14159 but internally Lightwave reads 100% as 1 ..... :mad:).

I prefer to use an angle node instead because I don't always want to convert to radians.


Of course, you can extend the rotation to a small range around 0° and 180° so that not all cars are completely straight.

Because I control the color of the cars also with the fixed random output all cars of one color are in the same direction. This is not so noticeable here but can be very annoying in other situations. To correct this, I'm adapting the setup a bit. The ID Index output now provides the seed input for a **Random Scalar ** node, which controls the gradient. The Add node gives the possibility to change the seed easily.


Finally, I added a little randomness to the offset (position).

Note: if you want to use the Node Editor to control rotation you have to set the rotation to Uniform in the Rotation tab of the Instance Generator.
Addendum to example 11
You can easily create the usually double rows. If we take a closer look at the instance ID, we see that all even and odd instances form a row. LD Instance IDs shows the instance IDs:

We can use this to offset every second instance by 3.4 meters on the Z axis. A gradient with the value 0 for the first key (position 0 = first instance ID) and a value 340 for the second key (position 1 = second instance ID) is set to repeat. This alternates between moving one car and not moving another.

I also added a random offset so that it is not so regular. This gradient uses the Fixed Random output as input, has two keys and is switched to Linear.


With this method, you can also easily arrange all the parking spaces at an angle.

Enough with cars....

12. World Position and Geometric Normal (Surface Editor)
Description: Outputs the location of the intersection in world coordinates as a vector (World Position). And the un-interpolated geometric normal as a vector (Geometric Normal). In this example, the World Position gives us the spot position and the Geometric Normal gives us the direction for the Ray Trace node.

After breaking a porcelain statue with bullet dynamics we are challenged with the following problem. When rendering materials like porcelain, which absolutely need sub surface scattering you can see the fracture lines shining through before breaking.

You can easily replace the object with an unbroken one for rendering before breaking, but once the collapse has started, this won't work any more. Larger pieces that have not yet broken show the fracture lines, too. This setup is used for the surface of the fracture edges. We want to make it invisible while the object is still whole. For this we use the output of the gradient as a clip map. The idea behind is that for each point, the Ray Trace node looks at how far away the nearest geometry is and thus determines whether the edge is visible to the camera or is still hidden inside the object. If it is still hidden inside the object it will be clipped by the clip map and it cannot cause shadows in the sub surface scattering of the porcelain.
The node setup and the result:


Note: As some may know LightWave has its own solution for this problem: Dynamics Part Info provides an Internal Polygon output that can be plugged into the Clip input of the Surface Node Editor.

So what's the point of another homemade solution? Unfortunately, Dynamics Part Info only works for dynamic parts (as the name implies), which means that if you bake the bullet simulation as an mdd, Dynamics Part Info understandably no longer works.
13. Base Position (Instance Generator)
Description: Outputs the base position of the instance as an Vector. We use this to measure the distance to another object and scale the instanced object to have exactly the length of the distance. This allows you to create instanced connections between two objects that also scale properly in the animation. In this case springs.


Finally, I set the rotation mode of the instances to Target and select the other object as Target Item.



14. Object Position (Surface Editor)
Description: Outputs the location of the intersection in local coordinates as a vector. In this example I use it to colorize the individual tiles (parts) of a mosaic in a single color using an image texture as source. Each tile should be one color.

If you use an image as a color map, the individual tiles of the mosaic will be multicolored. But most real mosaic consists of single colored tiles.


A close up to see what is going on:


Here is the node setup: We add the position of the part center to the position of each spot and use it to move the texture for each spot (think about it before you go to sleep...).

Furthermore, we can use this setup to create a custom roughness value for each tile. Again our node setup controls the position of a texture, this time of a turbulence texture.

Note: I use Part Move from DPKit here to rotate each tile a little bit. This is important for a real look, because in real life the tiles never lie completely flat. By the way, this also applies to windows of a house, especially skyscrapers. They should never be perfectly rotated in order to break up the reflection.

This setup could be great for motion graphics that use parts.
_p.s.: This fresco from Pompeii (Italy) portrays Sappho, a female Greek poet_C