I am currently working on developing a product showcasing web application where we are utilizing Three.js to render 3D models of various products within our Three.js scene. As part of enhancing the visual appeal and realism of our application, we aim to incorporate a Depth of Field (DoF) or blur shader effect within the Three.js scene. Our goal is to blur parts of the 3D model that are distant from the camera while maintaining focus on the parts closer to the camera.
Here we have tried add post processing effects and custom shader effects but we are not able to achieve the satisfactory result. Maybe we are doing something wrong or lacking knowledge about post processing or shaders in Three.js. I am badly stuck with this thing and looking for guidance.
To provide a clear understanding of our objective, I have attached a reference video demonstrating the desired effect we are aiming for.
I am reaching out to seek guidance and assistance from the community. If anyone has experience or expertise in implementing DoF effects or similar shader effects in Three.js scenes, your insights and suggestions would be greatly appreciated.
@Fennec Yes, we tried post-processing examples also, It was giving very bad blur effect with some pixalated edges on the model and also changes the color tone of the model.
Here’s what I am getting after adding post-processing:
I tried Three.js dof2 example .
Here the problems I am facing:
Difference in the colors of the model after adding post-processing dof2 example (see petrol tank color tone and light reflection).
Blur is not coming good. I need soft blur as shown in the example above (in query).
There are some white dots jittering (see the Royal Enfield Logos on the Toolbox).
I will try to provide the jsfiddle link to reproduce the error, as I can’t share the exact assets so I have to use a dublicate asset to recreate the same issue. For now I am sharing the video of the issue I am getting with the dof example from the threejs.