Hello all,

I am trying to use raymarching, thus I've written an interior volume shader which basically should return a value equal to the length of the ray going through object (I understand Pixie implements interior volume shader, right ?).

Unfortunately, I only get a completely black image. Could anyone point my mistake ?

Below, the shader script and the RIB file. BTW, I use Pixie 2.2.5.

Thanks

PhilB

**** My shader ****

volume thickness ()

{

point frontP = P - I;

point currP = frontP;

float totalDist = length(I);

float accumulatedValue = 0;

float stepSize=0.1;

float currDist=0;

while(currDist <= totalDist)

{

// Notice that I/totalDist is the normalized vector I

// multiplying by a float (currDist) is a vector aligned with I

currP = frontP + (currDist/totalDist) * I;

accumulatedValue += stepSize;

// Prepare for the next iteration of the loop

currDist += stepSize;

}

// Modify the output colors.

Ci = accumulatedValue;

}

**** My RIB file calling the above shader ****

Display "sphere3.tif" "framebuffer" "rgb"

Projection "perspective" "fov"

Translate 0 0 30

WorldBegin

Atmosphere "thickness"

Opacity 0.1 0.1 0.5

Sphere 10 -10 10 360

WorldEnd