I am using an ArrayMesh for the window frames of a spacecraft cockpit. When the “sun” in the view passes behind the window frame, it is visible as if the material is partly transparent. The frame material (StandardMaterial3D) has transparency disabled. Cull mode is back, but setting to disabled makes no difference. All material properties are at default except Albedo Color is set, Metallic is 0.15, Specular is 0.6. Roughness is 0.5.
I have two screenshots. In one, the frame material is to the right of the “sun”, and although it should be in shadow because it is facing away from the light source, it is brightly lit. In the second, the “sun” is behind the frame, but is still visible.
I assume there is something simple I didn’t know I needed to do to make this not happen. I wonder what it is?
that is not physically accurate. metallic should always be either 1 or 0, and specular should not be changed.
I assume there is an environment node in the scene, which you should have.
set sky contribution to 0.0 for the vacuum of space, also enable shadow in the sun.
you using a light for the sun right? if that’s just a sky it’s not going to cast shadows, you need to match the sun to the sky.
you also need a form of GI.
use reflection probes for the interior rooms.
if this is a level that won’t change, you can use a VoxelGI or bake the shadows instead.
if this is an open world, or the ship has to move, and has too many rooms for real-time reflection probes, you can also use SDFGI, or enable SSR, SSAO and SSIL.
it could be a problem with lighting on your geometry. try changing the standard material burley to lambert or toon, specular too.
Switched the window frame material to metallic 1.0 and specular 0.5 (default).
There is a WorldEnvironment in the level with a custom sky shader for drawing the sun disk, stars, and a planet. Sky color is pure black with sky contribution set to default (1.0), but setting to 0.0 makes no visible difference (presumably because of the shader?). Illumination is solely provided by directional lights corresponding to the sun disk and a planet (not in the screenshot) in the shader. Both the planet and sun directional lights produce the same effect, by the way. The light casts shadows with other objects, including from the spacecraft itself (shadows cast onto the ground), which is part of the same ArrayMesh, but with a different material.
The portion of the ArrayMesh making up the window frame does not seem to cast any shadow.
I tried adding a reflection probe and SDFGI, which look very good but do nothing to fix the original problem.
Your very last idea of changing the frame material shading specular mode to disabled actually cured the problem completely, but at the expense of eliminating the specular effect - haha. It even casts a shadow now.
I wonder if there is actually an error in the creation of the window frame ArrrayMesh that is causing this. This gives me a direction to go, however. I will try placing a trivial ArrayMesh in the scene and give it the same material to see if it has the same problem. So your ideas have definitely given me a direction to investigate. Thank you!
Yes there was. Due to my own error, the normal vectors in ArrayMesh were all pointing in the opposite direction to what they should have been. Live and learn!
Thanks again to jesusemora for what turned out to be very helpful pointers!