0
$\begingroup$

I'm trying to make a material that resembles some kind of liquid; it is opaque where it is thick and transparent where it is thin. I'm planning on mixing a diffuse and glass shader with presumably a custom node (if one doesn't already exist) as Fac.

diagram

The diagram above illustrates what I need, showing a camera and a single object (with two physical parts).

I need a node that will give me back a 0 to 1 (ie. black to white) value depending on the distance the camera's rays must travel through the object (the purple lines in my diagram).

Because it wouldn't make much sense for the 'perceived thickness' to simply be the first purple line segment on a ray. It would probably be best if the length of the purple line is the sum of the segments of it on that ray in the object, even if part of the object is physically disconnected from the other parts.

I've look around but I can't find much of anything that seems to fit the bill for what I'm looking for. I was hoping someone has already written a node like this or if there is a node setup I could use.

P.S. I use 2.8, so some older scripts might not work for me.

$\endgroup$
  • $\begingroup$ Use volume absorption on the volume socket of the material. builder.openhmd.net/blender-hmd-viewport-temp/render/cycles/… or maybe try using ray depth and a gradient. $\endgroup$ – user1853 Jul 9 '19 at 22:42
  • $\begingroup$ @cegaton I've already tried volumes; they aren't an option for me. Volume absorption won't show a white volume. As for volume scatter, the volumes come out dark when a glass shader is also used. I've read link but regardless of how high I set the volume bounces, it still stays fairly dark. $\endgroup$ – thepufferfish Jul 9 '19 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.