Cycles: various curve rendering issues #124295

Open
opened 2024-07-07 08:49:48 +02:00 by Fernando Alcala · 3 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 556.12

Blender Version
Broken: version: 4.2.0 Beta, branch: blender-v4.2-release, commit date: 2024-07-04 21:57, hash: c94bed9afa0d

For all of the following cases, a single curve was created with its default settings: add empty hair on default cube, enter sculpt mode, and place one strand on the cube. For its mesh representative to directly compare against, a point was selected on the curve in edit mode, the 3D cursor was moved to it, and a cylinder of equal radius was created with no cap.

Blend files provided.


Case 1
The inside backface does not render on GPU.

CPU GPU
case 1 cpu.png case 1 gpu.png

Case 2
The frontface transmits light when it shouldn't.
This scene has a curve on the left and a mesh cylinder on the right, both have a Suzanne placed inside. The curve and mesh share a material that sets camera rays to be transparent. The single light in this scene is positioned so that it is impossible for light to enter the inside, with a cube at the bottom to block the potential possibility of light leaking through an unnoticeable gap. The curve is clearly incorrect. If you do not trust the material, you can set the curve to diffuse and look through the top camera instead. There is also a difference between CPU and GPU.

CPU GPU
case 2.png case 2 gpu.png

Case 3
GPU has ringing artifacts when looking down on a curve.
Curves with a taper make more pronounced rings.

Straight curve Tapered curve
case 3 straight.png case 3 taper.png

Case 4
At certain viewing angles, a curve's shading changes.
This scene only has one light. When looking at the curve at a "common" angle, the side facing the light source predictably is brighter than the shadow side.
case 4 common.png
However, as our viewing angle changes, we can see a distinct teardrop shape. Inside the teardrop the shading is correct, but outside of the teardrop the shading is incorrect. Very easy to see on tapered curves, but harder to see on straight curves. The straight curve image is set up so that the camera is at the very top of the curve and it has just "fallen off", looking straight down

tapered curve straight curve straight mesh
case 4 2d teardrop.png case 4 straight.png case 4 mesh straight.png

When the view is directly above the curve, the side facing the light is dark while the side in the shadow is bright.
case 4 0d taper.png
This shading error is present at any viewing angle on a tapered curve. Here is a camera on the floor, angled 85degrees nearly perpendicular to the curve, and a thin line of bright shading is still visible (which is also seen in Case 4's first image).
case 4 85d taper base.png


Case 5a
Light rendering difference between CPU and GPU with hair or glass.
This scene has an icosphere inside a curve with a glass BSDF, CPU properly shows path tracing limitations with SDS caustics while GPU is clearly incorrect. Probably related to Case 2, or this is just Case 2 but with transparent materials.

CPU GPU
case 5a curve glass cpu.png case 5a curve glass gpu.png

Case 5b
There are refraction differences between glass and hair shaders on a curve which are different than mesh with glass.

curve glass mesh glass curve hair
case 5a curve glass cpu.png case 5b mesh glass.png case 5b curve hair.png

Interestingly, the backface seems to be correct between curve glass and mesh glass.

curve glass mesh glass curve hair
case 5b backface curve glass.png case 5b backface mesh glass.png case 5b backface curve hair.png

Case 5c
Refraction difference between 3D curve and ribbon shapes. The area around the ground and the icosphere is expected, but the refraction of Suzanne should(?) be similar.

curve glass curve hair ribbon glass ribbon hair
case 5a curve glass cpu.png case 5b curve hair.png case 5c ribbon glass.png case 5c ribbon hair.png
**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 556.12 **Blender Version** Broken: version: 4.2.0 Beta, branch: blender-v4.2-release, commit date: 2024-07-04 21:57, hash: `c94bed9afa0d` For all of the following cases, a single curve was created with its default settings: add empty hair on default cube, enter sculpt mode, and place one strand on the cube. For its mesh representative to directly compare against, a point was selected on the curve in edit mode, the 3D cursor was moved to it, and a cylinder of equal radius was created with no cap. Blend files provided. --- **Case 1** The inside backface does not render on GPU. |CPU|GPU| |--|--| |![case 1 cpu.png](/attachments/96db8069-48af-4d31-bc84-9e739d7ccf30)|![case 1 gpu.png](/attachments/270a73f5-4ac2-46b6-97e8-711da2134189)| --- **Case 2** The frontface transmits light when it shouldn't. This scene has a curve on the left and a mesh cylinder on the right, both have a Suzanne placed inside. The curve and mesh share a material that sets camera rays to be transparent. The single light in this scene is positioned so that it is impossible for light to enter the inside, with a cube at the bottom to block the potential possibility of light leaking through an unnoticeable gap. The curve is clearly incorrect. If you do not trust the material, you can set the curve to diffuse and look through the top camera instead. There is also a difference between CPU and GPU. | CPU | GPU | | --|-- | |![case 2.png](/attachments/0399ab8b-6855-4e4b-953a-39c75c6596fc)| ![case 2 gpu.png](/attachments/b0b8c033-0f38-424b-8a86-89ce90eb0d1a)| --- **Case 3** GPU has ringing artifacts when looking down on a curve. Curves with a taper make more pronounced rings. | Straight curve | Tapered curve | |--|--| |![case 3 straight.png](/attachments/262f6c94-e136-4948-8c33-07998eab16fc)|![case 3 taper.png](/attachments/2ccf61a3-f889-4e64-b22c-8abee7953326)| --- **Case 4** At certain viewing angles, a curve's shading changes. This scene only has one light. When looking at the curve at a "common" angle, the side facing the light source predictably is brighter than the shadow side. ![case 4 common.png](/attachments/98b55990-5735-4a26-9382-a0075a6b0a9f) However, as our viewing angle changes, we can see a distinct teardrop shape. Inside the teardrop the shading is correct, but outside of the teardrop the shading is incorrect. Very easy to see on tapered curves, but harder to see on straight curves. The straight curve image is set up so that the camera is at the very top of the curve and it has just "fallen off", looking straight down | tapered curve | straight curve | straight mesh | |--|--|--| | ![case 4 2d teardrop.png](/attachments/f8f2b1cb-6d70-4abc-b0ba-fd107d73576f)| ![case 4 straight.png](/attachments/9f50987f-685d-4eab-957a-6cc334ba3ad0)| ![case 4 mesh straight.png](/attachments/33bb5a4a-38c8-4d51-b747-47fff684bc80)| When the view is directly above the curve, the side facing the light is dark while the side in the shadow is bright. ![case 4 0d taper.png](/attachments/1e3db615-5b6e-46e5-8753-5e8aa9e35f12) This shading error is present at any viewing angle on a tapered curve. Here is a camera on the floor, angled 85degrees nearly perpendicular to the curve, and a thin line of bright shading is still visible (which is also seen in Case 4's first image). ![case 4 85d taper base.png](/attachments/b8f6d802-74ea-4cc2-8421-03007374a71c) --- **Case 5a** Light rendering difference between CPU and GPU with hair or glass. This scene has an icosphere inside a curve with a glass BSDF, CPU properly shows path tracing limitations with SDS caustics while GPU is clearly incorrect. Probably related to Case 2, or this is just Case 2 but with transparent materials. | CPU | GPU | |--|--| | ![case 5a curve glass cpu.png](/attachments/7ecf6965-3691-45e2-beb2-7eaca75dd20e)| ![case 5a curve glass gpu.png](/attachments/e0777648-b183-4fab-b1cd-c4ea2c80f270)| **Case 5b** There are refraction differences between glass and hair shaders on a curve which are different than mesh with glass. | curve glass | mesh glass | curve hair | |--|--|--| | ![case 5a curve glass cpu.png](/attachments/7ecf6965-3691-45e2-beb2-7eaca75dd20e)| ![case 5b mesh glass.png](/attachments/5062a630-ed71-4f00-ab07-ee454f0b603b)| ![case 5b curve hair.png](/attachments/d4eb68f5-cb60-44ba-b2c6-3a38d4a24314)| Interestingly, the backface seems to be correct between curve glass and mesh glass. | curve glass | mesh glass | curve hair | |--|--|--| | ![case 5b backface curve glass.png](/attachments/d14c537b-2cfc-438c-8d50-60cb102e3147)| ![case 5b backface mesh glass.png](/attachments/0c6bf4de-a9b0-4cb5-a4f5-29c42d9415c8)| ![case 5b backface curve hair.png](/attachments/c1fb476d-1261-408c-af14-14d7b04b1694)| **Case 5c** Refraction difference between 3D curve and ribbon shapes. The area around the ground and the icosphere is expected, but the refraction of Suzanne should(?) be similar. | curve glass | curve hair | ribbon glass | ribbon hair| |--|--|--|--| | ![case 5a curve glass cpu.png](/attachments/7ecf6965-3691-45e2-beb2-7eaca75dd20e)| ![case 5b curve hair.png](/attachments/d4eb68f5-cb60-44ba-b2c6-3a38d4a24314)| ![case 5c ribbon glass.png](/attachments/3fe02ac9-6423-4242-a3ed-0e9d038a66e3)| ![case 5c ribbon hair.png](/attachments/1111e5bc-aa9a-4f96-a307-a7d0bbf6d832)|
Fernando Alcala added the
Type
Report
Severity
Normal
Status
Needs Triage
labels 2024-07-07 08:49:49 +02:00
Member

For future reference, please report one bug per report. All these issues are related to hair, but some issues are different from each other and should probably be reported separately.


Case 1:

Embree and Embree GPU do not do backface culling on 3D curves. BVH2 (Used by CUDA, HIP, oneAPI, and Metal), OptiX, HIP-RT, and MetalRT all do backface culling.

Looking at the documentation for OptiX, it doesn't seem like we can turn on backface culling. And it's probably the same for HIP-RT and MetalRT. But in Embree it seems backface culling can be turned on for curves with a cmake variable. So the best approach for consistency is to enable backface culling on Embree?

Edit: It seems like back face culling for curves is already turned on:

-DEMBREE_BACKFACE_CULLING_CURVES=ON

But it doesn't work with some curve types: https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/will-EMBREE-BACKFACE-CULLING-CURVES-ever-work-with-RTC-GEOMETRY/m-p/1282534#M913


Case 2:

With CPU/Embree. Ī could be wrong here, but it seems like rays bouncing off the curve can not intersect with the (inside?) of the same curve again. And so the rays bounce off the monkey head, hit the curve, then bounces off and passes straight through the curve.

The descripency between Embree and all other BVH options in case 2 is likely the same as case 1, backface culling on the first bounce.


Case 3:

The user mentions rings on the inside of the straight curve on the GPU. I can reproduce this with a RTX 4090 with OptiX. But can not reproduce this issue with BVH2, HIP-RT, Metal-RT, Embree GPU and CPU.

This is likely this limitation mentioned in the OptiX documentation, but I could be wrong:

While the tube is mostly hollow, in the current implementation a ray can hit an internal
endcap, meaning an endcap between two segments of a strand. For typical curves that
are much longer than they are wide, this is often not noticeable. To avoid hitting internal
endcaps, adjust secondary rays to launch from outside the tube.

The user mentions pronounced rings on a tapered curve. I can not reproduce this. Maybe a difference between software and hardware tracing in OptiX? Or I'm just doing something wrong. @Fernando-Alcala Can you share the steps to reproduce?


Case 4:

I couldn't reproduce the cases, or was doing something wrong. @Fernando-Alcala can you provide clearer steps to reproduce, or share a .blend file setup specifically for this issue?


Case 5:

Case 5a:

Probably just case 1 again.

Case 5b:

In the glass cyclinder vs glass curve comparison, I assume we're seeing case 2 again.

All other case 5 examples:

I'm not 100% sure what's causing that.

For future reference, please report one bug per report. All these issues are related to hair, but some issues are different from each other and should probably be reported separately. --- ### Case 1: Embree and Embree GPU do not do backface culling on 3D curves. BVH2 (Used by CUDA, HIP, oneAPI, and Metal), OptiX, HIP-RT, and MetalRT all do backface culling. Looking at the documentation for OptiX, it doesn't seem like we can turn on backface culling. And it's probably the same for HIP-RT and MetalRT. But in Embree it seems backface culling can be turned on for curves with a cmake variable. So the best approach for consistency is to enable backface culling on Embree? Edit: It seems like back face culling for curves is already turned on: https://projects.blender.org/blender/blender/src/commit/d58f1f614eda03fbe322b42e0cd6429a942b1b7b/build_files/build_environment/cmake/embree.cmake#L17 But it doesn't work with some curve types: https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/will-EMBREE-BACKFACE-CULLING-CURVES-ever-work-with-RTC-GEOMETRY/m-p/1282534#M913 --- ### Case 2: With CPU/Embree. Ī could be wrong here, but it seems like rays bouncing off the curve can not intersect with the (inside?) of the same curve again. And so the rays bounce off the monkey head, hit the curve, then bounces off and passes straight through the curve. The descripency between Embree and all other BVH options in case 2 is likely the same as case 1, backface culling on the first bounce. --- ### Case 3: The user mentions rings on the inside of the straight curve on the GPU. I can reproduce this with a RTX 4090 with OptiX. But can not reproduce this issue with BVH2, HIP-RT, Metal-RT, Embree GPU and CPU. This is likely this limitation mentioned in the [OptiX documentation](https://raytracing-docs.nvidia.com/optix7/guide/optix_guide.230712.A4.pdf), but I could be wrong: >While the tube is mostly hollow, in the current implementation a ray can hit an internal endcap, meaning an endcap between two segments of a strand. For typical curves that are much longer than they are wide, this is often not noticeable. To avoid hitting internal endcaps, adjust secondary rays to launch from outside the tube. The user mentions pronounced rings on a [tapered curve](https://projects.blender.org/blender/blender/attachments/2ccf61a3-f889-4e64-b22c-8abee7953326). I can not reproduce this. Maybe a difference between software and hardware tracing in OptiX? Or I'm just doing something wrong. @Fernando-Alcala Can you share the steps to reproduce? --- ### Case 4: I couldn't reproduce the cases, or was doing something wrong. @Fernando-Alcala can you provide clearer steps to reproduce, or share a .blend file setup specifically for this issue? --- ### Case 5: #### Case 5a: Probably just case 1 again. #### Case 5b: In the glass cyclinder vs glass curve comparison, I assume we're seeing case 2 again. #### All other case 5 examples: I'm not 100% sure what's causing that.
Alaska added
Module
Render & Cycles
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-07-07 11:45:32 +02:00

I add here a new Blend file with unique scenes to produce each image in Case 4.
The straight curve seems to only have the issue on CPU and only when the ray that hits the outside also hits the inside where that inside face has to be lit.

To reproduce rings on GPU on a tapered curve in Case 3, open the new Blend file and select the tapered curve or directly above taper scene. It happens on OptiX but not CUDA. But CUDA has a hole appear.
case 3 top taper CUDA.png case 3 side taper CUDA.png

I add here a new Blend file with unique `scenes` to produce each image in Case 4. The straight curve seems to only have the issue on CPU and only when the ray that hits the outside also hits the inside where that inside face has to be lit. To reproduce rings on GPU on a tapered curve in Case 3, open the new Blend file and select the `tapered curve` or `directly above taper` scene. It happens on OptiX but not CUDA. But CUDA has a hole appear. ![case 3 top taper CUDA.png](/attachments/83c66ef3-2747-498d-9c66-1462ab9c69d4) ![case 3 side taper CUDA.png](/attachments/70effcba-6c74-46a7-85b1-a47b175bcd50)
Bart van der Braak added
Type
Bug
and removed
Type
Report
labels 2024-08-14 12:57:41 +02:00

Currently hair strands are designed to be used for non-closeup hair rendering and shading. There are a number of optimizations possible to support these use-cases, but they come with a drawback. The GPU behavior is closer to what the intended design is, so the CPU would need to align to GPU.
This will make it so the backface culling is enabled, and that objects inside of the hair strands would not be rendered the way one might expect. And also some BSDFs might not be working the same as if they are applied on a real geometry.

In the longer term we'd need to add an option on a Curves object to specify its intended use (is it just a non-renderable helper, is it a hair, or, potentially, a 3D curve). When the design for that is clear and finalized the Cycles side of rendering curves/hair would need to be adjusted accordingly.

This is also something we've discussed with artists here at the studio, and it is an understandable limitations for the short term.

Currently hair strands are designed to be used for non-closeup hair rendering and shading. There are a number of optimizations possible to support these use-cases, but they come with a drawback. The GPU behavior is closer to what the intended design is, so the CPU would need to align to GPU. This will make it so the backface culling is enabled, and that objects inside of the hair strands would not be rendered the way one might expect. And also some BSDFs might not be working the same as if they are applied on a real geometry. In the longer term we'd need to add an option on a Curves object to specify its intended use (is it just a non-renderable helper, is it a hair, or, potentially, a 3D curve). When the design for that is clear and finalized the Cycles side of rendering curves/hair would need to be adjusted accordingly. This is also something we've discussed with artists here at the studio, and it is an understandable limitations for the short term.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#124295
No description provided.