THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/09/2008 at 14:33, xxxxxxxx wrote:
Cinema 4D Version: 10.506
Platform: Windows ;
Language(s) : C++ ;
I'm currently developing a channel shader plugin and have a few questions: First if a shader needs poly / point information for the object to which its applied, how can you translate that information to generators above the object? For instance: you have a cube that has your shader applied to it, and the cube is a child of a HyperNURB which generates a new smoothed surface for the cube. Currently when I apply a HyperNURBS to an object with my shader applied to the object it just renders black. But when I disable the HyperNURBS it renders as expected.
Secondly, I am retrieving the object through VolumeData's ID_to_OBJ function. So I am also receiving the poly ID for the object through this function. The thing that I don't understand is how am I suppose to output a color for each one of the points when a poly consists of 3 or more points and I need to look at each one of the polys points?
This is my first shader, so any info on things to be aware of when writing shaders would be much appreciated.
Thanks in advance,
On 29/09/2008 at 01:41, xxxxxxxx wrote:
You can reach the original objects with GetCacheParent().
As for your second question I don't quite understand what you want to achieve.
On 29/09/2008 at 07:47, xxxxxxxx wrote:
Thanks for the reply Matthias.
Sorry if my second question was a little vague. But, what I want to do is make my shader vertex based and not polygon based. The ID_to_OBJ function passes back the poly id which is hit by the ray tracer. I can then access each of the points contained by this polygon (a,b,c,d) but that would give me four different points to perform my color calculations on. However the Output function only allows one vector output, which makes me have to average the vector between the four different points and return it. If this still doesn't make sense I can post a code snipet.
On 29/09/2008 at 07:57, xxxxxxxx wrote:
What do you want to return in Output()? It only outputs the color of the currently shaded pixel.
On 29/09/2008 at 08:31, xxxxxxxx wrote:
Basically I'm comparing the difference between two of the same points. One being the point with no deformations applied, and the other having deformations applied. I then normalize this vector by a user defined value which will give me a color value. This is the color that I want to output.
But being that I get three other points from the Polygon id, I would then need to output a total of four different colors. However, I am very unfamiliar with how the entire shader portion of the SDK really works.
On 30/09/2008 at 03:55, xxxxxxxx wrote:
Maybe it would be better to use a tag instead of a shader that write the information into a vertexmap. Otherwise check the GetWeights() function of the VolumeData for barycentric coordinates of points.
On 30/09/2008 at 06:54, xxxxxxxx wrote:
Thanks for the info Matthias. I'll look into both of these options to see which works best for what I need.