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 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi, the manual (WIP) contains up-to-date examples that are a easier to follow. Also note that |
Beta Was this translation helpful? Give feedback.
-
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: |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
Hi, the manual (WIP) contains up-to-date examples that are a easier to follow. Also note that
composer.setSize
should be used instead ofrenderer.setSize
.