Planetside Software Forums

General => Terragen Discussion => Topic started by: Kevin F on September 20, 2018, 08:15:30 AM

Title: Glass & transparency
Post by: Kevin F on September 20, 2018, 08:15:30 AM
Anybody know how to make a glass sphere cast a shadow AND allow light through as in real life?
For some reason applying the glass shader to a sphere always gives a full black shadow.
Title: Re: Glass & transparency
Post by: RichTwo on September 20, 2018, 11:29:39 AM
Try this thread: https://planetside.co.uk/forums/index.php/topic,25672.0.html

Masonspappy provided a .tgo which is a clear glass sphere, rather than the solid glass which the sphere / glass shader creates.  It works well at a smallish scale, but I tried enlarging to almost astronomical dimensions and it got a little wonky.

Good luck!
Title: Re: Glass & transparency
Post by: Hannes on September 20, 2018, 12:21:51 PM
Usually my workaround would be to duplicate your glass sphere, uncheck cast shadows for the first one, and assign a default shader to the duplicated one. Make the last one invisible and set the opacity to something lower than 1, let's say 0.25. Thus you have the glass shader and a transparent shadow. You don't have caustics (yet), but that's a known issue. It's a cheat, but better than nothing I'd say.
Unfortunately this doesn't seem to work with the built in sphere for whatever reason. You'll always get an opaque shadow... :(
Title: Re: Glass & transparency
Post by: Kevin F on September 20, 2018, 12:29:00 PM
Thanks, I've seen that and it doesn't solve the problem.
If you use the glass shader on either the build in sphere or an imported .obj, they still produce a solid (all black) shadow, which is wrong. Glass objects either solid or two sided (as a wine glass say) should be able to be transparent and cast a shadow that allows some light through as well. The shadows produced by TG are those of a solid opaque object.
Title: Re: Glass & transparency
Post by: Kevin F on September 20, 2018, 12:30:42 PM
Thanks Hannes, just posted when I saw your reply.
So it's a work around then. I'll give it a go.

Title: Re: Glass & transparency
Post by: archonforest on September 20, 2018, 01:27:43 PM
Quote from: Hannes on September 20, 2018, 12:21:51 PM
Usually my workaround would be to duplicate your glass sphere, uncheck cast shadows for the first one, and assign a default shader to the duplicated one. Make the last one invisible and set the opacity to something lower than 1, let's say 0.25. Thus you have the glass shader and a transparent shadow. You don't have caustics (yet), but that's a known issue. It's a cheat, but better than nothing I'd say.
Unfortunately this doesn't seem to work with the built in sphere for whatever reason. You'll always get an opaque shadow... :(
Good to know this trick. Thx Hannes 8)
Title: Re: Glass & transparency
Post by: WAS on September 20, 2018, 03:07:29 PM
Here is an example gather project showing Hanne's method, and my own method for 'semi-transparent' shadows within the same object. Due to the way it's built you get about "half" transparent shadows. But it's useful for some stuff, like thicker glasses (lowering transparency on glass/default shadow), or effects like my RGB Orbs in file sharing.
Title: Re: Glass & transparency
Post by: Kevin F on September 21, 2018, 03:58:36 AM
Thanks guys but these workarounds don't really work, they just produce a lighter shadow.
Here's an example of what I'm trying for.
Title: Re: Glass & transparency
Post by: WAS on September 21, 2018, 04:03:25 AM
Quote from: Kevin F on September 21, 2018, 03:58:36 AM
Thanks guys but these workarounds don't really work, they just produce a lighter shadow.
Here's an example of what I'm trying for.

Yes, as noted caustics are not even a thing in TG yet. You'll only get shadows, which will be lighter and double up (as shown in the image) through different solid sides and densities. TG can simulate doubled up shadows, but not density, nor caustics.