FC4 Style Light Occlusion?

Hi!

So, for anyone who has played Far Cry 4, or even seen gameplay footage, which is probably a hell of a lot of people, you can’t deny that it’s a gorgeous game. But one inperticular effect caught my eye while I was playing it today. The enhanced god rays/light rays/light occlusion setting.

Basically, with normal light rays the rays would only appear when looking at said object giving off light, for this example the sun. But with FC4’s enhanced light rays, light rays stay on the screen when not looking at the sun, as if creating an automatic volumetric lighting effect. Here’s an example image:


As you can see, the volumetric lighting automatically appears from where the sun is shining light, so instead of light occlusion, you get a volumetric effect. Now I know you can create volumetric lighting and place it by hand, but I’d love to know how to recreate this effect because it adds so much atmosphere and makes the game look amazing.

Thanks in advance!

This can be done in UE4 using light shafts. They support both occlusion darkening the fog as well as a bloom-only version that projects bright pixels from the screen.

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/LightShafts/index.html

Sorry, I don’t think you understood the question. Yes, there is light occlusion, but it ONLY works if you are walking towards the sun, or looking towards the sun. In FC4 the light rays are always there no matter the direction you are looking, which is what I’m looking to achieve. I believe The Forest also uses this effect, but Far Cry 4’s is more evident.

My bad, yes I guess I skimmed over that bit. That is a limitation of the lightshafts in ue4 so far.

There is no pre existing solution to this that I know about, but in theory though using distance fields it should be possible to get something similar to that using a material that raymarches the world. That is one of the things I had planned to experiment with now that we have access to the global distance field value in materials. I am not sure when I will have time to try it out though since there are a number of side projects I still need to wrap up.

I’m not sure what fidelity level is possible but it should be ok for course lightbeams but don’t expect super fine lightbeams shining through a metal grate to be possible without custom per-scene work.

Ah ok. Well, I’m gonna do some research and see what I can dig up about distance fields as I’m relatively new to Unreal, only been working with UE4 a couple months.

I don’t think you can get a true godrays ^like pic above unless you have a voloumetric lighting solution.

other than that, you’d have to go with what you have and see if increasing the foggyness of your scene actually helps, but I think you always kinda have to look into the sun to see them. I could be wrong however

You could raymarch to get a result like that but the global distance fields are at a much lower resolution so you won’t get the fine shadows, you will more see the shape over the overall tree casting a shadow in the fog.

From what I’ve seen in other games, like GTAV there’s a low detail atmospheric effect, or a high detail effect for things like spotlights. Either one would be great to have.

That would be enough for starters :rolleyes:
CryEngine3.8 introduced Volumetric Fog (voxel based but I reckon with distance fields you could approximate or even match the quality) and it’s just about superior in all ways imaginable to the old-style fog volumes.
Very much looking forward to this!

Would love to see some volumetric fog too. The one from Cryengine looks fabulous :slight_smile:

I should mention that a material function version while possible will be very slow since it will have to trace every single pixel. This is extra painful since you’d be raytracing against a blurry distance field which means the vast majority of the work is ‘wasted’ ie it would look just as good computed at 1/2 or 1/4 res and upscaled. There is no way to do that kind of down-resed processing using materials without code at the moment.

Maybe time to add a nice trello card for some proper volumetric stuff? It looks so cool Ryan, really believe me, you haven’t seen fog like that since the classic horrormovie! Or is that a bad analogy? It is a bit right? ****. Anyways, I’m sure you get the point :slight_smile:

I will have to jump on the bandwagon too, volumetric effects would greatly benefit the engine. Volumetric effects add a lot of atmosphere which, depending on the game, can become quite important.
It’s not something I would scream for, but would be happy to see :slight_smile: