Page MenuHome

Fix T84160: Wrong DOF when camera is overriden
ClosedPublic

Authored by Richard Antalik (ISS) on Dec 29 2020, 7:49 PM.

Details

Summary

Workbench engine used active camera to setup DOF effect even when
camera was overridden.

Pass correct camera explicitly to workbench_dof_engine_init()

Diff Detail

Repository
rB Blender

Event Timeline

Richard Antalik (ISS) requested review of this revision.Dec 29 2020, 7:49 PM
Richard Antalik (ISS) created this revision.

Looking at the bug report and the playing around with the file:

  • Sequencer Preview is correct
  • View -> Sequencer Render Image is correct
  • View -> Sequencer Render Animation is correct
  • Render -> Render Image is incorrect
  • Render -> Render Animation is incorrect

If this is the case I would say the error is somewhere in the source/blender/render. One thing I see is that the camera_override is only set when there is a v3d what isn't the case for final image rendering. During final image rendering only the re->camera_override is set.
I am not 100% up to speed but your solution makes sense as cycles does a similar approach.

This revision is now accepted and ready to land.Jan 5 2021, 2:45 PM

I guess I will add to commit message that I had to override scene in DRW_render_to_image(), because engine has own dependency graph created by engine_depsgraph_init() Therefore it uses different evaluated scene than render pipeline.

Brecht Van Lommel (brecht) requested changes to this revision.Jan 6 2021, 7:33 PM

Rendering should not modify evaluated scene data, that's read-only outside of depsgraph evaluation.

There should be no assumption that the evaluated scene will only be used for this one render.

This revision now requires changes to proceed.Jan 6 2021, 7:33 PM

Rendering should not modify evaluated scene data, that's read-only outside of depsgraph evaluation.

There should be no assumption that the evaluated scene will only be used for this one render.

Thanks for checking this. Are you suggesting that each engine should handle camera override properties internally? Or is there any simpler universal solution?

I have checked case for eevee, that seems like a simple change, I will check other engines as well and update patch. I have expected much more complicated setup.

Currently each engine should handle the camera override internally.

A more universal solution is possible at the render pipeline / depsgraph level, but it's more complex and I would not bother with this right now.

  • Pass camera to DOF init function explicitly
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Jan 22 2021, 4:25 AM

Eevee and cycles works correctly, so no change was necessary. I guess I could have mentioned this in commit message.

This revision is now accepted and ready to land.Jan 22 2021, 3:08 PM

I have noticed just now that this change produces complier warning, because workbench_dof_engine_init() parameter list is different to what is defined in DrawEngineType

So I will probably need to store camera override in WORKBENCH_Data that is passed to workbench_dof_engine_init()
Can I store store camera override inside WORKBENCH_StorageList or perhaps WORKBENCH_PrivateData?

Brecht Van Lommel (brecht) requested changes to this revision.Jan 25 2021, 12:25 PM

Putting it in WORKBENCH_PrivateData seems reasonable, Eevee does the same.

This revision now requires changes to proceed.Jan 25 2021, 12:25 PM
  • Store camera override in WORKBENCH_PrivateData. I had to initialize private data outside of workbench_engine_init() function. I am not sure if this violates some design.

Eevee does the same so seems reasonable to be consistent.

This revision is now accepted and ready to land.Jan 25 2021, 7:02 PM