PDA

View Full Version : A few nodes

Dan_Ritchie
08-03-2014, 01:56 PM
I made a few compound nodes that add functionality to the node editor that you might find useful.

Lerp_Normals (linear interpolate between 2 normals)

Average_Normals (average 2 normals)

Random_Normal (create a random normal)

It gets a bit grainy by nature, but it's interesting that you can do this stuff in the node editor.

123442

djwaterman
08-04-2014, 09:06 PM
Excuse my ignorance, but can you explain what these nodes do exactly, in dummy speak so I can understand?

Dan_Ritchie
08-05-2014, 10:22 AM
A "Normal" is the vector that a surface is facing. A normal usually faces directly outward from a surface. 3D programs use normals to determine how to shade a surface.
The node editor has many nodes that take a normal as a parameter, such as many of the diffuse shaders.

A vector is a set of values,, instead of just one single value like a scalar. In this case, x,y,z. A normal is like you drew a line from 0,0,0 to x,y,z, and that is the direction it is facing.

The Random_Normal compound node creates a random normal... That is, a normal that is not facing in the direction of a surface, but rather just in a random direction. If you shaded a surface completely using random normals, it would look completely flat and noisy, because there's no directionality.

Lerp_Normals let's you blend between 2 normals. You could, for example, blend between a surface normal and a random normal to get a normal that is a little bit random. This could be useful for many things, from raytracing soft shadows, to creating a surface like sand that disperses light more randomly than a completly smooth surface.

Average_Normals just averages 2 normals equally.

Global_Illunination_Lambert_Shader is an example of using random normals.
It raytraces in semi random directions and adds the value of the color at the end of the raytrace to the surface color. It also raytraces a shadow in semi random directions to create an abmient occlusion shading (areas in crevices get dark)

Lambert shading is the shading model that results from taking the dot-product -- (x1*x2+y1*y2+z1*z2) -- of the surface normal, and the light normal (the direction of a distance light for example) It's the shading model that Lightwave uses by default. It should be easy to duplicate by pluggin in a lightinfo direction node and a surface normal node into dot product, and connecting that to the diffuse shader node.

For some reason however, I need to flip the light normal (scale by -1), not sure why that is yet. Will have to look at it more closely.

For a point light (a point light doesn't have a direction like a directional light) you have to create a normal by subtracting the light position from the surfaces world spot position and normalize it (with the normalize node).

Slartibartfast
08-05-2014, 01:19 PM
Can't open zip...

Dan_Ritchie
08-05-2014, 02:20 PM
Hmmm. It might be 7z compression. I've replaced it.