View Full Version : rsl: adding colors during rayMarching...

10 October 2006, 09:47 PM
I am kinda stumped with my on-going ray marching shader and I have been given this lots of tries and finally decided to post here...
The problem I am having is that when I am adding the colors I get the areas that have high densities goto white.
The shadeop gets the density amount from the cache file and I retrive the color information and do a lookup using the color spline.
So for every step:
a) get density from shadeop
b) get color using density using spline function (colorDens)
c) get opacity using density using spline function (partDens)
d) determine a float density to accumulate...
e) determine opacity value
f) and finally color

volume_step is my raymarching steps...

image A code:
densVal = partDens*volume_step;
Ci += colorDens;
Ci *= Oi;
Oi += (1-Oi)*densVal;

image B code:
densVal = partDens*volume_step;
Ci += colorDens;
Ci *= Oi*colorDens;
Oi += (1-Oi)*densVal;

As you can see I am getting these hot white areas and why not! my code is adding the colors that if done too many times will end up in white... And yes multiplying the opacity with the current color doesnt do anything but makes it flat, and I am loosing detail in the process. This is something that I haven't got over and it would really help if someone here knew what I am doing wrong.

Thanks in advance.

10 October 2006, 11:05 PM
I don't know much about code, but isn't it a divide process that you want here ?

10 October 2006, 06:54 PM
so after going back and hitting the advanced renderman book I realized I completely forgot to take into consideration of the exponentially decaying of light (exp() ). When I used that it works all fine.

CGTalk Moderation
10 October 2006, 06:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.