Planetside Software Forums

Support => Terragen Support => Topic started by: N-drju on December 31, 2019, 06:34:06 AM

Title: Light source itself, casting shadow
Post by: N-drju on December 31, 2019, 06:34:06 AM
There is a significant problem (possibly a bug) with the "light source" lighting object. It turns out the light source itself is casting shadow directly underneath the object's center, producing an unwanted shading effect:

shadow_from light.png

I checked for other possible culprits, but the problem is most likely caused by the light source object. What is even more puzzling is that this effect is visible in the regular preview but not in the RTP!

I'm stumped... What do you think might be the cause?
Title: Re: Light source itself, casting shadow
Post by: N-drju on December 31, 2019, 06:56:59 AM
Hmmm... Just found out where the problem lies. Turns out it's the cube's native object shadow (used as a base instead of ground in this render) that is at fault... I just wonder how on Earth a cube shadow can be cast this way and be a perfect circle too!
Title: Re: Light source itself, casting shadow
Post by: Oshyan on December 31, 2019, 02:15:17 PM
Interesting. I wonder if it's actually a GI cache artifact. What happens if you turn off "Cast shadows" for the Cube? Do you get no shadow at all? What about if GI is 0/0 (or enviro light is disabled)?

- Oshyan
Title: Re: Light source itself, casting shadow
Post by: N-drju on December 31, 2019, 05:27:44 PM
It cannot be a GI cache artifact because I did not use one. ;) Yes - turning the shadow off in the cube object fixed this issue, though (using conventional physics) I cannot fathom how...

I can live with no cube shadow in this render, and I'm glad I got off easily with that. But it probably needs an investigation.

Happy new year!
Title: Re: Light source itself, casting shadow
Post by: WAS on December 31, 2019, 08:45:17 PM
Quote from: N-drju on December 31, 2019, 05:27:44 PMIt cannot be a GI cache artifact because I did not use one. ;)

There's always a GI cache, though. Saving one just saves the cache to file so TG doesn't need to do it before render.
Title: Re: Light source itself, casting shadow
Post by: Oshyan on December 31, 2019, 09:15:12 PM
Quote from: WAS on December 31, 2019, 08:45:17 PMhere's always a GI cache, though. Saving one just saves the cache to file so TG doesn't need to do it before render.
Exactly.


- Oshyan
Title: Re: Light source itself, casting shadow
Post by: N-drju on January 01, 2020, 06:16:26 AM
I stand corrected. Not a cause though, as mentioned above.
Title: Re: Light source itself, casting shadow
Post by: Oshyan on January 01, 2020, 08:34:58 PM
I can't reproduce the square shadow issue here yet. Can you send a TGD perhaps?

- Oshyan
Title: Re: Light source itself, casting shadow
Post by: N-drju on January 02, 2020, 02:22:19 AM
No problem. I'll attach it in the evening or if not - tomorrow evening.
Title: Re: Light source itself, casting shadow
Post by: N-drju on January 02, 2020, 02:08:56 PM
There you go.

LSource_CubeShadow.tgd

I use the latest TG version (no frontier build.)
Title: Re: Light source itself, casting shadow
Post by: WAS on January 02, 2020, 02:14:16 PM
Well, first thing I did is turn off the cubes shadows, and then, no shadow...
Title: Re: Light source itself, casting shadow
Post by: Oshyan on January 02, 2020, 04:28:48 PM
That is, indeed, weird as heck. I tried everything I could think of and the "shadow" remains. I'm not *as* concerned by it being circular as I am by it being there at all, for a couple reasons. First, the cube is *below* the light source, so shouldn't be casting a shadow on *itself*. Second, if you disable the cube and re-enable the planet surface, there is no shadow, so it's clearly handling the light source differently on cube vs. planet. Matt will have to look at this one I think. It may well be a bug, just a rare one. :D

- Oshyan
Title: Re: Light source itself, casting shadow
Post by: N-drju on January 03, 2020, 02:31:38 AM
I knew you'd be interested. ;)

Quote from: Oshyan on January 02, 2020, 04:28:48 PMFirst, the cube is *below* the light source, so shouldn't be casting a shadow on *itself*. Second, if you disable the cube and re-enable the planet surface, there is no shadow, so it's clearly handling the light source differently on cube vs. planet.

Precisely! This is what I thought as well - there has to be a difference in how light is being handled by this native object. You know what? Now I'm curious if the same will happen with the sphere, rock or grass!
Title: Re: Light source itself, casting shadow
Post by: Matt on January 16, 2020, 10:30:52 PM
The shadow is cast by the other side of the cube. Obviously this doesn't make sense in the real world, but there's a reason why it happens here. The cube is very thin compared to the distance (it's 1 metre thick but it's about 20 km away from the camera). It's only a problem with displaceable objects. With a non-displaceable object this wouldn't matter, but Terragen makes some simplifications when it casts shadows from displaceable surfaces onto other displaceable surfaces and it needs to add some bias to the ray positions to make it look correct in most cases. This is one case where it fails.

There are a few ways you can fix this. You could make the cube thicker, or you could replace it with a Plane object. You might also be able fix it by using a higher micropoly detail or higher ray detail multiplier.