TraceColorDirect and reflections
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/05/2006 at 08:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9
Platform: Windows ;
Language(s) : C++ ;---------
Hi all,Well, I' m writing a volumetric shader which needs to make some raytracing calls (basically for computing reflections).
I first tried the TraceColor() method of VolumeData. I can successfully get the color returned by the reflection ray, but there is no recursion:
I'll see the entire scene in the reflection but reflective objects will appear black in the reflection.I think I only get the first recursion color (if there is a half red, half transparent object in the scene, I'll see the red parts normally whereas the transparent parts will appear black).
I then tried the TraceColorDirect(), which seems to be more complex than the TraceColor() one, but the result is the same.
I of course setted the SHADER_RAYTRACING flag, check the max recursion depth in C4D render setting, etc.
Thanks for your help!!!
Big--Ben
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/05/2006 at 08:17, xxxxxxxx wrote:
Hi,
Sorry, I just found the solution on the forum (why didn't I find it before, that's the question...)
It seems that I need to use GetSurfaceData instead of TraceColor(Direct) functions.
If I still have a problem, I''ll reply again, so for now forget about my issue, and I apologiwe for my stupidity!Big--Ben
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/05/2006 at 00:22, xxxxxxxx wrote:
GetSurfaceData() will only return the color, TraceColor forces the hitten object, to fully sample with all effects. With GetSurfaceData you won´t include all effects but only get the local color computed wihtout effects.
So traceColor should work (it works here for reflections). Are you sure you´re not making anything wrong? What are the reflected objects? your own objects? then your plugin is called again.
It seems to me that the transparency is not correctly calculated when needed rather than a recursion problem (unless you have set the ray depth too low in c4d), but on the other hand I don´t know your code nor the intention of your plugin.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/05/2006 at 14:13, xxxxxxxx wrote:
Hi,
Thanks for the info!
I managed to get it to work by doing something like:void ComputeShading(Ray ray, VolumeData vd){ SurfaceIntersection si; vd->TraceColor(ray, hit, &si;) if (si.gid==0) return GetSurfaceData(&cd;, si) if (cd.refl) ComputeShading(cd.rray, vd) if (cd.trans) ComputeShading(cd.tray, vd) }
I don't remember the type of 'cd' (something like Surface Data...), and I simplified the code (I add the computed colors, etc.). I can't access the computer where I have this code for the week end.
From what you said, that's not necessary, but that's the only thing I found that worked.
>So traceColor should work (it works here for >reflections). Are you sure you´re not making anything >wrong? What are the reflected objects? your own objects?
Other C4D objects are not reflected.>then your plugin is called again.
Yes I know that, and I'm 100% sure the error is not because of my own plugin shader being called.I tried with my shader reflecting 2 C4D spheres which have a reflective material. There's also a sky.
When calling the TraceColor() function, the returned color is black, even at points where the ray should hit one sphere, then the 2nd one after a reflection. Dito for the rays that should hit one sphere, then the sky.This is really weird, especially if you're sure that TraceColor should cast the reflected and refracted rays on its own.
Regards,
Big--Ben