I am creating a scene of a reconstruction of a building torn down in the 60’s which features three stained glass windows.
The material I currently have created has finally got the colour of the glass to effect the light rays coming through it.
It even produces shadows from the non transparent leadwork, BUT it does not colour the shadow cast.
It does not need to be dynamic, but that would make fine tweaking the scene lighting much easier.
The current scene with window.
The material itself. Currently very simple.
Does the Unreal Engine 4 currently support coloured shadows from transparency’s?
Light Function doesn’t read colour channels either, at least I haven’t been able to get it to. The only information it seems to pick up is (single channel) intensity.
You could maybe break your light into three Light Functions (seperate the R,G,B channels). Not sure if that would play well mind.
Not ideal, but if you need a proverbial tyre iron; this is projecting three seperate Light Functions (R,G,B).
I had to literally split it into three textures however, as even if you only output R into Emission, the light reads the whole RGB intensity. This might be intentional but I’ll file it as a bug anyway.
(and yes, it works as dynamic [Movable], so you can manually place & tweak…just parent the G & B lights to the R light)
So I sat down this morning to recreate this for a report, and discovered that I couldn’t repeat the steps.
It appears that Light Function materials do read seperate channels (as Emission inputs) ok - you still need three Lights & three materials however.
Apologies for any confusion!
Three Light Function materials & Lights + 1 RGB texture.
Tip: Set your Lights to extremely high intensities, and tweak their Indirect Lighting Intensity to get nice HDR glows and GI bounce from them (this is at 8000000.0 & 0.3 ILI per light), and seperate (or rotate) the lights very slightly for chromatic aberration:
That is a very nice solution, Just not sure whether it would work in the scene.
The scene has both indoor and outdoor areas connected by an open doorway, both lit by the same sky and directional light.
I would like the light rays to come out from the window parallel.
I will have an attempt to use the system suggested and see what I can get working in the scene.
I do wonder why the lighting system does not take into account transparent colours.
Couldn’t you create a texture / decal and cheat the look? Make it seem as if the texture is coming from the light when it reality it’s a texture placed on the wall?
It didn’t occur to at the time, but you can simply turn off Use Inverse Squared Falloff on the Light properties to avoid having to overload the light intensities - this will give let you use much lower light Intensity and ILI settings, for more subtle control over the look and in particular less GI overloading from indirect light.
Sadly I’ve no solution for coloured light rays - direction lights can’t clamp (I don’t think) the Light Function texture, so although you can use Light Functions with them, they’ll be a repeating tiled projection. I might look into this more this evening.
You can, and the docs state that deferred decals are very efficient, but there are caveats - namely they don’t shadow and they wrap. They’re also oblivious to the material properties they’re projecting on - see the water in the screenshot.
Either way, if you have a lot of these to place, I’d create a Blueprint of any windows that need to project, with a “source light” public variable that can be set to the light that’s doing the real casting (i.e. the sun) from which you can get the vector for the light projection. There are caveats again of course - spotlights have a cone, so it could be problematic in some cases, whereas decals are flat (but have other considerations such as bounding box volume).
Sorry for posting in such an old topic, but it still shows up when looking for a stained glass methods in search engine. Currently I’m really interested in the first image from this topic - how is it possible to create such stained light rays? I know most light rays in UE4 are just a model with proper material (with exception of Light Shafts from a Directional Light), but I can’t find anything about stained rays anywhere. Even here PlatypusGreen mentions only that “The material I currently have created has finally got the colour of the glass to effect the light rays coming through it.” Could someone please explain this in more detail?
Most likely they are just bloom based light shafts. You have to check light shafts enabled on your directional light.
Regarding the issue at the stop of this thread, it’s probably just that the opacity needs to be adjusted to let more colored light through. You can try using the “lightmass replace” node and feed a lower opacity into lightmass. You should get nice colored light IF your directional light is static. Stationary lights only use shadow maps which cannot be colored. Dynamic lights would also have to be faked by using a projection.
Thanks Ryan, turning on bloom in light shafts activated the effect. But unfortunately it doesn’t have different colours, as you can see below:
Is there a way to make a shadow sharper? Or to blur these pixelated edges at least? Setting higher resolution for the floor is not helping much unfortunately:
On the other hand, it looks like this effect has it’s disadvantages (rays should stop on the balcony’s floor), but I guess it’s connected to optimization:
I’m also not sure if this is a bug - on the left and right are the same meshes, just rotated. Glass has a two sided material (I attach screenshot of it below). One side is always darker after building the light:
I probably should report this case with translucent planes on AnswerHub, but I’m still not sure what I’m doing wrong with the rays. They don’t look stained in any way even when I change the opacity of the glass material. By the way, isn’t it strange that glass looks much more transparent inside a building? Is it intentional (or maybe it’s just because of the bug with planes, I need to check it out later)?