Regression: Cycles fresnel emission in Principled BSDF produces triangle artifacts #119813

Closed
opened 2024-03-23 03:51:33 +01:00 by Brad Smith · 4 comments

System Information
Operating system: Linux
Graphics card: NVIDIA RTX 3060Ti

Blender Version
Broken: 4.0.2 and 4.1.0 Release Candidate (v41.b9ef66693adf)
Worked: 3.6.2

Short description of error
When using a Fresnel node's output as an emission strength with any BSDF node, cycles renders may produce strange triangle artifacts.

I noticed this issue when working in a scene with dim lighting where I was using a Fresnel node as input to the emission strength of a Principled BSDF to make an object glow from its outer edges. This material was working fine in 3.6.2, but 4.0.2 introduced odd triangle rendering artifacts. I also confirmed this issue is still present in the current 4.1.0 Release Candidate. After some trial and error, I identified the cause of the weird fresnel triangles and created a minimal blend file with the following steps.

Exact steps for others to reproduce the error

  1. Start with default new project with factory settings.
  2. In Scene settings, switch Render Engine to Cycles. Device can be either CPU or GPU (I've observed this issue with both).
  3. In Scene settings, to increase visibility of this issue, consider setting Color Management: View Transform to Standard with Look Very High Contrast. (optional but might help you see the effect depending on your display)
  4. Delete default cube and default light.
  5. Add a new plane object.
  6. With the plane selected, switch to edit mode, and:
    1. Subdivide with 5 cuts.
    2. Mesh: Transform: Randomize with amount set to 0.2.
    3. Select all vertices, and scale on Z axis to 0. This should result in a flat plane that just has some vertices jittered in the X and Y directions.
    4. Note that those last two steps seem to be the most important to trigger this rendering issue. If the vertices are perfectly uniform on the subdivided plane, the output looks fine. However, if the vertices form slightly irregular quads, even if they are perfectly flatly aligned at z=0, the weird triangles appear in the Cycles rendered output.
  7. Switch back to object mode, go to the shading tab, and:
    1. Add a new material.
    2. In the new Principled BSDF, set emission color to white (FFFFFF).
    3. Add a Fresnel node, and connect its Fac output to the Principled BSDF's Emission Strength input.
  8. Switch the viewport shading to Rendered and rotate/pan until you can see the fresnel effect on the object. Since this is a flat plane, the effect will be very subtle and only visible as you approach it edge-on.
  9. Compare the difference between 3.6.2 and 4.0.2. Looks great and smooth in 3.6.2, but weird triangles appear in 4.0.2.

This problem isn't limited to just the Principled BSDF. I also tried feeding the Fresnel into a simple Emission shader and using an Add Shader node to combine that with another BSDF, and the same buggy triangles appeared.

If I connect the Fresnel directly to the Material Output node without a BSDF node between them, the material looks smooth and normal as I would expect. So, the problem appears to be in combining the fresnel with other material properties somehow.

Attached files are:

  • fresnel-shader-issue.principled-bsdf.blend - minimal demonstration file created using the steps I described above
  • fresnel-shader-issue.add-shader-node.blend - basically the same, but trying to use the Add Shader node (which didn't help)
  • 3.6.2-blender.png - Blender 3.6.2 viewport in Cycles rendered mode. Looks good!
  • 3.6.2-principled-bsdf-render.png - rendered output from Blender 3.6.2 using Cycles. Looks good!
  • 4.0.2-blender.png - Blender 4.0.2 viewport in Cycles rendered mode. Looks bad.
  • 4.0.2-principled-bsdf-render.png - rendered output from Blender 4.0.2 using Cycles. Looks bad.
  • 4.0.2-add-shader-node.png - Blender 4.0.2 viewport in Cycles rendered mode, trying the Add Shader instead of one Principled BSDF node. Still looks bad.
  • original-real-world-example.png - 4.0.2 render from original real-world project where I discovered this issue. Boosted levels and sketched on (purple) after noticing glitches in the render. In this case, the mesh with the offending fresnel artifacts is also perfectly flat (on the ZY plane) but is made up of irregular triangles and quads, which is what I found to be the key issue in the reproduction steps above.
**System Information** Operating system: Linux Graphics card: NVIDIA RTX 3060Ti **Blender Version** Broken: 4.0.2 and 4.1.0 Release Candidate (v41.b9ef66693adf) Worked: 3.6.2 **Short description of error** When using a Fresnel node's output as an emission strength with any BSDF node, cycles renders may produce strange triangle artifacts. I noticed this issue when working in a scene with dim lighting where I was using a Fresnel node as input to the emission strength of a Principled BSDF to make an object glow from its outer edges. This material was working fine in 3.6.2, but 4.0.2 introduced odd triangle rendering artifacts. I also confirmed this issue is still present in the current 4.1.0 Release Candidate. After some trial and error, I identified the cause of the weird fresnel triangles and created a minimal blend file with the following steps. **Exact steps for others to reproduce the error** 1. Start with default new project with factory settings. 1. In Scene settings, switch Render Engine to Cycles. Device can be either CPU or GPU (I've observed this issue with both). 1. In Scene settings, to increase visibility of this issue, consider setting Color Management: View Transform to `Standard` with Look `Very High Contrast`. (optional but might help you see the effect depending on your display) 1. Delete default cube and default light. 1. Add a new plane object. 1. With the plane selected, switch to edit mode, and: 1. Subdivide with 5 cuts. 1. Mesh: Transform: Randomize with amount set to `0.2`. 1. Select all vertices, and scale on Z axis to `0`. This should result in a **flat** plane that just has some vertices jittered in the X and Y directions. 1. **Note that those last two steps seem to be the most important to trigger this rendering issue.** If the vertices are _perfectly uniform_ on the subdivided plane, the output looks fine. However, if the vertices form _slightly irregular quads, even if they are perfectly flatly aligned at z=0_, the weird triangles appear in the Cycles rendered output. 1. Switch back to object mode, go to the shading tab, and: 1. Add a new material. 1. In the new Principled BSDF, set emission color to white (`FFFFFF`). 1. Add a Fresnel node, and connect its `Fac` output to the Principled BSDF's `Emission Strength` input. 1. Switch the viewport shading to Rendered and rotate/pan until you can see the fresnel effect on the object. Since this is a flat plane, the effect will be very subtle and only visible as you approach it edge-on. 1. Compare the difference between 3.6.2 and 4.0.2. Looks great and smooth in 3.6.2, but weird triangles appear in 4.0.2. This problem isn't limited to just the Principled BSDF. I also tried feeding the Fresnel into a simple Emission shader and using an Add Shader node to combine that with another BSDF, and the same buggy triangles appeared. If I connect the Fresnel *directly* to the Material Output node without a BSDF node between them, the material looks smooth and normal as I would expect. So, the problem appears to be in **combining** the fresnel with other material properties somehow. Attached files are: * `fresnel-shader-issue.principled-bsdf.blend` - minimal demonstration file created using the steps I described above * `fresnel-shader-issue.add-shader-node.blend` - basically the same, but trying to use the Add Shader node (which didn't help) * `3.6.2-blender.png` - Blender 3.6.2 viewport in Cycles rendered mode. Looks good! ✅ * `3.6.2-principled-bsdf-render.png` - rendered output from Blender 3.6.2 using Cycles. Looks good! ✅ * `4.0.2-blender.png` - Blender 4.0.2 viewport in Cycles rendered mode. Looks bad. ❌ * `4.0.2-principled-bsdf-render.png` - rendered output from Blender 4.0.2 using Cycles. Looks bad. ❌ * `4.0.2-add-shader-node.png` - Blender 4.0.2 viewport in Cycles rendered mode, trying the Add Shader instead of one Principled BSDF node. Still looks bad. ❌ * `original-real-world-example.png` - 4.0.2 render from original real-world project where I discovered this issue. Boosted levels and sketched on (purple) after noticing glitches in the render. In this case, the mesh with the offending fresnel artifacts is also perfectly flat (on the ZY plane) but is made up of irregular triangles and quads, which is what I found to be the key issue in the reproduction steps above.
Brad Smith added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-03-23 03:51:34 +01:00
Member

I can confirm this issue in 4.1, but it's no longer present in Blender 4.2.

I assume this was fixed with 8cbc386152 which is only avaliable in Blender 4.2. @weizhen or @brecht , Do you want to add it to the list of changes to be back ported to 4.1.1 (See #119631)? Or just leave it as a fix for 4.2?

I can confirm this issue in 4.1, but it's no longer present in Blender 4.2. I assume this was fixed with 8cbc386152f3652f197f43af13402918d946c19e which is only avaliable in Blender 4.2. @weizhen or @brecht , Do you want to add it to the list of changes to be back ported to 4.1.1 (See #119631)? Or just leave it as a fix for 4.2?
Alaska added
Status
Needs Info from Developers
Module
Render & Cycles
and removed
Status
Needs Triage
labels 2024-03-23 06:14:08 +01:00
Alaska added this to the 4.1 milestone 2024-03-23 06:14:12 +01:00
Author

Thank you for checking and confirming so quickly! I did not realize this was already fixed in 4.2, but yes a backport to 4.1 would certainly be appreciated.

I just downloaded the latest 4.2 Alpha build, and I confirmed that this issue appears to be fixed for both my minimal reproduction file and the original blend file where I first noticed it. For now, I'll try using these 4.2 Alpha builds when I need this kind of emission in my renders.

Thank you for checking and confirming so quickly! I did not realize this was already fixed in 4.2, but yes a backport to 4.1 would certainly be appreciated. I just downloaded the latest 4.2 Alpha build, and I confirmed that this issue appears to be fixed for both my minimal reproduction file and the original blend file where I first noticed it. For now, I'll try using these 4.2 Alpha builds when I need this kind of emission in my renders.
Brecht Van Lommel modified the milestone from 4.1 to 4.2 LTS 2024-03-25 10:29:54 +01:00

Kernel changes are risky one day before the release, so I'm postponing this to 4.1.1 and 4.2.

Kernel changes are risky one day before the release, so I'm postponing this to 4.1.1 and 4.2.

This can actually be closed even though it's not going to be fixed in 4.1.0, since it's already in 4.2 and on the backports list now.

This can actually be closed even though it's not going to be fixed in 4.1.0, since it's already in 4.2 and on the backports list now.
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2024-03-25 10:31:41 +01:00
Brecht Van Lommel added
Status
Resolved
and removed
Status
Archived
labels 2024-03-25 10:31: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
3 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#119813
No description provided.