I have a rigged model of a 3D man that I'm animating to look like it's drawing on a whiteboard. I want the model to render as a semi-transparent black silhouette. This can be easily done in multiple ways if I render the animation in two passes, one for the whiteboard setup and one for the man by himself.
I'm trying to figure out if it's possible to do this in one pass. The description of the Flat shader describes it as "A simple color shader node which just allows a color and opacity value to be combined, with no other effects. I can set the color to black, but there's no parameter to make it semi-opaque.
I've included an image showing the look I'm going for.
Thanks.
Shawn Marshall
You'd need to write your own custom shader for that. The transparency should only get evaluated at the first ray hit with the object. You can do this kind of stuff using the message passing API.
It'll be quicker, easier and more controllable to render this out in 2 layers and do the effect in post
Yeah, I won't be writing any custom shaders. Doing it in two passes is no big deal, just wondering whether I was missing something.
Thanks for the reply.
Shawn
You do not need custom shader to do this, though it might be more efficient. Simply get the opacity from a lambert shader with weight set to zero, opacity to black. Then mix this with a flat shader and control opacity with the mix amount. See below (note though that opacity should be set to black).
Be sure to unselect "opaque" in your arnold settings, as you would for glass.
I'm pretty sure you could also just use transmission with thin geometry and no specular if you're using the latest Arnold. If you do not need transmission to accumulate in alpha, then you could do it in earlier versions, also.
Sometimes code is cheaper than talk 🙂
shader flat_transp ( color transp = 0.5, output closure color result = 0 ) { result = transp*transparent(); }
Save it in a flat_transp.osl file and drop it into a folder where other shaders are loaded.
There is just a single param for transp as opposed to ie. flatcolor + opacity because of the way OSL deals with closures and colors.. closures can't be added over simple colors .. and 'flat' constant colors are actually 'emissive' closures .. and if not guarded against other ray evals they of course will illum the scene.. so here to keep it simple you have just a transp color to deal with.
Add another flat_transp.mtd if you want better GUI, shader being put in the shader folder etc. Here a basic one for Maya not sure what's needed for C4D.
[node flat_transp] maya.name STRING "flat_transp" maya.id INT 0x00076543 maya.classification STRING "shader/surface" maya.output_name STRING "outColor" maya.output_shortname STRING "out"