   Ray Marching Volume Question
  Hi guys,I got my ray marcher up and running and it works alright. The thing I don''t understand is how to combine the colors and opacities along each step of the ray.In my book it say "attenuation varies with resolution" and then "integrate front to back" but the code is in RenderMan and it uses a variable that came from something built-in (he doesn''t even explain what it is) but I think it''s the opacity of the color returned from the density-to-color mapping function for that sample.I''m doing this on my own with no API.Anyone know about volume rendering that can help me ?Thanks. 
  Ken Perlin''s paper "An image synthesizer" has some really useful source code, but I can''t find a copy online unless you have an acm digital library account.Basically the math is identical to alpha blending, only you usually stop sampling once you are below 1/255 opacity, since it will no longer have any effect.You sometimes will see the formula as either differential equation or in a form with exponentials and integrals. They are all equivalent, but the alpha blending one I think is the most straightforward.    "Math is hard" -Barbie ;  >>Anyone know about volume rendering that can help me ?Well, the subject is vast, so a complete description is a bit impossible here. I personally liked the chapter on participating media in Henrik Wann Jensen''s book on photon mapping.But if you have a small, specific subproblem or a question on a detail, don''t hesitate to ask. - Mikko Kauppila ;  Thanks guys,I figured out now to combine the colors with alpha values, you have to interpolate; in the code he uses color.alpha and then c[3] which is the same as c.alpha so I was confused.Here is something I don''t understand:when you sample values from the 3D density function you have to attenuate them, which is reasonable since if you take 50 samples you might get a nice color value but if you take 200 samples from the same field the opacity will hit 1.0.here is how he does it:sampleColor.alpha = 1.0 - pow(1.0 - smapleColor.alpha, 100.0 * stepsize);then he says he uses the value 100.0 so the density function can return values from 0.0...1.0it works pretty well, I even set the step size to 0.01 so I could eliminate the whole thing and it looked nice. I wish I knew a little more about the attenuation part though.