I tried to make shaders for 3d objects and it worked.
But i don’t understand how I can apply shaders to a camera object.
My final goal is to achieve “depth of field” effect."
A canonical post-processing support is in the official roadmap and already under heavy construction, but before its official release you can always use multiple cameras to do this:
- create a render texture asset;
- assign it to the
targetTextureproperty in your main camera component; - create another camera and a quad, make sure the model’s node layer and camera visibility matches and different from everything else;
- write your own post-processing effect(the vertex transformations should be handled a little differently to make the quad fullscreen);
- set the quad’s material to use your post-processing effect, and set the render texture as an input property;
This is not the most efficient, but the most straightforward way to do this for now.
3赞