Translucent materials and lights

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
tormgauntlet
Posts: 3
Joined: 25 Sep 2020, 06:10

Translucent materials and lights

Post by tormgauntlet » 25 Sep 2020, 06:43

Hello all :)

I'm wondering if OpenMW can handle true translucent materials and project light. I'm making a house/store that won't be an interior cell. On the ground floor, there are shop windows on which I plan to apply a stained glass texture.

Actually, I can add an alpha property and a material. It's ok, the window is translucent. But I'd like that the sun light projects the amber color on the ground. The problem is that the shop window seems to be considered as an opaque object and won't let the light pass through at all.

Is there a trick to achieve my goal please ?
Capture d’écran 2020-09-25 073609.png
Capture d’écran 2020-09-25 073745.png
Capture d’écran 2020-09-25 073826.png
Capture d’écran 2020-09-25 073855.png

User avatar
lysol
Posts: 1445
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Translucent materials and lights

Post by lysol » 25 Sep 2020, 08:52

Lights do actually get there, it's just that the shadow casting apparently doesn't realize that there shouldn't be any shadows cast from the glass. Or better yet, the shadow casted from there should be transparent.

AnyOldName3 can probably elaborate and he should know if there is a way to fix this in your model. A very nice model by the way.
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

User avatar
AnyOldName3
Posts: 1945
Joined: 26 Nov 2015, 03:25

Re: Translucent materials and lights

Post by AnyOldName3 » 25 Sep 2020, 14:22

It's not really feasible to have shadows for translucent objects with modern GPUs in real-time, as it's significantly more computationally expensive than just treating things as either completely opaque or completely transparent. We might revisit it as an optional setting in a few years when powerful enough GPUs are common.

For now, if you've got an alpha tested object, it'll cast shadows when the alpha test passes and not when it fails. If you've got an alpha-blended object, it'll cast shadows when it's alpha is more than 50%, and not otherwise. The shadows will always block all direct light from the sun. Your best option if you want coloured shadows and sunshafts is to add them to your mesh, and potentially add animation of some kind if you want them to track the sun's position. Otherwise, set the alpha a little lower to let the sun through or deal with the sun not getting in.
AnyOldName3, Master of Shadows

User avatar
AnyOldName3
Posts: 1945
Joined: 26 Nov 2015, 03:25

Re: Translucent materials and lights

Post by AnyOldName3 » 25 Sep 2020, 14:23

Also, those interior shadows look very dark, so either you're using a weird lighting or shader setup, or you're having shader compilation errors, which will show up in your log.
AnyOldName3, Master of Shadows

tormgauntlet
Posts: 3
Joined: 25 Sep 2020, 06:10

Re: Translucent materials and lights

Post by tormgauntlet » 25 Sep 2020, 15:19

lysol wrote:
25 Sep 2020, 08:52
A very nice model by the way.
Thank you :)
AnyOldName3 wrote:
25 Sep 2020, 14:22
It's not really feasible to have shadows for translucent objects with modern GPUs in real-time, as it's significantly more computationally expensive than just treating things as either completely opaque or completely transparent. We might revisit it as an optional setting in a few years when powerful enough GPUs are common.

For now, if you've got an alpha tested object, it'll cast shadows when the alpha test passes and not when it fails. If you've got an alpha-blended object, it'll cast shadows when it's alpha is more than 50%, and not otherwise. The shadows will always block all direct light from the sun. Your best option if you want coloured shadows and sunshafts is to add them to your mesh, and potentially add animation of some kind if you want them to track the sun's position. Otherwise, set the alpha a little lower to let the sun through or deal with the sun not getting in.
Okay I have the infos I needed about the engine, thank you :) Otherwise I would have tried hard for nothing.
Yes I have an alpha blended object, and going under 50% of alpha make it disappear. So the light would pass through but the shop windows would be invisible.
The idea of making an animation sounds a good alternative but I'm not skilled enough at the moment ^^ I will study it
AnyOldName3 wrote:
25 Sep 2020, 14:23
Also, those interior shadows look very dark, so either you're using a weird lighting or shader setup, or you're having shader compilation errors, which will show up in your log.
Well it's true it's very dark, but maybe it's because the walls and windows are 2D objects ? Shadows are weird too. Where can I see the shader compilation errors please ?

Thank you guys for your fast help !

tormgauntlet
Posts: 3
Joined: 25 Sep 2020, 06:10

Re: Translucent materials and lights

Post by tormgauntlet » 25 Sep 2020, 17:40

AnyOldName3 wrote:
25 Sep 2020, 14:23
Also, those interior shadows look very dark, so either you're using a weird lighting or shader setup, or you're having shader compilation errors, which will show up in your log.
Capture d’écran 2020-09-25 181855.png
Okay I investigated a bit. I think it's the expected engine's behaviour. As you can see, the character's and pillar's shadows look fine. The ground texture is a texture I made and I've generated additional maps for it, so the light and shadows apply well on it. But for the house, I put a texture I'm working on, and it has no specular/normal maps at all. I think that's the reason why it looks so dark inside. I put this texture even if it's not finished only for testing purpose.
AnyOldName3 wrote:
25 Sep 2020, 14:22
For now, if you've got an alpha tested object, it'll cast shadows when the alpha test passes and not when it fails. If you've got an alpha-blended object, it'll cast shadows when it's alpha is more than 50%, and not otherwise. The shadows will always block all direct light from the sun. Your best option if you want coloured shadows and sunshafts is to add them to your mesh, and potentially add animation of some kind if you want them to track the sun's position. Otherwise, set the alpha a little lower to let the sun through or deal with the sun not getting in.
Ok, I changed some settings on one of the shop windows in order that I can put alpha under 50% without making the window invisible.
Capture d’écran 2020-09-25 183240.png
Capture d’écran 2020-09-25 183341.png
As you can see on the in-game screenshot, the light pass through the rightmost shop window now :)

Post Reply