Welcome, Guest.
Username: Password: Remember me

TOPIC: Fake Volumetric lighting/Light Shafts

Fake Volumetric lighting/Light Shafts 8 months 3 weeks ago #1

Hi guys, I have another question that i'm 95% sure can't be done but I hope you guys don't mind me asking anyway. It's kind of hard to explain so i'm sorry for the long text, but here it goes...

In games that have post process light shafts, the shafts can give a pretty decent impression of fake volumetric lighting. However this is only the case when the light source (sun, in this instance) is on the screen, and the light shafts are coming right at you.

As you gradually pan the screen away from the sun, the light shafts even start to cast horizontally across the screen, which looks really nice imo, and somewhat resembles the appearance of genuine volumetric lighting...(This is the aspect that i'm ultimately going to ask about emulating)

When the light source is completely off the screen however, there are literally no light shafts at all, and this leaves the game world looking much more lifeless and sterile than when the light shafts were cast.

Is there any way that you guys can think of to fake volumetric light shafts by making them cast across the screen at very wide angles? (even when the light source is not technically visible to the players)

I remember reading a post by MartyMcFly saying that his MXAO shader could take samples from the environment from outside the screen border (when the sample radius is set too high)... is that type of thing exploitable with reshade, in a way that we can take information from outside of the visual buffer? I might've misinterpreted what he meant...If so. any other ideas? :)

Edit: I'm really sorry about the wall of text, i tried to consolidate as best i could :blink:

Edit 2: This might be a far-fetched idea too but, would it theoretically be possible to use your mouse (or some other method) to click on the sun, and then that point is temporarily saved and used as a reference to dictate what direction light shafts/lighting effects should come from? I'm not aware of how/if reshade would be able to store and utilize that type of locational information, but that would allow for so many advanced rendering tricks it'm excited just thinking about the possibilities :cheer:
Last Edit: 8 months 3 weeks ago by SandyCheeks.
The administrator has disabled public write access.

Fake Volumetric lighting/Light Shafts 7 months 1 week ago #2

It's...possible to save a mouse position to theoretically keep track of a 3D point, but I can imagine it'd be immensely hard to actually keep track of said point. You'd have to use mouse movement to do it and unfortunately ReShade only offers a literal mouse point, not a "movement", so it actually stops at screen edges. It's possible to extend ReShade to have a "mouse delta" but I had a lot of headaches doing so, but it does work. I used that for a mouse-based motion blur shader, but ended up giving up because it depended on a shoddy hack in the ReShade CPU code.

Also it'd be very easy for the shader to fall out of sync with the tracked position. All in all it seems it'd be a horribly problematic effect to do. You could, of course, use a statically-positioned sun rays effect. That could work very well for screenshots, even with fixed positions through the mouse.
Likes to reinvent the wheel.

My shaders repository: www.github.com/luluco250/FXShaders
The administrator has disabled public write access.

Fake Volumetric lighting/Light Shafts 7 months 1 week ago #3

Hey thanks for the feedback :)
I wasn't even sure if some type of coordinate-based marker was possible, but yeah, keeping track of that point (and utilizing that point as a tool) does seem like it wold introduce a bunch of additional complications.

Even as i was originally typing out the op, i was pretty sure it was borderline impossible, or an unrealistic fantasy. As someone whose not familiar with coding, and only moderately aware of the limitations of the reshade framework, It's tempting to want to ask the Pros here about pushing the boundaries of what can be done with it. Sometimes that can go too far though, and end up with unrealistically advanced feature requests like some of mine :blink:

the only way to really learn about what can and can't be done is to ask though, so i hope you guys don't get annoyed by the questions. Anyway, thanks again for the response.
The administrator has disabled public write access.

Fake Volumetric lighting/Light Shafts 7 months 1 week ago #4

luluco250 wrote:
You'd have to use mouse movement to do it and unfortunately ReShade only offers a literal mouse point, not a "movement", so it actually stops at screen edges. It's possible to extend ReShade to have a "mouse delta" but I had a lot of headaches doing so, but it does work.

i thought ReShade does have a mouse delta uniform:
uniform float2 mousedelta < source = "mousedelta"; >;

it's part of the ReShade shaders reference file. does this not work?
The administrator has disabled public write access.

Fake Volumetric lighting/Light Shafts 7 months 1 week ago #5

Yeah, it works. Thing is, it's super hacky to construct a world system based on it, you'd have to normalize it at some point like "look 90 degree up, press button X" and it's depending on camera turn speed, menu would fuck it up and so on. I tried to make a velocity map based on mouse direction (track objects across different frames and mark objects based on how fast they moved) and failed poorly.

And what I mentioned about MXAO sampling outside screen: well, that happens. ReShade doesn't have any data outside screen so if you try to read data outside screen, you get false information (based on how texture coordinates are managed, repeating border pixel, mirror texture etc) so I actively have to prevent this from happening.
Last Edit: 7 months 1 week ago by Marty McFly.
The administrator has disabled public write access.

Fake Volumetric lighting/Light Shafts 7 months 1 week ago #6

I must be outdated then, it didn't have it some time ago. Funny enough when I implemented it on a personal fork I used the exact same name. Guess MBMB revival is possible now. (Mouse-Based Motion Blur)
I tried to make a velocity map based on mouse direction (track objects across different frames and mark objects based on how fast they moved) and failed poorly.

Same, all my attempts to generate a velocity map have only ended up in temporal normal maps.
Likes to reinvent the wheel.

My shaders repository: www.github.com/luluco250/FXShaders
Last Edit: 7 months 1 week ago by luluco250.
The administrator has disabled public write access.
The following user(s) said Thank You: MaxG3D, Scorpio82CO

Fake Volumetric lighting/Light Shafts 7 months 3 days ago #7

hey.. thanks for the MBMB shader.. its fantastic, I could have and idea for third person games, have you seen the Fu Bama´s display depth filmic shader? can be useful the metod to separate the shader like the dof shader work in specific zones than don´t affect the front or background.. and a question.. are there a posibility open for the per object motion blur?
thank for your shaders. .. (Scurve, Magic bloom 3 really improved)
The administrator has disabled public write access.