Shader plugin & object
-
Hi,
Is it possible to create a shader plugin (ShaderData) that modify the object structure ? I saw an example like this using a different software few years ago but I can’t remember where…
For instance, if I have a cube and apply a material using this shader it will change all quad polygons into triangles only during the render (... + maybe inside the viewport if possible)Thank you
-
In computer science, there are vertex shaders, geometry shaders, and tesselation shaders, which change an object's vertices or the object's geometry.
Cinema 4D's
ShaderData
is only a pixel (or fragment) shader. AFAIK, there are no vertex, geometry, or tesselation shaders in C4D. -
Thank you @PluginStudent for your answer ! very instructive
showing a kind of real-time boolean shader (Geo clip shader)
I found this
So, since C4D allow only pixel/fragment shaders, I wonder how this one was done ? -
Hi,
this was done in Arnold, so Cinema has not much to do with it, but it would also be possible to some degree in Cinema.
As you can see in the video, this is a render time only effect, no geometry is being modified. The way I would go about implementing this would be to intersection test the point you are currently rendering with whatever geometry you want to use as your cutting surface and either let the ray pass or not pass depending on the outcome.
In Cinema you could access that initial point to intersection test by getting the ray-intersection point in object space via the passed
VolumeData
of the ray your shader is currently being polled for. If you want your cutting geometry to be an arbitrary polygon mesh you will have to raycast between our point and that mesh. A much easier solution is to just allow a handful of SDF primitives as cutting geometry. You could then just pass your intersection point into that SDF, if it is smaller than zero, you would let the ray pass, if not, you would not. The passing or not part could be achieved by putting the shader in the alpha channel and let it return black and white as its output.But this would not let you generate the intersection surfaces of the intersected mesh (for meshes that have some kind of "shell" geometry with a thickness). While computing these intersection surfaces is not that hard, especially in the for SDF case, integrating the results with a raytracer you only have 3rd party access to, is not. A relatively easy solution would be to return a solid color for these surfaces instead of trying to emulate/redirect the shading of these points. But this would still require more than a simple shader in the alpha channel in Cinema.
Cheers,
zipit -
thank you very much @zipit !! your answer gave me a lot of ideas
-
hi,
I've been looking at one possible solution but found nothing yet. As said before, you can't do that in our shader system.
Creating your own material could help more, but you only have the displace function that only displace the points and do not change the object.
Creating the subdivision is not possible neither.I will check if i find something but that could take time.
Cheers,
Manuel -
I have time and you have my attention sir Manuel! I'm looking forward for this
I think adding this feature to C4D will be a good improvement... at least, for those who are interested in.Thank you again