Planetside Software Forums

General => Terragen Discussion => Topic started by: cyphyr on January 14, 2020, 03:05:21 pm

Title: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: cyphyr on January 14, 2020, 03:05:21 pm
Is there a way/hack to turn off self shadowing but keep cast shadows.

I don't think this can be don't but a cleverer head than mine (that's everybody) may know better.

I want to cast a shadow on a terrain from an invisible object.

The sequence has already been rendered but the client wants to put a new object in it.
I can render the object separately but the shadow needs to be comped into the existing render.

The simplest solution would be to put a flat white shader (lambert) on the terrain and cast a shadow into that.

This could then be inverted and multiplied over the existing render.
Job done.

However as the terrain is lumpy and has rocks and displacement it is casting shadows onto itself.
Therefore if I use the above technique the existing shadows will get doubled up.

If I could turn off self shadowing then the only shadow I would have on my terrain would be the shadow cast by my object.

I'm pretty sure this can't be done but there may be a hack I don't know about.

Any ideas?
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: WAS on January 14, 2020, 03:13:28 pm
Quote from: cyphyr on January 14, 2020, 03:05:21 pmIs there a way/hack to turn off self shadowing but keep cast shadows.

I don't think this can be don't but a cleverer head than mine (that's everybody) may know better.

I want to cast a shadow on a terrain from an invisible object.

The sequence has already been rendered but the client wants to put a new object in it.
I can render the object separately but the shadow needs to be comped into the existing render.

The simplest solution would be to put a flat white shader (lambert) on the terrain and cast a shadow into that.

This could then be inverted and multiplied over the existing render.
Job done.

However as the terrain is lumpy and has rocks and displacement it is casting shadows onto itself.
Therefore if I use the above technique the existing shadows will get doubled up.

If I could turn off self shadowing then the only shadow I would have on my terrain would be the shadow cast by my object.

I'm pretty sure this can't be done but there may be a hack I don't know about.

Any ideas?

Have you tried a sphere at planetary scales, with cast shadows turned off?

Nevermind, I think I see the problem. Even with cast shadows disabled, the terrain seems no different then the planetary terrain. Even with the sun not casting shadows on surfaces, it's the same deal. Very interesting.
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: WAS on January 14, 2020, 03:21:38 pm
If Matt could return to this problem, it would definitely help these situations. I found this older topic: https://planetside.co.uk/forums/index.php?topic=20472.0
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: cyphyr on January 14, 2020, 03:42:29 pm
Yes I did wonder about using a sphere but ran into the same issue as you.
There is also the Shadow Catcher node which I think is what is referred to in the link above but that still seems to be effected by self shadows.

Hmmm
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: cyphyr on January 14, 2020, 04:01:14 pm
Ah!
Actually works just fine ... see attached
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: Matt on January 14, 2020, 04:31:31 pm
Nice to see that this works! Using the Sphere instead of the Planet because the Sphere has the ability to disable shadows.

To get a clean black and white mask you should also disable the atmosphere (or the planet), because it casts a volumetric shadow that tints the shadow catcher.
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: cyphyr on January 14, 2020, 04:37:52 pm
the landscape has taken on a rather odd yellow hue.
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: Matt on January 14, 2020, 06:07:23 pm
Yes, that's the shadow of the atmosphere, so you'll need to disable the atmosphere (or the planet).
Title: Re: Is there a way/hack to turn off self shadowing but keep cast shadows.
Post by: WAS on January 14, 2020, 08:07:33 pm
Quote from: cyphyr on January 14, 2020, 04:01:14 pmAh!
Actually works just fine ... see attached
Oh wow that's awesome!