Cycles: Ambient Occlusion not working with OptiX OSL #108992

Closed
opened 2023-06-14 23:29:42 +02:00 by jack conradsen · 11 comments

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

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: (newest version of Blender that worked as expected)

Short description of error
I can't find much info on osl within blender. As i understand it, the point is to be able to write your own shaders with scripts, it shouldn't change the functionality of preexisting shader nodes.

Optix without OSL and CPU (with & without OSL) device renders darker droplets.

Exact steps for others to reproduce the error
In rendered view. Enable/disable OSL and see the water droplets look drasticly different (OSL looks more correct, but that should just be the default behavior then)

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.49 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: (newest version of Blender that worked as expected) **Short description of error** I can't find much info on osl within blender. As i understand it, the point is to be able to write your own shaders with scripts, it shouldn't change the functionality of preexisting shader nodes. Optix without OSL and CPU (with & without OSL) device renders darker droplets. **Exact steps for others to reproduce the error** In rendered view. Enable/disable OSL and see the water droplets look drasticly different (OSL looks more correct, but that should just be the default behavior then)
jack conradsen added the
Status
Needs Triage
Type
Report
Severity
Normal
labels 2023-06-14 23:29:43 +02:00
jack conradsen changed title from Enabling/disabling Open shading language changes the look of default shader nodes to Enabling/disabling Open shading language changes the look of preexsting shader nodes 2023-06-14 23:29:59 +02:00
YimingWu added the
Interest
Render & Cycles
label 2023-06-15 04:06:31 +02:00
Member

Can't replicate the issue on CPU (my device doesn't have a GPU right now), the problem is probably limited to GPU, on CPU it looks like whether enabling OSL or not, it renders as the "darker droplets" result. Changing light path settings doesn't seem to improve the situation either.

图片

Can't replicate the issue on CPU (my device doesn't have a GPU right now), the problem is probably limited to GPU, on CPU it looks like whether enabling OSL or not, it renders as the "darker droplets" result. Changing light path settings doesn't seem to improve the situation either. ![图片](/attachments/71b1ac4d-e1de-43ff-bb3e-17995effa6df)
Member

I can confirm the difference with Optix OSL
Guess the dark droplets are due to intersection with pool? (#96475)

I can confirm the difference with Optix OSL Guess the dark droplets are due to intersection with pool? (#96475)
Member

On previous versions, CPU (with & without OSL) and GPU rendering results are bit different
image

On previous versions, CPU (with & without OSL) and GPU rendering results are bit different ![image](/attachments/f2d7ac19-b450-4bac-80f8-4f091092c600)
1.3 MiB
Pratik Borhade changed title from Enabling/disabling Open shading language changes the look of preexsting shader nodes to Cycles: Enabling/disabling OSL changes the look of pre-existing shader nodes 2023-06-15 06:03:10 +02:00
Pratik Borhade added
Module
Render & Cycles
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-06-15 06:05:06 +02:00
Brecht Van Lommel added
Type
Bug
and removed
Type
Report
labels 2024-06-14 16:01:40 +02:00
Member

The darker droplets is because you mix with black based on ambient occlusion, and the pool is occluded by the droplets
image
You can enable "Only Local" on the ambient occlusion node so the intersection with the droplets is ignored. Is that what you want?

As for the discrepancy w/wo OSL, if you choose OSL then all the shader nodes are implemented in OSL, not only the scripts you create. Probably the GPU OSL is not handling ambient occlusion correctly, but I don't have an OSL-compatible GPU to verify.

The darker droplets is because you mix with black based on ambient occlusion, and the pool is occluded by the droplets <img width="297" alt="image" src="attachments/0ce91947-aa7c-403a-90ad-c51c647d1618"> You can enable "Only Local" on the ambient occlusion node so the intersection with the droplets is ignored. Is that what you want? As for the discrepancy w/wo OSL, if you choose OSL then all the shader nodes are implemented in OSL, not only the scripts you create. Probably the GPU OSL is not handling ambient occlusion correctly, but I don't have an OSL-compatible GPU to verify.
260 KiB
Weizhen Huang added
Status
Needs Information from User
and removed
Status
Confirmed
labels 2024-08-19 18:20:57 +02:00
Author

i reported this a year ago so i do not know all the intricacies, but probably i didn't want ambient occlusion on the droplets, so i maybe made a mistake back then.

Regardless there probably shouldn't be any difference on existing nodes with/without osl, so if the difference is exclusively with Ambient Occlusion then that's the bug to fix i reckon

i reported this a year ago so i do not know all the intricacies, but probably i didn't want ambient occlusion on the droplets, so i maybe made a mistake back then. Regardless there probably shouldn't be any difference on existing nodes with/without osl, so if the difference is exclusively with Ambient Occlusion then that's the bug to fix i reckon
Member

@Sergey @pmoursnv would you like to have a check if ambient occlusion is working correctly on OptiX OSL?

In the test scene, the contact area of the pool and the water droplets should be black due to ambient occlusion, but doesn't seem to be the case with OptiX OSL, at least at the time when the bug was reported.

@Sergey @pmoursnv would you like to have a check if ambient occlusion is working correctly on OptiX OSL? In the test scene, the contact area of the pool and the water droplets should be black due to ambient occlusion, but doesn't seem to be the case with OptiX OSL, at least at the time when the bug was reported.
Member

@Sergey @pmoursnv would you like to have a check if ambient occlusion is working correctly on OptiX OSL?

OptiX OSL does not support the trace function needed for Ambient Occlusion to work. So the ambient occlusion node will always return a constant color (I can't remember if it's white or black)

The trace function is not functional. As a result of this, the Ambient Occlusion and Bevel nodes do not work.

https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html

> @Sergey @pmoursnv would you like to have a check if ambient occlusion is working correctly on OptiX OSL? OptiX OSL does not support the trace function needed for Ambient Occlusion to work. So the ambient occlusion node will always return a constant color (I can't remember if it's white or black) > The trace function is not functional. As a result of this, the Ambient Occlusion and Bevel nodes do not work. https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html
Member
Note that this is documented at https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html
Member

@pmoursnv Is there plan to support this functionality at any point? If it's documented behaviour I'm not sure if I should close the report or change to Known Issue.

@pmoursnv Is there plan to support this functionality at any point? If it's documented behaviour I'm not sure if I should close the report or change to Known Issue.
Member

It wasn't really possible to support previously, since OSL generates code that calls its intrinsics (like texture("@ao", ...) or trace(...)) via normal CUDA function calls, but OptiX trace may only be called from OptiX callables.
Technically OptiX can automatically inline all code up to the trace call, so this can probably be reevaluated and made working now. No timeline though.
Previous reports regarding this (#104082, #108973) were closed for the time being.

It wasn't really possible to support previously, since OSL generates code that calls its intrinsics (like `texture("@ao", ...)` or `trace(...)`) via normal CUDA function calls, but OptiX trace may only be called from OptiX callables. Technically OptiX can automatically inline all code up to the trace call, so this can probably be reevaluated and made working now. No timeline though. Previous reports regarding this (#104082, #108973) were closed for the time being.
Weizhen Huang changed title from Cycles: Enabling/disabling OSL changes the look of pre-existing shader nodes to Cycles: Ambient Occlusion not working with OptiX OSL 2024-08-21 17:39:56 +02:00
Member

I'll close this then.

I'll close this then.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2024-08-21 17:40:53 +02:00
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
6 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#108992
No description provided.