Fade Scattering medium density

Started by wayneheim, November 21, 2019, 10:46:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wayneheim

I have a very porous scattering medium I'm using. The rub is I need it to be less porous at the edges of the object and more porous in the center.... like a hard shell effect.  Any suggestions on how to fade the porousity towards the outside edges?

sloanelliot

One approach (depending on exactly what it is you're trying to achieve) would be to use a Gradient node set to "view direction" fed into the background channel of a Color Composite node, and then feed your original density map into the source channel w/blend mode set to "multiply". The problem with this approach would be that your driving density map would remain constant (as far as "cell" size goes, if we're talking about foam for example) so it wouldn't quite be true to life, where cell size gets tighter and tighter towards the outer layer. You could, however, fake that to a certain extent by using a second material (say, plastic, or advanced) as a label on top of the base material, then apply that same gradient (or curvature, depending on application) node to the opacity channel for the label material.

Are you trying to sort of re-create something like a urethane foam where it's open-cell inside but with a smooth "crust" of sorts (i.e., a Nerf football) on the outside/mold side? Or is this something else? Depending on exact application, there are definitely ways to achieve this, some easier than others haha..



wayneheim

Sloanelliot, I'm a medical illustrator and I have to do some illustrations of cut bones for a surgical image. When you cut through a bone say a femur, the outer margin is hard dense bone an the inner is more spongy. I have created a great spongy feel with the scattering medium but can't for the life of me get the outter edge to have less holes, so to speak, in it. I've attached a file so you can see. Detail is not going to be this large but need something sort of convincing so I don't have to touch up every render in post.

sloanelliot

Ahhhh, I see. Cool project!

Are you looking for something kind of like this (super quick and dirty obviously)? This just uses two labels (one that's an off-white for the bone, one that's sort of a peach color for the intermediate areas) with a custom "view direction" gradient for their respective falloffs/placement. The bone label's color composite was set to hard light to get full white/solid crust, and the middle label uses multiply so the spots carry through, and both composites are fed into the opacity channel. I also used the same spots node for each, but un-synced and scaled each down incrementally for more density. You could obviously use the Advanced node instead of plastic to get some translucency for that middle layer, etc. but that's at least one approach..

Problem is, this whole setup is good in theory, but also not practical in many use cases, depending on the shape of the geometry.  In some cases, you'd have to manually achieve the same setup by using three sets of offset geometry for each region (with some overlap) and build the materials independently so you can use multiple instances of scattering medium.

wayneheim

Thanks. I'll give it a try. Any chance in you saving out your test so I can look at it closer?
Thanks for all your help.

I was able to get it to fade somewhat with plugging a gradiant map set to circle into the color connector on Spots which feeds into scattering medium but it will only do a circle and I sure would like the fade to follow the contour of the object. It will follow the contour if you fade to the outside. Wish there was an "invert" option. I think you are right I will most likely have to create multiple shapes to truely get it or just paint it into the final renders.


Wayne

sloanelliot

Haha I'm kind of embarrassed, but I closed out of the test I did without saving or I would have uploaded it in my reply (d'oh)..

If I have time later I might mess with this because I'm genuinely curious on this one, and the "solve" could have some far-reaching applications.. But the thought that immediately comes to mind is using the contour node in a similar manner to what you're doing here; i.e., feed into the color channel of the spots node. The contour node has some pretty advanced control that allows you to control viewing angle, width, etc., as well as HIDE interior edge contour, which would almost always yeild a cross-section type view, regardless of your viewing angle, and always stritcly limit the thickened regions to the outer edges.

From there, you could even use a color composite and bring in a scaled-down copy of your spots node and multiply that onto your contour so you still get smaller spots/holes on that pass as well. And you could even do it a 3rd pass for the bone, but I'd still think using a plastic or advanced label for that would be more ideal (and you could still use the same contour node, modified, to mask the bone to the extreme outer edges)..

Hmm..


sloanelliot

Maybe something more like this? (attached)

I've attached the KSP as well. Using contour was a bit tricky because the solo results (when pressing "C") aren't a good representation of what the finished result will be, so you have to go in and bring the multipliers down and sort of soften things, etc. But here I also fed a duplicate spots node that was scaled down and comped it in with the contour node so it wasn't so harsh and still has the smaller open cells, etc.

The only downside with this material setup is that it's really heavy. Honestly, I don't know if there's enough added benefit here to feed everything through the density node for the scattering medium, and maybe instead use the same approach I originally outlined (using incremental labels) but the only difference being: use the contour node to drive your opacity instead of a gradient set to "view direction" ... this would also allow you to colorize each separate region slightly differently as it moves towards the bone and kind of "feather" the results. I suppose you could also do both of these together, ha..

Anyway, when you land on something you like you should post your results!

wayneheim

Thanks Sloanelliot! That is almost there but yes it is very heavy. I simplified it down a bit and think I'm getting closer. Still working on the density of the inner area but think this will work with one or two lables. Thanks very much! I had tried contour but didn't get any results cause I had the width too high. Ended up having to set it to .0006 and turn off pixels(to keep it from scaling when the scene zooms).

Thanks again.

sloanelliot

Awesome!

Haha yeah contour is really weird to work with because it doesn't quite behave as expected, least of all when you're using it as a hack in this way haha.. Oh well.