How to do moonlight shaft through window...

I have a dark room, and want to simulate shaft of moonlight coming through window…

The window looks like a window, but is opaque, so am not sure what the best approach to get the look would be? If it were not opaque, I think a directional light would do it(?)

Ideally, you would use a volumetric lighting system - such as:

The new HDRP also has volumetric lighting built-in (see the docs).

Particles may also work: lighting - How can I create light shafts like Journey's in Unity? - Game Development Stack Exchange

2 Likes

If you only want the one effect, a full blown volumetric lighting system is likely too much. Just use this as a jumping off point:

3 Likes

A light shaft is what I want to do…is there a Unity3D example?

Again, one issue (maybe it’s not an issue), is that it’s not a real window where it’s transparent, its just a window texture…

Aura has injection volumes, is that what I want?

If I use something like Aura, can I still use the post processing stack?

In your case, it’s probably best to use some sort of trickery: flat planes + texture(s).

Example from RAGE (not my video):

Aura and alike need a directional light or any other light type to work with.

1 Like

Yes, when the geometry, like a cave entrance or something like that, when it supports the use of realistic lights, then it’s not a big issue, it’s when you don’t have a true opening in the wall (doorway, window, cave entrance), then it can be problematic.

We use Volumetric Light Beam linked above for our bullet holes in our game, well its a proof of concept feature right now. Latest version its really performant, its only 1 draw call for all beams.

Its not a 100% realistic look. but its close enough

I will try some of the techniques mentioned.

I am still unsure though, when using alternate lighting techniques, can I still use the post processing stack? Or will they be fighting each other?

How restricted is the camera? I was playing with volumetric lighting recently and was less than pleased with the performance. I realized that I could smoke and mirrors it with a single quad that always faces the camera and a custom shader. It doesn’t work from all angles though, but I could imagine you could do some trickery with the shader.