Deferred Engine Playground - download

Reconstruct depth before (on the rt that you draw to)

thanks, but light pre-pass demo render twice 2 for opaqe material. G-buffer = > reconstruct shading , it actually consume alot of fps.

If you use prepass you can reconstruct depth anyways for the second pass and use Depthcomparison Equal, if you have high enough precision.

But reconstructing depth alone shouldn’t be super expensive, it’s cheaper in the long run than to compare each pixel against the depth map.

Anyways this thread is not about random questions, make a new thread for that

Sry for that, i tot this thread is related to deferred rendering and somemore your r more expert on this area.

Hi @kosmonautgames, Is it possible to add HDR Rendering and SoftShadow implementation into this Engine.

If it is then please let me know where to begin?


HDR rendering is more or less in, with the latest commit there is a tonemapping operation in the postprocess.fx

Soft shadows are in for directional lights as far as I’m aware, but they have some artifacts due to the way monogame breaks the texture samplers, that’s why I didn’t feel encouraged to make them available for point lights, too.

If you want point light soft shadows you would have to change up the deferredpointlight.fx

here is the article to improve the point light soft shadow, hope it help :slight_smile:!Advanced-Lighting/Shadows/Point-Shadows

funny you should mention that because i implemented exactly those half an hour or so ago.

Check out the newest version on git

1 Like

xD i just found this article…

I’ve improved the editor experience quite a bit.
The rotation now works correctly (as it should) when pressing r. Plus the selection and outlining is better.

I have added tools to easily manipulate lights in realtime, too. And you can drag around the environment probe like you can a light.

I’ve also added optional blur on the Screen Space Reflections and added a some tone map operators for post processing.


Nice progress! :slight_smile:

Wish those things would also work that good in my renderer :sweat_smile:

Hi @kosmonautgames, I have downloaded the latest version and tested it, This is so good and Thanks.

1 Like

@11110, Thanks for sharing.

I’ve added a slider for “shadow softness” to have nice soft shadows. (There are some seam artifacts at the edges of the cubemap, but I’ll fix them at some point)

This can create very very soft shadows at a high expense, but sometimes one just cares about quality.

For that I made some crazy changes where I manually generate a texture atlas instead of a texture cube and made custom sampling shader code (not done for all directions yet).


is the directional light work?

is the directional light work?


nice, i saw there is unused spotlight shader in ur project. does it work as will?

OMG! :astonished: This is what I have been looking for long time… Thanks a lot @kosmonautgames. Great work!

I have downloaded and checked the latest checkout with SoftShadows. It looks awesome! But takes lot of processing time if I increase the samples. Is there anyway to optimize this?
Now I am going to check with animated objects and see how it works.

BTW, did you change anything with HDR to increase to illuminate the entire Sponza model or its just coming from Environment mapping?

Thanks and Regards,

I’ve added 2 blue lights on top :joy:

That said the whole environment mapping etc. is totally unplausible right now, I’ve changed some stuff somewhere and now the values don’t match at all. I’ll give it another pass tonight or tomorrow. I think the main issue lays in the fact that I moved the gamma space conversion to post processing and now some parts are left in wrong gamma.

Maybe a bit, but it will never be cheap. You can use smaller shadow maps, this will make the blur effect bigger / cheaper but you might see some shadow aliasing artifacts if you go too low. Try 512.

All values >4 are actually crazy compared to what normal games have to work with. I am thinking about other ways to blur shadows, but it’s a difficult topic in general, that’s why games usually don’t have very soft shadows on small geometry.

There is another way to have soft shadow mapping with “Virtual Shadow Maps” - and I’ve used them before, as you can see in the screen shot above. These are cheap soft shadows, but I couldn’t use them for point lights, so I’ve dropped them (In the shot above I still had spot lights). I may look into reenabling them.

That said VSMs have their own set of problems. They are very soft, but sometimes light will “leak” through objects.