Daydreaming on shadow catcher

Started by uuderzo, July 14, 2020, 08:36:32 AM

Previous topic - Next topic

uuderzo

Sorry for my daydreaming...

I was thinking about using a shadow catcher shader to drive a displacement shader. The purpose of all this mess should be using shadows to define, say, snow accumulation points in one side of objects like trees or rocks.
Obviously this would end in a recoursive problem as the displaced terrain will not catch shadows the same way as the undisplaced one.
But maybe there is some kind of iterative approach that lets one to first project a light on the terrain, bake it then use the projected shadow to drive the displacement shader?

Umberto

Hetzen

Or just turn the Atmosphere and Enviro Light off, with your planet colour set to white, and render a projection (top down, camera projection) and you will have a reversed mask, you can re-import to use with a Surface shader.

uuderzo

Ok, more or less... something happened.
I need to stop thinking that a final image can be achieved by a single render pass...
I'm too lazy ::)

WAS

Doing a white surface with no GI, Enviro Light, or Atmosphere like Ulco suggested seems the best bet. You can then capture the shadow, and edit it as a map in PS or w/e. Aligning it back to the terrain may be annoying.

Quick test to show you result. I went little extreme on the Gaussian blur but more or less the idea.

WAS

I will say, it would be nice if the shadow could be used as an active mask but it gets this data at render time I believe. After displacement calcs.

uuderzo

Well, aligning the mask wasn't so much annoying.
I simply used the same downward camera as a projection camera and it went in the right place in a snap.

The annoying thing is that the rendered mask needs to be post processed in some image editor to get a gaussian smoothing.
Yes it would be cool being able to use the shadow catcher as an active input for other shaders but i guess this would introduce lots of issues.

WAS

Yeah that would work for a certain perspective, but if you change your scenes location or camera you gotta preserve with a dupe camera or back at square one with another export.

Unfortunately there is no way to "blur" geometry beyond smoothing controls for noise and roughness but if there was, I imagein with like rocks you could easily just have a duplicate rock setup, at a larger scale, and than use a directional mask to create a buildup. Then again maybe not because we can't scale up from location, the whole area is scaled out.

Dune

It wasn't me, but Jon ;)
But it would indeed be very nice if Matt could make it so that shadows could be used directly. On the other hand, you get all sorts of problems, because whole mounatins and trees shed shadows, and you'd want the effect locally, I presume.

Hetzen

If you use the shadow at render time to displace, how do you then caste a new shadow from that displacement?

Dune


uuderzo

Guess the shadow catcher may be used to alter color only, not displacement.

Moreover, after a bit of thinking about it, being able to catch shadows and displace in one single pass would be limiting because you could not cast a real final shadow from a different direction. The shadow catcher should be able to catch only a single light source, not visible in final rendering, used only for the fake shadow displacement.

And i don't think this would be easy to handle, if possible.

Hetzen

#11
I suppose to make the effect more accurate, you could render a few shadow masks of the sun through it's arc of a day, add together, then divide by the number of images used. I guess that could simulate what would happen with temperatures.

But to be honest, the effect you've rendered looks like a fairly good representation of a snow drift. Using the Smoothing Effect in a Surface Layer, should knock out some of the lower octave noise.

WAS

Quote from: Hetzen on July 15, 2020, 01:41:22 PMI suppose to make the effect more accurate, you could render a few shadow masks of the sun through it's arc of a day, add together, then divide by the number of images used. I guess that could simulate what would happen with temperatures.

But to be honest, the effect you've rendered looks like a fairly good representation of a snow drift. Using the Smoothing Effect in a Surface Layer, should knock out some of the lower octave noise.


I think that's a projected image map so it wouldn't be effected by smoothing shaders. I'm not sure what's up with the roughness.

I also tried to do fake stones out of a PF, and use it translated and smoothed to do similar, and the effect just wasn't right as the octaves get larger and bulbous and out of shape. Doesn't really look like pileup. Similar to blurring a image map as well, based on hard Fake Stone shapes (but I think your sun arc method would work there).

Also sorry name mix up!

WAS

#13
Using a plane as SSS works a lot better, as you don't have displacement mixing artifacts from trying to mask out the snow buildup on displacement. SSS also allows you to do transmission so the end of the snow looks right laying on the rock. The only issue is it seems the shadow fixes for objects, introduces broken shadows to surfaces lol but you can get pretty quick render times with hard surface approximation (no fix for shadows). The crop was 33 second with youtube sucking up CPU.

Second image lower sun and little more depth.

Kadri

Your examples above are already good.
I just looked for a different approach that might not the best but you could use a negative light too with luminosity on the object.