Regression: Alpha/transparency not working correctly with intersecting mesh in Cycles #96537

Closed
opened 2022-03-16 21:47:44 +01:00 by Mustard · 19 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.23

Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: c77597cd0e
Worked: 3.0.1

Caused by 74afc86d4b

Short description of error
Alpha/transparency in Cycles seems not to be handled correctly when there are intersecting mesh.
I am not sure if the mesh of the attached .blend is particularly complex, but it was working correctly in Blender 3.0.1.

Exact steps for others to reproduce the error
You can reproduce the uncorrect transparency (as in the image) in the attached file, just start rendering with Cycles. It happens both in viewport and render, and both with CPU and GPU.
Even if the number of transparency bounces is big, and the shader is only a transparency node, the transpancy seems not to work as expected.

hair.PNG

hair.blend

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.23 **Blender Version** Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: `c77597cd0e` Worked: 3.0.1 Caused by 74afc86d4b **Short description of error** Alpha/transparency in Cycles seems not to be handled correctly when there are intersecting mesh. I am not sure if the mesh of the attached .blend is particularly complex, but it was working correctly in Blender 3.0.1. **Exact steps for others to reproduce the error** You can reproduce the uncorrect transparency (as in the image) in the attached file, just start rendering with Cycles. It happens both in viewport and render, and both with CPU and GPU. Even if the number of transparency bounces is big, and the shader is only a transparency node, the transpancy seems not to work as expected. ![hair.PNG](https://archive.blender.org/developer/F12930575/hair.PNG) [hair.blend](https://archive.blender.org/developer/F12930587/hair.blend)
Author

Added subscriber: @Mustard

Added subscriber: @Mustard
Mustard changed title from Alpha/transparency not working correctly with intersecting mesh to Alpha/transparency not working correctly with intersecting mesh in Cycles 2022-03-16 21:58:08 +01:00

Added subscriber: @iss

Added subscriber: @iss

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

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

It is quite dense mesh, but seems to be a regression from what I can see.

It is quite dense mesh, but seems to be a regression from what I can see.

Added subscriber: @lictex_1

Added subscriber: @lictex_1
Author

In #96537#1324400, @iss wrote:
It is quite dense mesh, but seems to be a regression from what I can see.

Exactly, it was working correctly in 3.0.1.
The issue obviously remains when you put a texture with alpha channel, with bad render results with this mesh in Cycles.

unknown.png

> In #96537#1324400, @iss wrote: > It is quite dense mesh, but seems to be a regression from what I can see. Exactly, it was working correctly in 3.0.1. The issue obviously remains when you put a texture with alpha channel, with bad render results with this mesh in Cycles. ![unknown.png](https://archive.blender.org/developer/F12932173/unknown.png)
Member

Added subscribers: @leesonw, @brecht, @lichtwerk

Added subscribers: @leesonw, @brecht, @lichtwerk
Member

Caused by 74afc86d4b
#96816 (Hair cards with alpha texture map produce weird black color under cycles.) is probably a duplicate.

Not sure how this can actually be avoided in this usecase here now?

Maybe @brecht and/or @leesonw could comment?

This might very well be the new limitation, but will set to High prio for now.

Caused by 74afc86d4b #96816 (Hair cards with alpha texture map produce weird black color under cycles.) is probably a duplicate. Not sure how this can actually be avoided in this usecase here now? Maybe @brecht and/or @leesonw could comment? This might very well be the new limitation, but will set to High prio for now.
Philipp Oeser changed title from Alpha/transparency not working correctly with intersecting mesh in Cycles to Regression: Alpha/transparency not working correctly with intersecting mesh in Cycles 2022-04-19 12:01:57 +02:00
Member

I took a quick look and it seems that there are many polygons intersecting which is causing the ray to hit objects in the same space and thus never move on. The obvious fix is to add offsetting back to transparency see #97459 and it appears to work but this adds the offsetting issues back in :-). I guess the more robust solution would be to be able to hold more than one id at a hit point so that all object intersecting in the same area could be skipped but that might be slow. Maybe when multiple hits at the same location are found offsetting could be used.

I took a quick look and it seems that there are many polygons intersecting which is causing the ray to hit objects in the same space and thus never move on. The obvious fix is to add offsetting back to transparency see #97459 and it appears to work but this adds the offsetting issues back in :-). I guess the more robust solution would be to be able to hold more than one id at a hit point so that all object intersecting in the same area could be skipped but that might be slow. Maybe when multiple hits at the same location are found offsetting could be used.

Adding offsetting specifically for transparent bounces probably would not make things worse than before 3.1? We may skip over some surfaces unnecessarily but it's not obvious the ray offsetting changes helped much with that specific problem.

A more robust solution may be tracking ray start and end distance for transparent rays, rather than moving the ray start position forward. Then we can more easily ensure the ray is always moving forward, by ensuring the start distance increases. Potentially we could even ensure all intersections are found in a consistent order by allowing hits at the same distance as long as the primitive ID is higher than the previous hit. This is a more complicated fix so we may just do simple offsetting to solve the immediate problem, but it would be interesting to try.

Recording multiple intersections would also help, but increased GPU memory usage and reduced performance are bigger concerns for that approach.

Adding offsetting specifically for transparent bounces probably would not make things worse than before 3.1? We may skip over some surfaces unnecessarily but it's not obvious the ray offsetting changes helped much with that specific problem. A more robust solution may be tracking ray start and end distance for transparent rays, rather than moving the ray start position forward. Then we can more easily ensure the ray is always moving forward, by ensuring the start distance increases. Potentially we could even ensure all intersections are found in a consistent order by allowing hits at the same distance as long as the primitive ID is higher than the previous hit. This is a more complicated fix so we may just do simple offsetting to solve the immediate problem, but it would be interesting to try. Recording multiple intersections would also help, but increased GPU memory usage and reduced performance are bigger concerns for that approach.
Member

Yes I have done a more accurate version of offsetting but I still don't really like the offsetting approach. So, then like you mentioned I decided to try sorting them based on prim id. I don't think it is going to be much slower but it is not quite there yet so I'll give that a go first and see where I get.

Yes I have done a more accurate version of offsetting but I still don't really like the offsetting approach. So, then like you mentioned I decided to try sorting them based on prim id. I don't think it is going to be much slower but it is not quite there yet so I'll give that a go first and see where I get.

@leesonw, are you still actively working on this?

Ideally we'd have a solution by bcon4 (June 1), if you don't have time I might try implementing something.

@leesonw, are you still actively working on this? Ideally we'd have a solution by bcon4 (June 1), if you don't have time I might try implementing something.
Member

@brecht I doubt I will have time before June so feel free to take over.

@brecht I doubt I will have time before June so feel free to take over.

I would have like to fix this for 3.2, but it's going to be for 3.3 since this is turning out to be complicated and too risky for 3.2.

I would have like to fix this for 3.2, but it's going to be for 3.3 since this is turning out to be complicated and too risky for 3.2.
Contributor

Added subscriber: @Raimund58

Added subscriber: @Raimund58

Added subscriber: @MWillcox24

Added subscriber: @MWillcox24

Added subscriber: @EvBro

Added subscriber: @EvBro

This issue was referenced by 5152c7c152

This issue was referenced by 5152c7c152e52d563cbd3ba3c792de3af0c2c14f

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2022-07-15 19:17:45 +02:00
Thomas Dinges added this to the 3.3 LTS milestone 2023-02-08 15:37:47 +01:00
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
10 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#96537
No description provided.