P Node

P NODE

The P node returns the position of the current pixel in 3D space. That point in space can be used directly as a colour The X location appears as red (left to right), The Y location as green (up/ down), and the Z location as blue (front to back). Left, back and down produce negative numbers, right, front and up produce positive ones. This node will rarely be used by itself - normally it would be plugged into another node to alter it's appearance.


Fig 1: Unmodified P Node

Unmodified, this result isn't much use. Plug the P node directly into the Diffuse node, and you will not get good results. First of all, the results will probably need scaling. Used unmodified, the outputs from this node very quickly reach one. To test this, create a simple cube, plug a P node into the Diffuse node and render. The resulting cube will appear in primary colours. This is because any coordinate above one produces a maximum colour, and any coordinate below zero is black. Poser maps this node directly into RGB colours, so any X coordinate above 1 becomes maximum red. Y maps to green and Z to blue (In practice, this node produces values based on a thousandth of a poser unit). So, the top right hand corner of the cube will be white - all three coordinates are above 1, and so your RGB value becomes 100%, 100%, 100%; or White. The opposite corner will be black. Bear in mind that this node will return results higher than 1. These will not show if used directly as a colour, but will take effect if plugged into another node.


Fig 2: X extracted

To make this node valuable, you will need to modify the results. First, you can pull out any one of the coordinates. As an example, if you want to modify a texture depending on the Y coordinate - i.e. how far off the ground it is, then you need to extract the Y node. To do this, change the X attribute and Z attribute values to 0, leaving the Y attribute at 1. Render this, and your cube will start black at the base, before turning green very quickly. Every pixel more than 0.1 poser units above the ground will be bright green. Figure 2 shows the the X location on our default cube.


Fig 3: X scaled to .02

To scale this down, we have two choices. First, we could change the Value attribute. Lower numbers will scale down the results, spreading them further. Figure three shows the X value set to .02. This time, the red colour fades in gradually.

The same could be done with a maths node. Plug a maths node into the diffuse node and set it to divide. Plug the P node into the Value1 attribute of the Maths node, and set Value2 to 2. If you render now, you will get a greyscale gradient - black at the base, white at the top. The first method leaves the output as a colour. The second turns it to grey.


Fig 4: X pluged into absolute node

Not all node inputs work well with negative inputs. If you need to eliminate negative results, plug the output from the P node into a maths node, and set the maths node to ABS. This will turn all negative results into positive numbers, as seen in Figure 4, where the greyscale gradient is mirrored around the middle of the scene.

While the P node can produce very powerful results, remember that the look of the resulting material will change if you move the object.

P-Node Sample material 1


PoserWorld