Z depth not correct when using a volume shader #98857

Open
opened 2022-06-13 20:08:12 +02:00 by thierrry kobyleski · 10 comments

System Information
Operating system: Linux-5.13.0-48-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: NVIDIA GeForce GTX 980/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06

Blender Version
Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: e05e1e3691
Worked: (newest version of Blender that worked as expected)

Short description of error
Z depth gives strange "far away values" when using volume shader and thus cant be used for compositing
Screenshot from 2022-06-13 19-54-02.png

Exact steps for others to reproduce the error
Just render this blend file
Zmist.blend

**System Information** Operating system: Linux-5.13.0-48-generic-x86_64-with-glibc2.31 64 Bits Graphics card: NVIDIA GeForce GTX 980/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.129.06 **Blender Version** Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: `e05e1e3691` Worked: (newest version of Blender that worked as expected) **Short description of error** Z depth gives strange "far away values" when using volume shader and thus cant be used for compositing ![Screenshot from 2022-06-13 19-54-02.png](https://archive.blender.org/developer/F13157265/Screenshot_from_2022-06-13_19-54-02.png) **Exact steps for others to reproduce the error** Just render this blend file [Zmist.blend](https://archive.blender.org/developer/F13157269/Zmist.blend)

Added subscriber: @thierrykobyleski

Added subscriber: @thierrykobyleski

Added subscriber: @narcissotto

Added subscriber: @narcissotto

What is the behavior you expect from this setup? Were you attempting to follow a tutorial? If you could explain what you would like to happen and why, we might be able to find a better method.

Okay, wait, just from context clues and mucking around a bit, I think I found what you were looking to accomplish. The thing that tipped me off was this Note here: "The Z pass only uses one sample. When depth values need to be blended...use the mist pass." Just from a high-level intuition standpoint (I don't claim any knowledge of Z Depth's inner workings), grainy stuff like that can usually be attributed to "undersampling."

When you check the box next to Mist in "View Layer Properties," then back in the Compositing node editor plug Mist directly into Mix's Fac input, it properly mixes the suzanne with the red background. I've attached a file with it "fixed." Hope this was what you're looking for!

Zmist_proper.blend

What is the behavior you expect from this setup? Were you attempting to follow a tutorial? If you could explain what you would *like* to happen and why, we might be able to find a better method. Okay, wait, just from context clues and mucking around a bit, I think I found what you were looking to accomplish. The thing that tipped me off was [this Note here](https://docs.blender.org/manual/en/latest/render/layers/passes.html): "The Z pass **only uses one sample.** When depth values need to be blended...**use the mist pass.**" Just from a high-level intuition standpoint (I don't claim any knowledge of Z Depth's inner workings), grainy stuff like that can usually be attributed to "undersampling." When you check the box next to Mist in "View Layer Properties," then back in the Compositing node editor plug Mist directly into Mix's Fac input, it properly mixes the suzanne with the red background. I've attached a file with it "fixed." Hope this was what you're looking for! [Zmist_proper.blend](https://archive.blender.org/developer/F13157559/Zmist_proper.blend)

I am trying to create some mist with a volume shader for my middleground landscape, while the background is a landscape photograph which I don't want to alter with my volume shader since the photograph already contains its own mist (just a thin haze of air humidity).
With your file Zmist_proper.blend the background can be seen through suzanne.
I made a try using the mist pass distance and adding a background photograph, and a plane for the ground. Here is what I obtain
mistPB.png
The new blend file
Zmist_proper_PB.blend

I am trying to create some mist with a volume shader for my middleground landscape, while the background is a landscape photograph which I don't want to alter with my volume shader since the photograph already contains its own mist (just a thin haze of air humidity). With your file Zmist_proper.blend the background can be seen through suzanne. I made a try using the mist pass distance and adding a background photograph, and a plane for the ground. Here is what I obtain ![mistPB.png](https://archive.blender.org/developer/F13164115/mistPB.png) The new blend file [Zmist_proper_PB.blend](https://archive.blender.org/developer/F13164118/Zmist_proper_PB.blend)

New try without film transparency, and with a threshold on the mist pass socket
I obtain what I expected
mist.png
Here is the blend file
Zmist_proper2.blend
Thank you very much. The problem is solved for me, with this unexpected solution where the mist distance is used to show the background photograph, while the mist is obtained from the volume shader alone.

New try without film transparency, and with a threshold on the mist pass socket I obtain what I expected ![mist.png](https://archive.blender.org/developer/F13164175/mist.png) Here is the blend file [Zmist_proper2.blend](https://archive.blender.org/developer/F13164178/Zmist_proper2.blend) Thank you very much. The problem is solved for me, with this unexpected solution where the mist distance is used to show the background photograph, while the mist is obtained from the volume shader alone.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I'm not sure what the expected depth value should be when there is a volume in the scene, but this randomness doesn't seem to be ideal.
So I'm confirming it as a bug for now.

I'm not sure what the expected depth value should be when there is a volume in the scene, but this randomness doesn't seem to be ideal. So I'm confirming it as a bug for now.

Thanks you. I will try again with "Z value" instead of "mist value" when the bug will be fixed.

Thanks you. I will try again with "Z value" instead of "mist value" when the bug will be fixed.
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:03:48 +01:00

Still presents today with 4.2 alpha, it's been such a long time...
屏幕截图 2024-04-06 222031.png
z depth channel with camera inside a volume fog object↑↑↑
Because of this, I have to stop making volumetric things inside blender sadly

Still presents today with 4.2 alpha, it's been such a long time... ![屏幕截图 2024-04-06 222031.png](/attachments/403a84f3-b905-4389-80a6-da142f1527d8) z depth channel with camera inside a volume fog object↑↑↑ Because of this, I have to stop making volumetric things inside blender sadly
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#98857
No description provided.