dsman Posted May 26, 2016 Share Posted May 26, 2016 (This post is continuation of earlier post : http://www.html5gamedevs.com/topic/22734-lighting-how-achieve-this-kind-of-result-from-lighting ) There are many issues with SSAO. 1. It adds lots of aliasing on edges. Not sure how to get rid of this. 2. It reduces FPS to 30-40 . Our scene is static. (Even camera position is going to be static. It will just arc-rotate ). Is there any way it can not to calculate it every frame ? 3. There are some shadow-like effect. So the way we rotate camera some lighter and darker areas change. ( Rotation view 1 : http://prntscr.com/b8lxmf , Rotation view 2 : http://prntscr.com/b8lyuc ) 4. I had been tweaking SSAO setting for hours and hours. But unable to get the perfect result. Either it is too blur or it shows too much of noise and grain in whole screen and draws some glow/shadow areas on entire plane surface (like shown in #3 ) In all screenshot above, the scene doesn't have any light. All meshes are given emissive color. Quote Link to comment Share on other sites More sharing options...
dsman Posted May 26, 2016 Author Share Posted May 26, 2016 Also why is SSAO so slow ? Potential frame rate without SSAO is 200 something. My scene/model is very light. Adding so many lights or shadow , PBR and reflections isn't dropping frame rate much. But as soon as you add SSAO , no matter what setting it drops to 30-40 even on a desktop with decent GPU (Nvidia GT 7xx 1 GB) . The application made with threejs , screenshot of which I mentioned in earlier post ( http://www.html5gamedevs.com/topic/22734-lighting-how-achieve-this-kind-of-result-from-lighting ) , is working smoothly with 60 fps on same machine. Which is said to be having SSAO , as mentioned by @Deltakosh in that thread. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 26, 2016 Share Posted May 26, 2016 Summoning @Luaacro Quote Link to comment Share on other sites More sharing options...
dsman Posted May 26, 2016 Author Share Posted May 26, 2016 @Luaacro Based on your answer on following link, if you have improved SSAO, is there anyway we can add it to our project before it gets added and released as part of babylon official repo ? http://www.html5gamedevs.com/topic/4983-tutorial-talk/?page=9#comment-126661 Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted May 26, 2016 Share Posted May 26, 2016 Hey dsman, Sure, I'm uploading the files (.ts and .js files for the SSAO rendering pipeline and the associated .fx shader files). The problem is that I completely removed the horizontal and vertical standard blur post-processes and replaced it by a smarter blur post-process (bilateral blur) largely used for SSAO : breaking changes According to the performances, what is your ratio when you create the rendering pipeline ? Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted May 26, 2016 Share Posted May 26, 2016 Here is the link : https://onedrive.live.com/redir?resid=EE516DDA62BD39D4!511880&authkey=!AOWqPRztPmVCPBU&ithint=folder%2cjs Quote Link to comment Share on other sites More sharing options...
Kesshi Posted May 27, 2016 Share Posted May 27, 2016 10 hours ago, Luaacro said: Here is the link : https://onedrive.live.com/redir?resid=EE516DDA62BD39D4!511880&authkey=!AOWqPRztPmVCPBU&ithint=folder%2cjs I would say if this version is really better compared to the current one then the current one should be replaced. Regarding the breaking change. This could be added to the release notes of the next BJS version. Maybe with some hints how to migrate to the new version. Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted May 27, 2016 Share Posted May 27, 2016 Exact, I had a discussion with @Deltakosh and I'll update it really soon. I'll also update the doc page of SSAO to explain the breaking changes. For you, only the blur post-processes have changed, they no more exist. To help you to configure SSAO, you should use the editor with your scene : http://editor.babylonjs.com Documentation : http://doc.babylonjs.com/extensions Post-processes such as SSAO are in the scene (select the scene in the scene graph on the right) Quote Link to comment Share on other sites More sharing options...
dsman Posted May 27, 2016 Author Share Posted May 27, 2016 @Luaacro I appreciate your effort to share the files . Can you please check 4 issues I mentioned in original post. And tell me if new blurring technique will help solve any of them. Mainly the performance. Additionally I have some more queries about SSAO I don't understand theory of 3D graphic much. I read somewhere that mesh can be pushed to RenderTarget. So can this be somehow used to apply SSAO on only some selected meshes and hence make it faster a bit somehow ? Also I read somewhere that we can have smaller Depth Render target than current scene area. Can this be somehow used to force SSAO to compute less pixel ( by sacrificing quality) and hence make it faster ? Quote Link to comment Share on other sites More sharing options...
dsman Posted May 27, 2016 Author Share Posted May 27, 2016 Well I changed the ratio to 0.7 and combined ratio to 1. Now there's significant improvement to FPS. Almost tolerable for mobile device , if not desirable. But few other issues with SSAO effect which I mentioned in original post above are still there (Even after figuring out best combination of value of fallout , strength , blur values etc). I am not sure if this will go away with new blurring method. Although, I would wish if we can set it for only few meshes. ( I know its post process . But if somehow it can be achieved. ) Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted May 30, 2016 Share Posted May 30, 2016 @dsman sure everything is possible with Babylon.js To setup only few meshes with SSAO, you only have to set the property ".disableDepthWrite" to "true" of each material affected to the meshes you don't want to render in the depth pass (used by the SSAO rendering pipeline) Also, for more performances and enough good results it is more advised to use a ssaoRatio set to 0.5 Computing the depth renderer in a lower resolution isn't possible today, but @Deltakosh who wrote the depth renderer may be able to answer you and maybe find a solution, as everything is possible with Babylon.js meteoritool 1 Quote Link to comment Share on other sites More sharing options...
dsman Posted June 13, 2016 Author Share Posted June 13, 2016 @Luaacro the SSAO has got lot lot better in this rewritten code logic. Very well done there. Special thanks for that. All above issues that I have mentioned has gone now. Just that it is slower and reduces fps by multi fold. But probably that is global limitation and nothing to do with your logic or babylon. I saw an app built in threejs (mentioned here : http://www.html5gamedevs.com/topic/22734-lighting-how-achieve-this-kind-of-result-from-lighting ) which was blazing fast even with SSAO . So may be they are doing on selected meshes. At ssaoRatio = 0.5 it shows some noise on screen . It appears like the display screen has got some dirt and strains. So we use 0.75. What are other parameters that can affect the speed of SSAO ? Does the properties like radius, fall of, strength affect it ? Quote Link to comment Share on other sites More sharing options...
dsman Posted June 13, 2016 Author Share Posted June 13, 2016 @Deltakosh Can we have option to compute depth renderer at lower resolution ? I don't understand the deep theory of SSAO implementation but I somehow believe the lesser resolution of depth renderer won't affect the quality of SSAO but will improve the compute speed and fps greatly. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 13, 2016 Share Posted June 13, 2016 Good idea.. @Luaacro will work on it and see if it works Quote Link to comment Share on other sites More sharing options...
meteoritool Posted June 14, 2016 Share Posted June 14, 2016 Hello ! I experienced the same kind of FPS drop trying to use SSAO, On 30 mai 2016 at 9:59 PM, Luaacro said: To setup only few meshes with SSAO, you only have to set the property ".disableDepthWrite" to "true" of each material affected to the meshes you don't want to render in the depth pass (used by the SSAO rendering pipeline) I've been looking for this piece of information =) would be cool to add it in your tutorial ! I'm using a high dpi display (retina macbookpro) I don't know if the performance drop comes from that ... just an idea =) julien-moreau 1 Quote Link to comment Share on other sites More sharing options...
dsman Posted June 15, 2016 Author Share Posted June 15, 2016 @Luaacro Isn't there any way to get rid of aliasing that happens when we enable SSAO ? Following are screenshots with and without SSAO. Look at the aliased edges on kitchen cabinets, glass window, dining table in the screenshot with SSAO. There's no aliasing in the screenshot without SSAO. With SSAO ( http://prntscr.com/bgmzgw ) Without SSAO ( http://prntscr.com/bgmz1k ) Quote Link to comment Share on other sites More sharing options...
Kesshi Posted June 15, 2016 Share Posted June 15, 2016 @dsman The aliasing is not related to SSAO. The problem is that with WebGL you no longer have anti-aliasing if you render into a texture ... which is the case with post processing. That means as soon as you use any post processing you lose the hardware anti-aliasing. You could enable the FXAA post process to reduce the aliasing a bit but the result will not be as good as without any post processing. I wrote a custom anti aliasing post processing pipeline for our app to solve this issue and get high quality anti aliasing. Its similar to the ThreeJs one: http://threejs.org/examples/#webgl_postprocessing_msaa_unbiased ... but without the bugs Quote Link to comment Share on other sites More sharing options...
dsman Posted June 15, 2016 Author Share Posted June 15, 2016 Is there any way to bake SSAO in 3D max and get it into babylon without having SSAO pipeline ? Most part of our scene is static. Quote Link to comment Share on other sites More sharing options...
Kesshi Posted June 15, 2016 Share Posted June 15, 2016 You can't bake SSAO because its screen based but you can bake real ambient occlusion with 3ds max. This will also gives you better results compared to SSAO. But i can't tell you how to do that. I'm not familiar with 3ds max. Quote Link to comment Share on other sites More sharing options...
julien-moreau Posted June 15, 2016 Share Posted June 15, 2016 @meteoritool, I got exactly the same issue with retina display. To avoid, you should divide your final ratios (except combineRatio) by devicePixelRatio which is equal to 2.0 @dsman, I'll definitely write a tuto in the doc to help in setting SSAO. For now, I'll create a preview URL for the preview version of the Babylon.js Editor which includes the latest SSAO implementation, I'll let you know where to find it meteoritool 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.