Search Unity

Graphics Erebus - Real-Time Ray Tracing SDFs; UE4/5 Style DFAO and Soft Shadows [HDRP/URP/BUILT-IN]

Discussion in 'Tools In Progress' started by SuperDrZee, Aug 12, 2021.

  1. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Erebus - 'Epic' Soft Shadows and AO for Unity3D

    By Michael Rochon And Christian Kahler

    Technical Preview :



    Community Discord : https://discord.gg/c74977m2aJ

    SDF^3 is a comprehensive shading kit that relies on ray tracing distance fields to achieve a number of effects. The system is based heavily on the DF GI engine found in the Unreal Real Engine Since UE4. The system as of now has a fully realized implementation of the DFAO and Directional Light Soft Shadowing.

    The package also includes a suite of tools for converting meshes to SDFs, with encoding options for UVs and Color packing, volume rendering shaders for rendering mesh SDF's in a variety of manor and a few shaders to enhance the look of traditional meshes using their converted SDF data as well.

    Aside from SDF related rendering, the package also includes a number shadowing and AO techniques using terrain heightfields and screen space information.

    There's also plans for handling indirect diffuse lighting and reflections following a similar methodology as lumen.

    In-Terms of the full package the current road map is as follows, in descending

    order:
    1 Release DFAO and DF Shadowing

    2. Integrate SDF Path Trace / Reflections an Indirect Diffuse
    3.Integrate Hardware Path tracing (RTX)

    Intro

    Long Range Software Raytraced Shadows and AO

    Top Image; All Tracing Effects On Bottom Image ; All Tracing Effects Off


    Top Image; All Tracing Effects On Bottom Image ; All Tracing Effects Off

    This system was designed with the intent of solving a big problem when it comes to finding a robust GI solution that doesn't put restrictions on artists while also being an applicable solution for large scale open world building.

    From my perspective the only applicable option that didn't make sacrifices was Unreal's SDF work. I ended up spending a few years on my off time researching and building up similar tech to what they use to manage SDFs as well as the methods the use to trace them.

    Recently I've put the final pieces together and I think I can safely say I have a solution that doesn't compromise and be utilized in practically any rendering scenario, large scale or small and doesn't hamper on quality in order to get there.

    So like UE4s offerings :

    This supports any mesh and responds instantly to changes made to them;

    Meshes Receiving AO and Soft Shadowing As Well As Contributing

    All meshes in the scene above are both receiving and contributing real-time GI. No data is baked, all objects can be moved and the scene will respond accordingly. Shadows ray trace against high resolution instance data, AO traces against high resolution instance data as well, with fall back to a distance field clip map.

    Because the system uses SDF in the same vein as unreal, there's never any worry about object count or density in your scene.

    Because it traces against high resolution instance data you will always get a stable, high quality result no matter what transform manipulation objects goes through and regardless of how they are set up or organized in you scene.

    Handles large scale scenes with ease;

    Even at 2000 meters away, the system can reliably trace instance shadows, and AO.

    There isn't much of a scene size limitation, especially with modern hardware. Even on a 1050gtx, rendering an entire terrains AO an shadows along with it's vegetation instance keep well with in the 30-40 fps mark running all effect wide open. (Highest quality, no optimizations)

    Not only does it handle large render distances well, but it's also extremely responsive to mass changes made to scenes. Because of how the system works, every tree on this map could be updated in real time with no noticeable effect to the ray tracings performance. This means large scale simulation using rigid objects, like traffic sim, or racing games can utilize this tech as well with no problems, or precession issue otherwise found with voxel-based GI systems.


    Final Render with AO Applied and Debug View


    AO On Top;
    AO Off Bottom;


    Above all, we made no compromises to quality. On average our system typically outputs better results than most screen space effects are currently capable of. Offering long range high-detailed traces that never suffer from issues like lack of screen space data or gird resolution found with-in voxel based GI systems.

    On top of this, issues like light bleeding and self occlusion should never be a problem. Our system uses high res SDF data for tracing close to instances, ensuring rays never miss a surface.


    Render Showcase



    Using some primitives to 'probe' the AO and shadow receival.


    Plays well with other lights in the scene.


    With 'Mid Day' Lighting Factors


    With 'Late Day' Dawn/Dusk lighting factors.


    Renders Below Are Extremely Outdate; Information is correct though.


    Features
    Real Time Ray Traced Lighting Derived From SDF Data


    So just to show there's no cheating. ;) This would be the meat and potatoes. Meshes are converted to SDF's and baked into an atlas to be used for ray tracing against instances of that object present in the scene. A lower resolution clip is also maintained that is generated around the current rendering view port.

    DFAO utilizes both the clip map and the high resolution instance data for cone-tracing ambient occlusion into the scene. After the tracing passes finish, bent normals are derived from the traced cones averaged visibility and mix with the the scenes main light directional lights lighting pass. This is what Unreal refers to as 'Sky Occlusion', or essentially modifying the input normal when sampling

    DF Shadows exclusively cone trace against the instance data which ensures a high enough quality to be usable for production. They're extremely fast, tracing an entire terrains worth of objects direct light blocking into the view port faster then the built in cascaded shadow system.

    DF shadows are better when coupled with PCSS Shadows for handling details close to the camera, namely wind animated foliage and skin meshes. As of now the system will overlay the DF shadows with the results of Unitys making it easy to couple it with other shadow rendering systems available on the market currently. For PCSS support I would recommend NGSS personally.


    DFAO
    AO derived from instance SDF tracing, SDF clipmap tracing, and height map tracing.

    DFAO and Heightfield AO Composition

    Like the soft shadowing, DFAO and Heightfield AO both utilize ray tracing against SDF and Height field data to derive accurate, stable large radius AO in any scene.

    Currently like unreal, our system traces against both the full res volume data as well as a clipmap.

    The instance tracing would be akin to how one would expect RTX tracing to work, just with SDF volumes rather then BVH.

    The clip map tracing works roughly the same as other voxel GI setups, with the exception that rather then store voxels, we store distance field values instead.

    Like Unreal you can set up the instance tracing to only trace around a small object radius and then continue that trace against the clip map in a later pass, this makes things a lot cheaper to run with out compromising on appearance by much, if at all given how the distances tend to average the further an the source object being sampled is.

    Currently like unreal, we trace against the height map injected into the clip as well as against the heightmap itself as a substitute for high resolution instance volume data, so built in terrain is well supported.

    All of the AO passes also contribute to the generation of a bentnormals which are injected into the scenes main directional light pass and mixed with original screen space normals, replicating the effect Unreal Refers to as sky occlusion as well as specular occlusion.


    SDF Soft Shadows
    Soft Shadows Ray Traced From Instance SDF Data and Terrain Heightfield



    Shadows operate like unreal, where the softening is governed by a user defined light 'Cone Angle' parameter. On the right a low light angle is used keeping the shadows sharp, on the left a higher light angle is used softening the shadows.


    Supports thousands of meshes and 'infinite' range at a fraction of the cost of what traditional cascaded shadow mapping methods would incur. Shadows in this scene use around 4ms of a 1050 GTX)


    SDF Convertor And Rendering Tool

    I'm also including another package I was working on before. It's a fully feature mesh to SDF convertor with a bunch of volume rendering shaders. SDF baking also supports something unique, which I haven't seen, full color and UV baking support. All of the deer in the header image above with the exception of the one visibly wireframe'd are volume rendered using a bunch of different models ranging from legacy diffuse/specular, SSS variants of each as well as a standard rendering model built in.

    The convertor as well will handle any mesh and game object hierarchy with settings for every mesh as well as each sub mesh those meshes are composed of for converting your meshes to SDFs for the most optimal tracing of that object.


    Mesh Converter Supports Any Game Object Hierarchy and host of comprehensive settings for converting meshes to SDF

    I use a similar method as Unreal does for generating SDF versus the conventional shortest distance to the triangle test. This allows for supporting planer geometry and some really nice point clipping using asset/material alpha masks. It also gives a solid metric for determining the interior of a mesh vs not making SDFs from basically anything that I have thrown at. Houses like the one above composed of 200 gameobjects, trees, people, furniture, cars, etc.



    Some Shading Options as well as a debugging view for SDF Tweaking

    There's a quite bit more I could go over in regard to the SDF convertor itself, but I'm going to keep it short for now. Gist is though, for prepping your scene data for ray tracing this convertor should definitely have you have covered for that purpose explicitly with pretty minimal effort.






     
    Last edited: Dec 8, 2022
  2. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    632
    If these are your " starting images " WOW. I am unclear on one point only... can this be used for
    real time games ? or is this just for like ray tracing renders like " product shots " ?

    In any-case I like the images and I get the definite impression you know what your doing :)
    Good luck with this project, al-tho I don't think you need it ;)

    Luv the pic's, great work!
     
  3. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi!
    Will this support HDRP?
     
    AntonioModer likes this.
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Which render pipeline is this for?
    Is this Shadow/AO only?

    I heard Lumen uses the same data set to compute GI of all ranges.
    Screen Space for short & micro GI, SDF for low-mid ranged GI, and Voxel for long distance GI (Like the horizon and faraway terrains)

    You're just a few steps away, might as well go achieve Lumen before the 4000 engineers at UT does! :p
     
    Mark_01 likes this.
  5. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    I think this is more like a copy of SDF shadow tech from UE4 + some additional features. Though, the description is a bit ambiguous. I've read it twice and still don't fully understand what exactly will this asset do when it's released:)
     
  6. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41

    Thanks! It's all real time. No baking aside from the instance SDF it self. Like for every model in your scene ull need to bake an SDF to represent it. (1 SDF can be used for all references of that model in the scene)

    It's designed with real time gaming in mind. I run it and develop it mainly on a 1050 gtx mobile GPU. the scene with shadows avgs around 2.3 million polys per frame and I'm managing 50-70 fps with more leg room for optimizing. That would be with all the effects on, Heightfield ray tracing for shadows and AO, SDF raytracing for shadows and AO as well. Generally the soft shadows are faster actually then the cascaded shadow mapper that's built into Unity by default, the AO is a lil more impactful given it fires 9 rays per pixel. Ill get some stats soon, i dont want to jump the gun and do benches 50 times though given I know theirs some obvious optimization I should do first. But yah it's definitely real time. :)

    At the moment is just shadows and AO. :)

    Yah, for half of it's functionality Lumen does use Distance Fields for ray tracing in software. I'm actually planning to implement all of the software stuff they're doing. Just don't want to bite off more then I can chew until I get something out. You're right though saying it would be a few steps at this point. I could do bounce indirect easy, reflections even easier. I might even mess with reflections given it's sooo trivial. But the bounce stuff, i was gonna approach it similar and use number of techniques. Screen space, Heightfield and distance field along with RSM as an option, kind of adding on as I go.

    We're planning to support HDRP but there is still more work to be done there which Im getting to as I move this into an HDRP supported scene that's prettier. But HDRP for sure, that's personally why I wanted this, lol.

    Yah, I'm going to try and clarify a bit more. Umm it is UE4 DFAO and DF Shadows. So it's all ray traced in real-time and it utilizes baked distance field data stored in a scene atlas file. It supports all terrains and instances in a scene. The work flow would be similar to how unreal manages this as well as the AO and light shadow settings.

    I am planning do to most, if not all of what's covered in the Lumen software ray tracing bits which utilizes distance field sfrom what I gathered. Like bounced indirect and reflections should be trivial to account for and I do have color support for converted objects to SDF with these two things in mind.
     
  7. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    632
    I have not been this excited by a new asset in a long time ... but this... man..
    You could end up pulling back people from UE4 with your plans here.

    The future looks exciting again :) Real time, real quality .... yes!
     
  8. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    o_O did you single handedly solve one of the biggest limitations for rendering run-time/dynamic scenes in Unity?

    Funnily enough this is a topic that seems to have been coming up a lot lately - there's definitely a lot of projects that would really benefit from this. Is there any way to support you during development?
     
    SirTwistedStorm and LudiKha like this.
  9. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    Amazing work! If there's a need for beta testing, we'd be happy to sign up for it!
     
  10. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Its normal that "Modders" community does better job than devs themself....Cyberpunk, Skyrim, Unity.

    I am impressed, will gladly pay good money for production system :)
     
  11. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    It's a real shame with Nanite coming in UE5 I can't bring myself to pursue realistic graphics in Unity anymore because this looks really dang good. Great to have it as an option though. I had actually experimented with implementing SDF shadows/reflections in Unity myself a while back but this blows my experiment out of the water lol.
     
    Mark_01 likes this.
  12. Arycama

    Arycama

    Joined:
    May 25, 2014
    Posts:
    184
    Looks impressive. Does the scene-SDF have to be baked in editor, or can it be generated/updated at runtime? (Eg to support dynamic scene changes or objects being added/removed)

    What kind of resolution/memory cost is required for the SDF of a large scene?

    It would be neat if this is a modular system that can be easily plugged into custom Render Pipelines via command buffers.
     
  13. scarletslavi

    scarletslavi

    Joined:
    Jul 7, 2019
    Posts:
    8
    I know, nanite and lumen makes the switch to Unreal so much more compelling. I just don't see either feature ever getting implemented for Unity as it would have to be by individuals making the asset. Tho this asset makes a valiant attempt at implementing the distance field features they had in UE4. Maybe sometime down the line someone will create global distance fields to do lumen like GI idk.
     
    Mark_01 and SuperDrZee like this.
  14. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    I have a huge update.

    Over the weekend before heading back home I set up the global SDF, added bent normal support and added in some stuff to take advantage of global SDF data.



    I got the Global SDF baking working in realtime, clip maps follow the camera. I set up most of the culling and stuff compute wise for updating the clips efficiently. As of now though im just brute forcing the entire clip when the cam moves which is surprisingly responsive. I need to take advantage of wrap addresses though to manage the updates properly and will properly hold off on that while i polish the AO effects now. Which look alot better.



    I also added some tests to my pixel culling stuff to hopefully cull out more instance cone tracing rays and focus those on the Global SDF data and got a much better pixel culling system in place. Not that anyone cares about this though lol, kind of proud i got this set up. It was a real SOB.



    Got some bent normals coming at yaaa to, all my ao tests use the same rays, like unreal for any given pixel and then once all the ao is calculated the rays are converged and we generate a bent normal. Ive really wanted this for awhile personally so, really happy to say im pretty much wrapping up the entire algo as far as it was outlined with these additions. I should be able to get these alooot cleaner but not bad for now.

    So with all of this, we're getting alot nicer AO. I have to fix a few things with the global tracing but, yaaaah. Im pretty intimate with unreal, and i think im there now in regards having what i need to meet the quality they deliver, just need to polish my mathz now, lol. I do alot of things differently in terms of converting between spaces, but i follow a very similar execution order for each effect, cull instances to screen/volume, cull instances to pixels, trace pixels/sample, etc kind of thing. So hoping this will be not half assed attempt but the entire algo they initially presented completed.

    And last but not least



    So now that i have the global SDF working, getting sooooo much nice AO. i could cryyy lol. Still some biasing issues but yaaaaaaah. Im gonna have to redo the entire main post which makes me sad. I know once i sort out the global sdf trace, this will look ten times better. Im also not using any screen space AO here, pushing the instance cone tracing towards high frquancy stuff is really bring out the small details.

    Anyways, i have recruited someone to help out, their going to focus mainly on bounce GI integrating other effects into system as well as preparing and polishing everything for release.

    Would also like to apologize had a bit of a hectic week with some personal stuff and a whole lot of work to catch up on yesterday. This weekend i plan to sit down and finalize the ao calcs and clean the global sdf stuff, so i figure by monday i should have the entire main post re-done to reflect where the system is at now. I sort of jumped the gun and should have waited. I spent alot of time trying to understand the instance tracing bits of the system as that to me just seem crazy impossible when i first looked at this so when i got that working I was a lil to pumped to post my results lol.

    Anyways, the response has been pretty amazing! Thanks everyone for the support. I really hope we can deliver something to fill a major need in this community. I love Unity, Unity taught me how to program like i have bias towards this community that pushed me to set this up vs just jumping ship. But i mean that's also what i love about unity. I have yet to find a task that I cant accomplish with this engine super conveniently. And I mean this was alot of fun to set up. Anyways thanks again, and thank you Unity, lol. I'd be nothing without you. <3
     
    Last edited: Aug 20, 2021
  15. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Hey man,

    I actually did the global SDF this weekend and it's pretty similar to how unreal handles it. Like culling for optimal updates, injects heights and SDF instances in realtimes, no baking.

    I would need to add support for moving objects. Which is super doable, just not sure if i would i would manage to get that in first release. So the alternative would be that objects like cars and stuff would use the cone tracing against the SDF isntance data store in the atlas, the highest quality stuff, and just wouldnt be account for in the global sdf trace bits to start. I think unreal has an option like this where u can say u want to ignore fast moving obejcts to avoid having to freuantly track and update the global sdf clips.

    I should also mention the costs are not crazy

    I use 4 clips in my clip map like unreal at 128^3 rhalf format and then 500^3 SDF atlas thing. U can adjust that atlas though. And the resolutions are referring to 3D textures. So the scene would use one chunk of the Atlas for cone tracing high frequancy AO, then it falls back to the clip maps which is like a big baked version of all the SDFs.

    Its funny that u mention that command buffer thing, the whole system is utilizing them now. I need them for injecting shadows and also generating and overriding screen space normals with the bent ones so Im hoping getting it working with hdrp and the srp will be not to hard, though i kind of read some sads about overriding the screen space normals and i hope i can still mess with the screen space shadow mask. Ive been doing alot of work with the builtin old school stuff on account of work at the studio that employs me and havent had much time with any of the new pipelines since they we're first released, so thats gonna be fun... lol But yah, ive switched the code from manually blitting to rts to doing it from command buffers and its trivial to get that going either way, just hoping it doesnt get hacky with normals and shadow overriding.
     
    Last edited: Aug 20, 2021
    SirTwistedStorm and one_one like this.
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I like all the stuff you are doing!
     
    SirTwistedStorm and SuperDrZee like this.
  17. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Yah, I kind of cry when I look at just anything unreal. They have megascans, we have robot kyle..... Kind of hoping to bridge a gap here though. I dont think ill ever be able to compete with epic whole team of engineers but I got another guy coming on board whos good a graphics stuff and plan is to focus on more general GI now that all the core functionality is in place. Like we could do bounce GI against the SDF pretty easy now tweaking the AO stuff, just need a really good light blocker metric for figuring out what pixels are receiving direct light which i really wanted to give alot of love cause that would make alot of things possible on it's own. But yah, I will say i am going to work towards Lumen distance field stuff like unreal, just its alot to bite off to commit to that as well right now.

    I hate how tempting it is though, for bounce lighting it would take like a week to get something going. Reflections would be really easy to, especially on the global SDF now thats in place and im already tracing from it fine.
     
  18. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Just wanted to give a quick update. Been waiting awhile to have everything working efficiently enough to focus on my AO generation. It wasn't bad-ish before but it was sort of place holder with the intent on tweaking the calcs there after all the SDF management, culling and I guess now the clip map is done.

    Anyways messed around this morning, and I mean it's ao so got it working prettty good. Id say im basically done that part, everything is nice and smooth and the global SDF helps alooooot. Just a few screen where it's at now. I find it's miles better personally.







    I also got bent normals looking pretty nice, it's pretty cool what they do for the actual lighting calcs done by unity. Like take this point like in a forest for example.

    The top image has the bent normals turned off. It's pretty apparent that the light does not care that are trees blocking it's path to surrounding objects. With them on though you get some nice light blockage for essentially free. So it's not just toning them out it out naively using the AO magnitude calculated by the ray trace, it's also adjusting the screen space normals to account for how surrounding objects would block light as well and using this when handling the differed lighting stuff.

    I also made a short video of the all the effects in action pretty quick. Nothing special but figured something with directional light changing would show off everything together half a**'d pretty well. Been extremely busy on my end as a of late.



    I personally love the shadow fading coming off mountains in the distance. That alone always makes me sooo happy. All objects use DF shadows cone traced against the instance, so shadows dont use the global SDF at all and should never need to. They run at like 1.3 ms even when viewing the entire terrain in the viewport.

    The AO is on for the heightfield, instance cone tracing and global distance field, could have messed with the lighting and settings a bit better, but anywhoooo. Hope you guys enjoy ! <3

    Edit; Dont mind the fidgetty-ness in the video. Capture software sucks and i was using a mouse pad lol.
     
  19. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Those bent normals are tasty.
     
  20. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Got some big updates!

    Been cleaning the code in my spare time and there's been some issues AO calcs admittedly. So I set out to fix that. I ended making a debugging shader where i could teach each effect isolated to a single instance. After which I ended up looking on shader toy because that what you do, and came across the popular SDF cone tracing example.

    Turns out it's the same code Unreal actually uses with the exception that they use a different falloff/distance fade metric. Not that anything fancy but yah, so this set up reallllly line up with unreal now in a not ethnically bad way. Just all using the same code here... from shader toy! But yah after debugging I found issues with some scaling and conversion between spaces causing artifacts and then baaam!



    That unreal AO...... :') After getting this done i then applied to the global / clip map data tracing and the instance cone tracing and we're looking alot better! :) I also redid the heightfield AO and thats waaaaay better.

    I knew i was gonna need this to, so while cleaning on a whim i set up a bunch of crap to get more heightfield/terrain data and made a super super big blocker texture! and light map! lol. :D



    Unreal does something totally differnt for heightfield GI. I ended up applying RSM inside the heightfield texture space and got some really sick results though, which ill definetly be including!



    I really enjoy this effect, soooo simple yet soo satisfying... I set pretty intense intense on purpose, haha. U can def play around with that to find the sweet spot though.




    So now the AO effects math wise are complete, Shadows are complete in all shapes and forms. 90 percent of the system has been cleaned up. Whats needed for something more like unreals height-field GI and a good chunk of their new SDF tracing stuff, like the indirect lighting would be really simple to manage, i could probably do it in a weekend that how simple it would be now given the light map stuff is really what was holding that back. The main focus as of now though is getting the down sampling and upscaling back in for the AO. Doing a final clean up and getting to people to test and mess around with.

    I'm really going to need to update the entire main post now.. But yah, defo at the quality id want. It's nice to know as well im sourcing the same cone tracing stuff as unreal as well. That should ensure the lighting is pretty close even for a one man job like this system has been. I also think Im going to focus on adding hard ware ray tracing after the initial release as a big focus. I think in the two weeks id need to get this close to release I could have GI from the clipmap and instance cone tracing working which would cover all the software ray tracing bits unreal covers.

    Anyways quality has gotten really better. I put way to much emphasis on setting up all the data versus actually tracing some results with it i guess, haha.

    Also had a bit of a long week. A little later today, ill take time to properly respond to everyones posts and DMs.
     
  21. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Not sure if this is actually the case, but in your last image it seems like the GI isn't respecting the normal map on the tree. Or perhaps it is but it's not granular enough to notice?
    upload_2021-8-26_19-9-37.png
     
  22. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41

    There's actually a bunch of issues with that.

    It uses the bent normals derived from the AO which is what's causing what ur seeing. I still need work on denoising / and filtering for the bent normals specifically. As off now I'm just using bilateral blur and some spatial filtering and basic temporal reprojection as a place holder. So the normals on surfaces get smoothed to crap atm. I should also be taking the AO factor on screen and adjusting the lighting as well. I also need to account for unitys ambient light factor better. It was a really quick toss together, lol. Given I set up all the data generation and wrote the effect up in 4 hours I thought it looked alright, lmaoo.

    Good eye though. ;) I'm not going to put to much attention on the bounce lighting at the moment, but I figure once I get nice filtering for the AO in place relatively soon, those issues u pointed out won't be apparent. Could actually eliminate then all together by just using the normals in the Gbuffer already. But ya, indirect lighting is def a work in progress still, haha. '^^
     
    one_one, GuitarBro and Mark_01 like this.
  23. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Is it possible to bake SDF data on objects made of multiple modular pieces such as this one?
    upload_2021-8-28_1-9-39.png
    As you can see, the building is constructed from flat planes.
     
  24. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Ok cool, was just curious. Good to know it's not a fundamental limitation. I've been looking at realtime GI solutions for like, 6 years(?) now and whenever something new presents itself I'm immediately interested lol.
     
  25. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41


    Yah, it is! At the moment u just whip any game object into the source gameobejct field in the converter, then hit the generate distance field button after tweaking the scale and offsets if needed. It does a pretty good job of figuring out most meshes inside really complicated game-object hierarchies.


    So fast update, im basically settled now and will be around a lot more to anwser questions and what not. I finished most of the clean up this weekend and the stuff thats holding me back from getting this out to testers. So hoping in a week-ish I can start getting this out to people and give this thing one last round of polish before submitting for publishing.

    So I ended up opening pandoras box so to speak. I was curious what unreal was doing exactly so I looked a lil deeper at the source. It turns out the bent normals are for adjusting skylight stuff. I was under the impression they were more akin to unigines screen space gi's deal. So sorry for the naivety, i think i can support something still more like i would be interested in though but ill save that.

    But ya, It looks like unreal actually down samples at 1/4 res then upsamples to full which is mind boggling... Anyways I think i ended up with something a lil better then UE4 unintentionally. (Posted UE4 DFAO shot for comparison at the bottom)


    So i put in a new set off filter built from the ground up. This was always my weak point so sort of strapped up over the weekend and experimented quite a bit. I ended up with 90% of SVGF. The re-projecting and variance calcs are done the wavelet filter works for the most part, just having a bit of a time actually using the variance to adjust the blur. For this i actually thing SVGF is too much for, but nvidea's reprojection bit is pretty awesome so ill probably set something up that's less GPU intensive for denoising this stuff specifically with that, but it should open doors to redux ray counts introduce interleaved rendering for more ray count reducing. I unno. For w.e reason i have a feeling this is more the direction UE5 is going with SDF and i figure it would probably be worth my efforts to follow suit. Also runs surprisingly well.. the blur costs more then the AO tracing... lol.


    Unity DFAO
    So just for the sake of comparison; Here's a good look at the AO now; All ray traced in unity. I def need to work on my edge avoid metric to get the trees to blur a lil less but it's alooooot better then anything ive posted prior.




    Unreal Engine DFAO
    And here's UE4; I tried to find a terrain / forest scene thing. And yaaah. Anyways, think im solid enough to release this. Was having anxiety about my map magic terrain not looking like the UE4 kite engine demo and i guess i went to far with this in the end... oh well haha.

    Not sure how relevant this is but, i think ill probably focus on hardware ray tracing and indirect lighting / reflections via SDF shortly after publishing this. If SVGF works out well enough, could really do a lot easily. I also think i can adjust the AO calcs to works to alot like SEGIs to sort of handle the indirect and AO stuff cumulatively. I think i can pack the colors as well so the cost to sample SDF data would be basically the same.. Anyways future looks bright!! :)

    Probably gonna redo the entire main post again and really finalize that throughout the week; If anyone is interested in testing this stuff, send me a DM, im looking for around 10-20 people working in a variety of scenes. Specifically standard rendering for the moment. HDR can be supported but I'm holding off before opening that can of worms until I have something out there before this snow balls into "just one more feature!" oblivion. I know HDR is pretty important, but this is gonna take some TLC so i figure I can probably have HDR and support for bounce lighting and reflections a month or two after the initial release and that's gonna be the focus unless something more demanding comes along.

    Anywhooo, stuff looking alot better. Codes alot cleaner.. I tied most of the lil loose ends and should be able to manage the rest of em through out this week. Just wanted to say basically wrapping up, haha. And i think all the ground unreal covered aside from messing with ambient calcs and stuff has been covered; Clip map, Instance Cone Tracing, and Height field Derived AO and Instance Cone Traced DF Soft Shadows.
     
    Last edited: Sep 6, 2021
  26. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    hello sir
    looks really nice !!!
    will you make public properties we can access for custom shaders ?
     
  27. Kevin-VFX

    Kevin-VFX

    Joined:
    Apr 17, 2016
    Posts:
    54
    Wow, this is looking nice. I was playing with implementing a SDF AO solution, but I would rather use an asset that's already done if that's an option. We are targeting VR platforms using a URP spinoff. Any idea if you plan to support a forward based pipeline or at least have a custom buffer mode?
     
  28. knxrb

    knxrb

    Joined:
    Dec 16, 2018
    Posts:
    21
    Any updates please? This looks really interesting and it would be a shame to see it abandoned!
     
  29. MateuszEX

    MateuszEX

    Joined:
    Dec 4, 2018
    Posts:
    2
    Did this really end like anything else, is it really next dead project?
     
  30. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    It's only been a few weeks since the last update - have some patience, developing assets takes time.
     
    QGGameDesign, knxrb and one_one like this.
  31. cowj

    cowj

    Joined:
    Mar 10, 2019
    Posts:
    17
    really waiting for it
     
  32. MateuszEX

    MateuszEX

    Joined:
    Dec 4, 2018
    Posts:
    2
    its realy dead, isnt it?
     
  33. NoxityGames

    NoxityGames

    Joined:
    Jul 1, 2018
    Posts:
    36
    Any updates on this ?
     
  34. MrHat

    MrHat

    Joined:
    Jan 12, 2014
    Posts:
    4
    Looking forward to this one. Good things take time!
     
  35. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    Just a heads-up.. I am NOT saying with this dev, I have been around
    Unity since 5. One pattern I have found is a DEV that does this and
    does not log in for months at a time.

    IF* the asset is ever released, chances are it will either not be kept up,
    or deprecated in a year or 2.
    Just saying careful on this one.
     
  36. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41


    Hey Everyone,

    I just wanted to give an update and apologize for going AFK forever.

    The response was also a lot more overwhelming then I had initially expected and I tend to Sean Murray / no man's sky under any public pressure admittedly so I apologize for that as well. In other words my ambition can get the best of me at times.

    Kennth's observation is very valid.

    It's easy for things like this to slip off to the side and dissolve into vapor-ware dealing with the day to day realities of work, personal life, etc. The road to hell is paved with good intentions and the logistics to manage something this big can be insane especially if you occupy a full time senior position for a third party, lol...

    I had ended a 4 year contract to work on a pretty time demanding project in November of 2021 and just needed a break from computers in general after it for a number of reasons.

    As of now and throughout most of the winter I've been organizing my own start up and have been actively updating the code base for the past few weeks integrating and modifying this system in it, as well as migrating the lighting system itself to work with SRP stuffz (finally) and thought it might be worth giving an update on the project as whole.

    As of now I'm hoping to get it stable, tie off loose ends and get it to a point where it wouldn't be so daunting to realistically attempt to release this either commercially or for free on github or w.e. In either case I do intend to release the code in some capacity, what direction ill be going I'm still feeling out at the moment.

    So in vein of anyone expectations I will say I'll be taking this slow and more humbly from here. It's not so bad to manage something that's complete but in it's current state it is hard to estimate as to when something will be done or make any promises in general in regards to releasing it.

    Anyways, main reason for posting this aside from giving an update on the current state of this; Tomorrow, ill be setting up a discord server for managing a number of personal projects. I'm planning to make the code base public from with-in a testing channel on there. Anyone can join it. PM me and we can discuss testing channel access to gain access to the files and what now if you're feeling brave/ambitious enough to mess around with it in it's current state.

    Ill update the main thread post with the discord server details when it's all set up tomorrow.

    Cheers and thank you to everyone who did support the idea of unreal-ish lighting procedures in unity 3D.

    Regards,

    SuperDrZee
     
  37. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    595
  38. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
  39. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Big Update

    So ya I opened the code base back in march and was reminded of why i was hesitantly to confidently say, 'This is something I can realistically manage'. pretty fast, lol.
    In that regard though, I decided to just keep my mouth S*** and I ended up spending most of the spring fixing up/cleaning up the system and I am personally happy to say I will be pursuing developing this at a full time capacity and I have just finished the first stable version that can be tested and I'm looking to get things going again.
    I've started a server to streamline testing, inquiries and other stuff related to the project.

    https://discord.gg/c74977m2aJ

    Over the next week i'll be assembling a small-ish test group of around 20 or so users. If you would like to be a part of this, join the server and PM me, the owner directly with details about your hardware an your target rendering API / unity rendering set-up.

    Through out the evening I'll be editing the main article to reflect all the changes as well. The quality of the effects is about 1000 times better. (No exaggeration, those nasty precession errors.) The cost to run these effects has been optimized like crazy. I'm basically at where unreal is now in terms of rendering costs. Big things anyways.
    Lastly, I would like to apologize again. To be frank; OH boy was this a messy start. I will say now I'm looking at this like a blank slate, the code actually works with no rubber bands er band aids, my life isn't imploding and I can say to myself that I have the time to manage and support this.

    With that said, I will be having my partner help me with managing the unity forum stuff, so nothing gets missed. I will also be taking sometime this evening to finally PM each every one of you, whos contacted me in the past. It was a little overwhelming having to respond to the same msgs 100 times, saying 'just give me a couple months', but yah, ill be making sure everyone gets a link to the discord and a proper opportunity to discuss testing in a more streamlined fashion.

    I will say as well, if you want to get ahold of me, discord would be the place to do it, if your looking for an immediate response. I'm on there 12+ hours days, even on weekends and would be my preferred method of contact.
    Anyways, system as far as the baseline for a release goes is done!! Sorry again for being an asshole, I honestly didn't think last winter it would ever make it here though, and i really want to make sure my S*** was completely together before promising anything ever again.

    So let this post serve ultimately as my way of saying, i'm taking on supporting this and potentially other products as a full time gig vs trying to boot strap it with my head cut off. Hopefully with that, and over a little time I can offer some assurances in terms of my abilities to support and manage this.
    Anyways, can't wait to show off where it's at now. Everything looks sooo much better.
     
    one_one, ftejada, Vincent454 and 8 others like this.
  40. pwka

    pwka

    Joined:
    Sep 19, 2012
    Posts:
    49
    How does it compare to native unity shadows in terms of performance and visual quality? I would love to see some stats and pictures. I would be interested in testing this, but I am locked into the HDRP project currently. Soft, performant shadows is what our project needs the most. Cheers!
     
  41. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Just thought id post a quick tease, the error that was hiding was making things really black before, now it tones how unreal does, alot has changed since then, so lot to ive into there, but yah, i find personally it look alot more how you'd expect AO to modulate.






     
    knxrb, Vincent454, florianBrn and 2 others like this.
  42. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    180
    Man, the AO in the leaves looks so nice.
     
  43. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Hey!

    They perform actually a lot faster then unity shadows. I have the range set to 4000 metre's in all my screen shots and it takes roughly between 3-4ms for the entire process. So everything gets shadows... like everything on screen. There's a few other process you could probably take advantage of as well, once you hit obscene distances you can alos optionally knock back to just do a soft shadow screen space trace against the depth buffer for the realllly far away miniscule stuff.

    The shadows are actually really stable, the nice thing is they ray trace in screen space. I'm actually out the door, heading to a bbq thing, but i'd love to detail the shadows as well as some profiling comparisons between the unity shadow mapping process and my own when I get in for you. :)
     
    pwka and GuitarBro like this.
  44. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    Thank you! :')

    It's sooo nice to hear that after that many battles I had with this thing...
     
  45. pwka

    pwka

    Joined:
    Sep 19, 2012
    Posts:
    49
    This is super impressive! Congrats! People like you are what makes Unity great :) I would love to test this in different scenes and lighting scenarios.
    Have you thought about pricing?
     
  46. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41
    I'm planning to offer the asset at around $60 USD. I personally have a have a hard time swallowing a price tag that's in the hundreds so I want to keep it as accessible as possible. I also hate having to shell out three times for a complete product.

    If you buy this kit, you get everything for a one time price some where around $60.

    Also in regards to your shadow questions;


    All the shadows are calculated at the moment where I have highlighted on my end;

    In-regards to your performance question, I have the DF shadows range set to basically the entire map or 4000 units, the terrain is 2 x 2 km long, so there's always a 2000 overlap thing that actually makes the performance worse now that i think about it lol. I should make the bounds a little more adaptive on that note;

    But yah, the unity shadows are set to render at a distance of 150 units / metre(s).

    I should have grabbed a shot showing how far unity is drawing it's shadows too, but e.i it's not very far. The DF shadows are rendered over the unity shadows as well, so nothing is culled in that regard so all shadows are traced from DFs.

    It varies like unity however, the more objects casting into the current screen space, the higher the cost, but yah basically for infinite range vs 150 m(s), I think things stand well in the DF shadows favor.

    I'll be optimizing the culling as well a lil further too to do another screen space pass thing that should bring the instance tracing costs down further as well, so that should only get better in the long run. :)



    And in regards to quality, you can mess with that, I do 32 samples against any instance, i find 10 even works though to get similar results.

    I did a lot of work to the shadows this spring, still have a lil up-sampling work, but under the surface they work very similar to how Unreals do, I took a lot of time to become intimate with the maths as well as the origins of the procedures they use among other things. So there's a 'light angle' parameter for the main skylight/directional light you can use to mess with all of this that should replicate the work flow you'd expect coming from unreal.

    I should also mention that really, the DF shadows should be used to handle the mid to long range shading, and you should use a pcss kit for anything close to the camera, that is if you want to support skinned meshes an vertex animated foilage or anything.

    Unreal does this as well, so trees blowing in the wind don't have static shadows for instance.

    I imagine this would push the costs own even further for the DF tracing, so it's definitly expansive.

    I'll also put this out there, I've been building this on a potatoe.

    I'm using a 1050 gtx mobile version to boot. To give an idea of how crappy this, a ps5 is around 6 times faster, lol.
     
    Last edited: Jul 17, 2022
    knxrb, pwka, mgear and 2 others like this.
  47. SuperDrZee

    SuperDrZee

    Joined:
    Aug 12, 2021
    Posts:
    41


    I ended up taking a look at the shadow culling stuff, and yah something didn't add up. I adjusted how it generates the bounds, and managed to get a massive speed up. Highest I've seen it go is 5 ms.

    I can push this probably a bunch further but yah I think this was the last biggish loose end with the shadows I wanted to address.

    So it's all editor, docs and a brief testing period from here. :)

    Thought Id try and line up with the first shot I posted;



    I lined up my view port to roughly to where it was before, same with the light angle and I'm definitely getting better numbers my laptop is probably so happy you got my looking at this, haha. It's hard to explain, but yah I should be able to push this down even further.

    So it should be miles faster then rendering the scene a bunch of times to shadow maps.

    Unity is at 7.5 for 150 draw distance for comparison.



    I also managed to get the upscaling for the shadows working right, so gonna say shadows are complete across the board. There was some gridding u could sort of see before, now it's lookin 'Unreal' ;)
     
    Last edited: Jul 17, 2022
    PutridEx, one_one, knxrb and 7 others like this.
  48. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sucks the laptop can't be used to grill food on any more.
     
  49. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    Looks really nice!
     
  50. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Hey, love your work mate, but I've noticed that your example scene is always super dark + the AO is turned up too high (my guess is that you are exaggerating it to show it right?) Reminds me of Dayz but I wanted to see it in more standard bright scene. So, while I wait for this asset to be ready, figured I might just add some photoshop mock ups. I used your previously uploaded image. I only changed exposure and gamma + I invert masked shadows to simulate AO color - u do support it right? The vibrance and some colors went off a bit...but good enough mock up for me :)

    I was thinking, if AO color can be used from a pixel below and blur filtered (color wise) to achieve a smooth AO look.
    adjusted.png