Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork238
Implementing SMAA (from pmndrs) into three js#557
-
Hello all :D I am getting myself familiar with this wonderful postprocessing library. I went over the demo codes, but to be honest, i am struggling to understand how to implement some of these effects. I created a simple three js case in order to practice. So far i have managed to add selective bloom, but i would like to add anti-aliasing (SMAA). I would appreciate it if anyone can guide me on how i can add smaa into this simple three js case im working on: //Imports for pmndrs post processing library // Create scene // Create red GLOWING cube BASIC // Create green cube (NON-GLOWING) // Create camera // Create renderer renderer.setSize(window.innerWidth, window.innerHeight); //Create Effects bloomEffect.selection.add(redCube); const composer = new EffectComposer(renderer); // Animation function // Rotate cubes composer.render(scene, camera); // Handle window resize camera.aspect = newWidth / newHeight; renderer.setSize(newWidth, newHeight); // Start animation |
BetaWas this translation helpful?Give feedback.
All reactions
Hi, themanual (WIP) contains up-to-date examples that are a easier to follow. Also note thatcomposer.setSize should be used instead ofrenderer.setSize.
Replies: 3 comments 2 replies
-
Hi, themanual (WIP) contains up-to-date examples that are a easier to follow. Also note that |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Thanks@vanruesc for your helpful reply. I followed the manual demo and was able to implement smaa. I have a few questions though: Firstly, i noticed that the demo in the manual does not mention anything related to "area" and "search". These were present in other demos i saw. From what i could understand, they were textures. How come this demo does not include them? Also, I tried implementing SMAA with and without the debugging lines and noticed no significant difference. To be honest i didnt really understand what theyre doing but i am guessing its recommended that i also have them in my code? Lastly, one of the reasons why i was struggling at the beginning was because i was also wrapping my head around the load function and the loadmanager from three js. Previous demos required these in order for smaa to work but the demo in the manual doesnt. Just curious how come the methodology has changed. Thanks again for your support! Heres how its looking so far: |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
The search/area textures are data textures that can be loaded automatically by the The debugging code is not needed for SMAA. You only need the effect. The |
BetaWas this translation helpful?Give feedback.
All reactions
-
Once again thank you for your reply! its helping me learn more about this topic. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
MSAA and SMAA both smooth jagged lines but they work very differently. SMAA is image-based and fast but suffers from shimmering. MSAA renders additional fragments along geometrical edges for stable smoothing but suffers from artifacting when used with depth-based effects like SSAO. WebGL 1 is deprecated at this point so it's fine to just use WebGL 2. I recommend using MSAA as the default and SMAA for weaker devices or when MSAA produces artifacts. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 2