Fix #127205: OptiX error with OSL material using wavelength node #129372

Merged
Sergey Sharybin merged 2 commits from pmoursnv/blender:fix_optix_osl_wavelength_node into blender-v4.3-release 2024-10-31 12:47:58 +01:00
Member

The osl_wavelength_color_vf intrinsic was missing an implementation for OptiX, causing a link error when attempting to load OSL shaders using the wavelength node. This fixes that by simply copying over the implementation of svm_node_wavelength.

The `osl_wavelength_color_vf` intrinsic was missing an implementation for OptiX, causing a link error when attempting to load OSL shaders using the wavelength node. This fixes that by simply copying over the implementation of `svm_node_wavelength`.
Patrick Mours added 1 commit 2024-10-24 13:39:12 +02:00
Patrick Mours added this to the Render & Cycles project 2024-10-24 13:39:18 +02:00
Patrick Mours requested review from Sergey Sharybin 2024-10-24 13:40:00 +02:00

Thanks for looking into this!

The only suggestion I have is to avoid duplication and move the logic that does not depend on the shading backend to intern/cycles/kernel/svm/math_util.h (similarly to the svm_math_blackbody_color_rec709). So, i.e., SVM implementation can look like:

  const float lambda_nm = stack_load_float(stack, wavelength);
  const float3 color = svm_math_wavelenght_to_color(kg, lambda_nm);
  stack_store_float3(stack, color_out, color);

Not sure if you've tried following this root. There might be some obstacles avoid duplication that are not immediately obvious?

Thanks for looking into this! The only suggestion I have is to avoid duplication and move the logic that does not depend on the shading backend to `intern/cycles/kernel/svm/math_util.h` (similarly to the `svm_math_blackbody_color_rec709`). So, i.e., SVM implementation can look like: ``` const float lambda_nm = stack_load_float(stack, wavelength); const float3 color = svm_math_wavelenght_to_color(kg, lambda_nm); stack_store_float3(stack, color_out, color); ``` Not sure if you've tried following this root. There might be some obstacles avoid duplication that are not immediately obvious?
Patrick Mours added 1 commit 2024-10-25 18:19:58 +02:00
Move wavelength to color code into utility function
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
799660e94b
Author
Member

Moved the majority into an utility function (hadn't it originally to keep the change smaller, but it's certainly nicer this way). It's a bit more difficult to move the whole thing unfortunately, since xyz_to_rgb relies on the KernelGlobals type declaration, but intern/cycles/kernel/svm/math_util.h is also included in intern/cycles/scene/shader_nodes.cpp, where that type is not available (and it feels wrong to add an include just for this there).

Moved the majority into an utility function (hadn't it originally to keep the change smaller, but it's certainly nicer this way). It's a bit more difficult to move the whole thing unfortunately, since `xyz_to_rgb` relies on the `KernelGlobals` type declaration, but `intern/cycles/kernel/svm/math_util.h` is also included in `intern/cycles/scene/shader_nodes.cpp`, where that type is not available (and it feels wrong to add an include just for this there).

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR129372) when ready.
Sergey Sharybin approved these changes 2024-10-31 12:44:56 +01:00
Sergey Sharybin left a comment
Owner

Tested on Win11 with 6000 Ada, seems to work great!

Tested on Win11 with 6000 Ada, seems to work great!
Sergey Sharybin merged commit 3a36d638a5 into blender-v4.3-release 2024-10-31 12:47:58 +01:00
Sergey Sharybin deleted branch fix_optix_osl_wavelength_node 2024-10-31 12:48:06 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
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 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#129372
No description provided.