Cycles: Ambient Occlusion not working with OptiX OSL #108992
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108992
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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)
Enabling/disabling Open shading language changes the look of default shader nodesto Enabling/disabling Open shading language changes the look of preexsting shader nodesCan'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.
I can confirm the difference with Optix OSL
Guess the dark droplets are due to intersection with pool? (#96475)
On previous versions, CPU (with & without OSL) and GPU rendering results are bit different
![image](/blender/blender/attachments/f2d7ac19-b450-4bac-80f8-4f091092c600)
Enabling/disabling Open shading language changes the look of preexsting shader nodesto Cycles: Enabling/disabling OSL changes the look of pre-existing shader nodesThe darker droplets is because you mix with black based on ambient occlusion, and the pool is occluded by the droplets
![image](/blender/blender/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.
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
@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.
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)
https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html
Note that this is documented at https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html
@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.
It wasn't really possible to support previously, since OSL generates code that calls its intrinsics (like
texture("@ao", ...)
ortrace(...)
) 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.
Cycles: Enabling/disabling OSL changes the look of pre-existing shader nodesto Cycles: Ambient Occlusion not working with OptiX OSLI'll close this then.