SamSuka
Dark Souls Lighting Engine
Dark Souls Lighting Engine

patreon


Darksouls3 Lighting Engine - Tech/Update

DarkSouls3 Lighting Engine (Full) - (will be available on Nexus and all modders).

All Features(Player)

1. DLSS/FSR 3. - All upscaling modes supported.

 - Rendered in perfect order. Scene Render -> Upscaling->PostProcess(DOF,Bloom, MotionBlur)->UI(Native resolution). No cheating xD.

 - Motion vector coverge. LE uses the recommended 16 bit motion vectors. A lot of fixes here and overrides to capture them correctly. like previous frame animation matrices caching and overriding shaders.

 - It currently hooks onto the "Motion blur" pass in basegame, overriding the render target and changing shaders to output correctly.

 - DS2LE as I had overriden all GBuffer shaders (Few hundreds), this was done directly during Gbuffer pass and these vectors were also available for visual effects, however DS3 has thousands of these GBuffer shaders(These are the shaders which are the ones created using

visual graph, in UE for eg), so is not feasible approach to override  all these shaders, as there is easier option with Overloading Motionblur pass, but there is a catch as now when the game thinks motion blur  is not required for this moving object those MV's are removed, DLSS handles this fine, but FSR obviously tanks the image. for those pixels.  DS3 also uses something called as Deferred Command lists, by re-arranging the Motion blur command list to execute just after GBuffer pass instead of after scene is rendered, the motion vectors are also available for SSAO, SSR computations which makes a big difference in quality of these effects.

2. Physically based Global scene SSR, which blends in existing game cube-maps for all materials in the world when there are ray misses. Lighting engine has full access to scene GBuffer, so it can access the roughness/gloss values for each pixel rendered. SSR is then computed based on the roughness giving accurate reflections rather than make every pixel reflect everything. SSR also has other benefits like grounding objects(occlusion) and removing unwanted reflections as the cubemaps usually are captured with Sky.

3. Water SSR, which blends in existing planar reflections when there are ray misses. DS3 is cool in that they render "pre-rendered shell of an area in the planar, i,e very few objects", so when there are ray misses, the artifact is mitigated significantly.

4. Screen space shadows - this is same as one in days-gone (bend studios). Amazing for micro shadowing and far range items like mountains, trees, as they are very small in screen-space and normal shadow-maps cannot reach that far.

5. High performance GTAO with visibility bitmasks and variance driven denoising, along with contact shadows per light 

- Only 1 sample per pixel is done at half render resolution and denoised separately before rendered-image is finally cleaned up with TAA(DLSS/FSR) 

6. Single bounce screen space SSGI, calculated along with GTAO and denoised together.

7. Reverse Z Buffer - This improves the stability of the image, feeding into all the other effects(AA, SSAO, Rendering). Very complex to do, but hard to show the effort behind this, as like there are lots of things to handle, like soft particles, reflections, basically breaks the whole game, as it is changing fundamentally how the depth buffer works and does not even know the depth buffer was flipped. This feature was in DS2LE as well, but I never really showed anyone what it was doing. 

8. HDR support - HDR Tonemapping part is Thanks to Pumbo.

9. AutoExposure - which feeds FilmicTonemapper(SDR) and Pumbo's HDR Tonemapper(Based on DICE).

10. Physically based lighting model updates - Base DS3 uses Blinn-Phong Lighting model system, LE updates this to GGX Smith, which has been the industry standard since mid 2010's, this is the part which removes that greasy look on armors in DS3. This involves overriding all lighting shaders, like when the engine renders point lights or directional lights. 

All material types are updated(Metal, Non-Metal, Foliage, Hair, Skin). I segregate these meshes using Stencil buffer so diff lighting models can be applied. 

11. Atmospherics : 

     - Volumetric Fog with sun and local light shadows

     - Aerial perspective view , which helps show sun scattering on the far range mountains.

12. Full scene Dynamic shadows/PCSS support - LE handles all shadow casting, it has it's own internal scene management system, It stores only specific vertex attributes(minimal), so that there is less data transfer to GPU and does a lot of batching to render as many meshes as possible in one go. This is big performance advantage over how the base game renders shadows. There is also PCSS support which also mimics ray traced shadows.

13. SkyLighting system - Which takes in shadows and simulates Large scale AO/GI. Areas where the sun does not reach.

14. Motion Blur and Cinematic DOF - I had to create a new PP chain for this, as there is upscaling and the base game has no idea about upscaling or TAA Jitter etc. These are mostly inspired by work from Crysis 3 papers.

Features(Modder)

1. Texture override - Any texture in the world on screen can be replaced in real-time.

2. Point light/local light injection - Can place point lights, spotlights to simulate GI or alter scene lighting.

3. Zone Sunlight/Atmosphere configuration.

4. Mesh injection - Especially useful to place foliage, the foliage reacts to player, but does not block the player. Designed to handle large batches of grass.

5. Point and click - Everything in real-time to select meshes to feed into (1,2,3, 4)

6. Note to Modders : Do not assume that lvl(.pkg) files which are currently supported right now in early access will work with final build. The texture override system and lighting response from material are fixed. So you can make changes for that. But atmosphere/shadows are expected to break.

Release Date

- I expect the full release to take a few months, I would be able to finish it Q4. There are certain personal things as well to handle, All Tech work is pretty much done, pending items is Reliable area detection. Setting up shadows/lighting for the zones. 

Regards,

Ragevitamins.

Darksouls3 Lighting Engine - Tech/Update

More Creators