PDA

View Full Version : z buffer with nodes andd gradients?


zardoz
01-28-2007, 09:06 AM
Hi everyone.

I started recently looking into the node system...and I tried to create a zbuffer render with nodes. What I did was this: I have an object (a ball for example) and I placed a null in the back of the ball and another in the front of the ball. Now I want to create a gradient from black to white between these nulls...

How do you do this with nodes? I want it to respect only the Z axis (I don't want a circular gradient) but in the manual I can't understand very well what I can do with the spot info and object info nodes...
I had lots of math and geometry in college (I have a degree in Biochemistry and in my college they forgot the 'bio' and only teach us math, physics and chemistry...) but some of the nodes are hard to understand what they do in Lightwave.

Tx for helping.

Luís

dpont
01-28-2007, 09:34 AM
With "Item Info" you can get both front & back Null world position,
With "Spot Info" you get the World Spot ( world position of the evaluated
spot)
then go to math vector to fill a distance node.
If you want a normalized distance (for 0.0-1.0 gray),
divide result by distance between Nulls.

Denis.

dpont
01-28-2007, 09:42 AM
Or calculate Camera (Item Info) to Spot distance,
substract Camera to Front Null...

Denis.

zardoz
01-28-2007, 05:28 PM
hmmm...tx for answering Denis, but I tried and I couldn't do it. Maybe because I don't yet understand the function of spot info...what is that it evaluates? In 3d space what it does?
Maybe if you could explain this and add a screenshot of these nodes it would be easier for me.

I can do it easily with the normal gradient layer, but I am using this as an excuse to learn the methods of the node system.

tx.

Luís

Medi8or
01-28-2007, 06:52 PM
Spot Info gives information about the spot. Spot is the location on the surface that is currently being evaluated. That is if you look at the rendered picture of your ball, each location on the ball was spot at the time that pixel in the image was rendered. (or something like that.. )

Object Spot gives location of spot in object coordinates, while World Spot gives the location in world coordinates.

zardoz
01-29-2007, 07:13 AM
thanks for the tips, guys.

I tried 2 different approaches for this...the simple one where I copy what I would do with the layer system. I simply created two nulls one in front of the object and another in the back of the object and copied the z coordinate to the keys positions in the gradient and fed this to the luminosity. I also added a scalar node to feed 0.0 to the difuse.
see the attachment.

zardoz
01-29-2007, 07:20 AM
the other approach was a bit more comlicated for me but it gives me what I wanted, though I didn't used the spot info like denis suggested.
I used the item info to feed the nulls position (the nulls are parented to the object so I used the position instead of the world position), then I used a dot product for both of them where I use the vector (0,0,1) to zero the x and y components of the null's position and get only the z. Then feed this into the position of the keys in the gradient. And it works. In the other attachment I show the results.

I'd love to see how it would be done with the spot info node.

tx for reading

Luís

dpont
01-29-2007, 07:48 AM
If you want a zdepth gradient between 2m & 4m:
41547

Denis.