Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin

Shadow and clamp range


pervokpetr

Recommended Posts

Posted: November 08, 2017

Shadow calculations presize depends from lighting range value and near/far ratio. Near parameter affect shadows presize more than other, small near value greatly degrade shadow presize, but offtenly we can't use bigger value, because we close to some object and big near value produce lighting clamp on this object. The second parameter - range/far value, are calculated automatically in depends from light intensity (physically based) and we have not control on it, and we can have such situation like on screen below.
image.png.adb3499fe704e3cc5274a4b2aa1d677f.png
So I implemented parameter for spot and omni lights - clamp_range. This parameter allow to reduce actual far range. If this parameter 0 (zero) then full(calculated from intensity) range will be used, if this parameter greater than 0, then it will be used to clamp lighting range. This will allow reduce range for shadow calculations and increase shadow presize.

Rendering process
Analizing rendering process (with GPU profile) you can see that shadow rendering take more GPU times than other processes. On image below you can see why this is happen - shadow rendering has much more simple pixel shaders, but it performed several times  in one frame, to render targets with much more resolution.
image.png.559359c61bab5565b6565342d9299222.png
So my thoughts was - If I implement Multithreaded rendering to perform all shadows calculations/rendering in multiple threads I will got fps gain....

EPIC FAIL and how to cook it
https://drive.google.com/open?id=1OqLPHS38-kXMKi1pYHV807rjmF1J0IWh
This scene contain 3 spot lights, 1 omni lights and sun lights enabled - overall 13 shadow splits that should be prepared each frame before main render pass will be executed, all this 13 shadow renders distributed to MaxThreads threads amount (2...16). All process working as intended and change shadow splits/threads ratio dynamically. As you can see MTR works and it gives about 10% of performance. BUT....
When I recompiled project to release version gpuprofile show me that MTR do not gives any fps improvements - nothing, NOTHING, N-O-T-H-I-N-G.  http://modsgarden.cc/Smileys/clabicons/eek.gifhttp://modsgarden.cc/Smileys/clabicons/cry.gif. I have only one explanation for it - MTR allow optimize only cpu time wasting, actual rendering still performed on GPU consistently, but seems release compiling with enabled compiler optimizations already optimized all hook cpu operations well and MTR do not gives any further improvements. Moreover with MTR enable Hairworks module crash everytime when I try to render hair, I wrote to nvidia about this issue, but still get no answer  http://modsgarden.cc/Smileys/clabicons/nah.gif and seems will never get.
For now I leave opportunity to on/off MTR, to you can see how it will work on your PC (who knows maybe...) and if MTR will be "on" - hairworks shadows will be disabled to avoid app crash.

Screen Space Local Reflections
While I waited nvidia answer I somehow did first implementaiton of SSLR effect, it not fully correct for now and required some optimizations and additional work. Main thing that you should know about it - it has two significant flaws - 1. reflections with this method limited by screen itself i.e. we can't get reflections of objects that outside of screen, 2. it has halo from overlapping objects. This flaws can not be eliminated, maybe reduced somehow but I need more experiments to find how it can be done. Also this method has a good thing - animated textures will be reflected accordingly - you can check it in StripClub room (with my hook5 textues)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.