Jump to content

Depth Of Feild with Transparent Objects?


photo

Recommended Posts

Hello,

Please find this screenshot from Editor.

image.thumb.png.1a56f0a2e79c4291f22ff735991b5af2.png

And check this DoF Mask.

image.thumb.png.e6ac325203202a4728233924082ae5d4.png

 

Now things are good here with Depth of Field is clearly getting focused between near and far distances. We can see it here in the mask. Red (Far Field), Green (Near Field) and Dark region with focused area. Even on camera movement it is giving correct results. For simplicity I have added Transparent helper for showing transparent object in blue.

Now how to solve this artifact in first image. The background Cube is not in depth of field and outside far field  region getting the blur effect. But see the problem. The part of cube outside transparent area is blur but part of cube occlude by the transparent area is not blur and it is sharp. Which is a optical problem as it should be blur being outside of depth of focused field. How to solve this? or any workaround.

Overlap on The plane can solve the issue but again the plane ,material will lose DoF and always remain sharp.

Please suggest.

Rohit

Link to comment

Hello!

Rohit, may I ask you to attach the scene that was used to create the screenshots above? We can significantly save time by seeing the project on our side

Do the right-click on the ".world" file in the asset browser and select from the drop down menu "Export As Package" then specify the location where to save the ".upackage" archive.

The result will be just one file that can be attached to the message right here

Thanks!

Link to comment
19 hours ago, rohit.gonsalves said:

Now how to solve this artifact in first image

Rohit, it is not yet entirely clear where exactly you are observing the artifact, can you please circle a specific place in the first image to indicate the exact location?

Thanks!

Link to comment

Dear @bmyagkov,

To make it more simple to understand  I have two images now.

image.png.90ac6634e066b03d134f0a418993bb0f.png

 

image.thumb.png.a3e331e32dcdf66115f351de02101f61.png

Here is again an explanation to the problem.

1. From camera at Focus distance things will be sharp in the depth which is marked with near (focus to Camera) and far (focus to away) depth distances. 

2. In DOF mask the near field crossing is shown as green, Far field crossing is shown as red and focus or depth of field is shown as dark.

3. Now everything in red and green region should be blurred with blur intensity. It works well.

4. As in above when we take transparent plane, the back side cube which must be blurred as it is in red field. But as transparent object depth is still occluding it, the part is sharp and part is blurred. 

5. This is optically wrong. If we have transparent objects, the behind blur should not be affected due to transparent pixels. Just move a camera little and take the back cube out of occlusion by this plane. It will be completely blurred. Take in to occluded field by that plane it will be sharp though the distance between that object and camera still the same. And you can check this on DOF Mask. As the mask shows dark than red as transparency not taken into account.

6. If we use real camera and we put such glass (as transparent plane) Still we will see blurred BG as light is passing through the transparent glass and we can make a good depth of field.

7. Probably in algorithm, I am just presuming. Depth is taken for blurring the things, but transparent pixels are not taken into account. Tricky.

Still is there any workaround?

Regards,

Rohit

Link to comment

We already reported that "behavior", I think it depends on the render pipeline and the order position of transparent materials (alpha_blend). (It works with alpha_test)

Unfortunately it also effects fog, blurred glas, volumetric light, sunshafts etc. It would be highly appreciated if there will be perspective a workaroud for this issue.

Kind regards,

corney

Link to comment

Hello!

Like @corney mention above we are already warned about discussed issue, but truth be told - this is how "alpha blend" transparency works with post processing effects at this moment and only one workaround it is use "alpha test" instead. 

Such a task is extremely difficult to solve in real-time rendering and requires a special approach which can pull refactoring of the engine partly and even so there is no guarantees that it will work correctly in all cases.

The problem has already been included in our internal bug tracker and we hope that it will be solved in some of future SDK versions.

Thanks!

image.png

Link to comment

@bmyagkov,

I have said already, its tricky. But most of the time Alpha test or just Overlay options will solve these issues temporarily.

But to be optically correct it requires to work with Alpha blend as this compositing is required most most of the time.

I will surely wait for this very important feature.

Regards,

Rohit

Link to comment
×
×
  • Create New...