Graphics Reference
In-Depth Information
How it works...
In this recipe, we've used THREE.EffectComposer together with
THREE.RenderPass to render the scene. If we add more steps to
THREE.EffectComposer , we can access the current rendering directly from our
shader by accessing the tDiffuse texture. This way, we can easily add all kinds of
effects by just writing a shader that uses the tDiffuse texture as its input.
There's more…
When you write shaders, you can pretty much create whatever you want. Getting
started with shaders, however, can be rather difficult. A good example of some
shaders that apply a specific effect can be found at https://github.com/evanw/glfx.js .
The shader we used in this recipe was also adopted from the hexagonpixalte.js
shader that you can find in the src/filters/fun/hexagonalpixelate.js
folder in the mentioned GitHub repository.
You can also look at the sources of the effects that are provided by Three.js. You can
access them directly from GitHub at https://github.com/mrdoob/three.js/tree/master/
examples/js/shaders .
See also
In Chapter 5 , Lights and Custom Shaders , we've also created two custom shaders:
• In the Creating a custom vertex shader recipe, we explain the steps you need
to take to set up a custom vertex shader
• In the Creating a custom fragment shader recipe, we explain the steps you
need to take to set up a custom fragment shader
Search WWH ::




Custom Search