RayMarcher / while-Block / ShaderMixer
Hello,
for testing purposes, i tried to create a volume sphere out of a cube (used RayMarcher).
But the added picture is all i got.
The problem is, that the shader gets only called once for the 'in' and 'out' point.
But i need it to be called for every step inside the volume.
In one of the dosuments posted inside this forum i found this:
Density Function
At every sample point that the ray marcher takes, it need to run a density function.
But where is this function and how can i manipulate it.
Can the function be changed via ShaderMixer or is it only part of the ShaderBuilder. Some hints?
The shader mixer documentation mentions two variables as well.
ShaderRayMarchPoint and CurrentRayMarchPoint. But where can i find these variables.
Another part of the RenderMan Document:
Marching Through The Volume
Once an “in” and an “out” point are found for the ray, the next step is to break the ray up into small
steps along its length. Every time we make a step down the ray, we run a density function which
tells us how thick the volume is at that point. To get the position of the sample point we could write
something that looks like this.
volume_distance = length(out_point - in_point)
num_of_steps = volume_distance/step_size
step_vector = (out_point - in_point)/num_of_steps
current_position = inpoint
while(current_step < num_of_steps) {
current_position += step_vector
}
I have no problem programming the steps by myself, but i'm missing the while-block.
Has the ShaderMixer something like a while-block?
A constant (cheated) while-block with 100 or 1000 iterations would be enough. I can paste and copy every iteration 100 times, but i don't think, that this would be the best solution ;).