THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/11/2008 at 10:34, xxxxxxxx wrote:
Cinema 4D Version: 10
Platform: Windows ;
Language(s) : C++ ;
I would like to develop a volume shader plugin. I have the example of the SDK and the reference manual, which comes with it. But there is no real manual, what all these parameters mean. Some are quite intuitive, but most are not, at least not to me. Is there some documentation out there, which I haven't seen? Or maybe a book?
Currently I am looking for some explanation on the VolumeData class.
On 08/11/2008 at 15:42, xxxxxxxx wrote:
check out this here: http://www.maxon.net/pages/support/plugincafe_downloads_e.html
On 09/11/2008 at 02:02, xxxxxxxx wrote:
Thanks for the advice. I know the documentation download page. Here a concrete example what I am looking for:
I am trying to build a volumetric shader for a certain kind of fog. As a starting point I have the SDK example ParticleVolume.cpp. I got this to run. To modify this example I would have to do something on the col and trans Vectors in VolumeData. The only information in the documentation about these Vectors, I can find, is
Set the calculated color within CalcSurface() and CalcVolumetric().
Set the calculated transparency within CalcSurface(), CalcTransparency() and CalcVolumetric().
Unfortunately this doesn't tell me anything about how they work and how I should use them.
Maybe there is more information out there?
On 09/11/2008 at 04:41, xxxxxxxx wrote:
You should use them like the doc says.
Overload CalcSurface or any of the other virtual functions and then calculate your shader stuff (use the volumedata (basevolumedata) to get information about the point being sampled, the ray starting point etc. see the docs) and then your shader should output a color value and a transparency value, col and trans respectively.
Simply assign then your output to these two vectors like vd->col = yourfinalcolor;
vd->trans = yourfinaltransparancy;
That´s all about it!
CalcSurface = Surface shader
CalcVolumetric = Volumetric shader
CalcTransparency = Shadow calculations
The rest is up to you. You should have a bit of C++ knowledge, about generally working with virtual functions, vector calculus etc. and the rest is just "learning-by-doing" (either by trial and error or by playign with the SDK examples).
On 09/11/2008 at 09:09, xxxxxxxx wrote:
Katachi, thanks for the answer!
Your answer explained to me, that you get the whole ray from the camera to the surface, I guess the first surface hit. I thought, it would be subdivided already by C4D.
I have assigned my volume shader now to an environment object. Although I have set SHADER_VOLUMETRIC|SHADER_TRANSPARENCY, trans does not seem to have a significant effect on the transparency and how much I see of the objects in the scene. col however seems to influence the color and the transparency. A color of 1 is opaque. Is there an explanation, how exactly these two parameters are taken to calculate the final color of the pixel, when there is transparency.
By the way, if I assign the shader to an object, how does C4D know what is inside and outside the object. For simple objects that is easy. Maybe inside is just inside the bounding box of the object. The camera might also be inside the object. So it does not mean with the first surface hit you are inside. You might be already inside.
Thanks for your help
On 12/11/2008 at 00:49, xxxxxxxx wrote:
Maybe somebody can point me to some book, where the description is close to how it is done in C4d.