THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/03/2007 at 16:33, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
---------
Hi there!
I'm running into some rather strange things with a channelshader I'm writing. I use tracegeometry() to shoot a ray to calculate the "volume" of the material in the rays direction (basically, the distance to the nex hit on anything). In the color- or luminance channel that works fine, I get a nice "depth map", as I'd expect it. But in the transparency channel some very strange things happen with shadow calculation.
It seems that whatever I use in the tracegeometry-call kills something for the rest of the rendering process of that thread (or at least line) - if that makes any sense. It's a little hard to describe, but depending of whether or not the rendering line crossed a pixel that lies in the shadow of a plane with my shader on, I get different results, even if I don't actually use the result of tracegeometry.
I hope that made any sense at all. ;)
The code is basically copied from the coffee - SDK.
MyChannel::Output(settings,rd,p,n,d,t,texflag,vd)
(some tests if vd exists at all)
var resultp, resultn;
var myray = new(Ray);
myray->p = vd->p; //ray origin
myray->v = vd->v; //...direction
myray->pp0 = myray->pp1 = myray->pp2 = myray->p; // fill mip variables
myray->vv0 = myray->vv1 = myray->vv2 = myray->v; // fill mip variables
myray->ior = 1.0;
var id = vd->TraceGeometry(myray, 10000, 0, &resultp;, &resultn;);
(calculate distance from resultp, etc.)
return (calculated value)
It looks like sometimes the renderer only checks from the point it's just calculating the shadow for up to the polygon with my shader, but then ignores any other stuff between the polygon with my shader and the light source. I'd thought I only have to calculate a transparency value, and the renderer will make the actual ahadow calculation by itself? Or do I really have to manually trace rays up to the light source...?
I'm probably doing/forgetting something really stupid, but what? ;)
Thanks!
-Timm