Script node with shader output crashes Eevee #101702

Open
opened 2022-10-08 18:34:47 +02:00 by Mark Bolstad · 18 comments

System Information
Operating system: OSX Monterey (12.6)
Graphics card: Radeon Pro Vega 20

Blender Version
Broken: git versions: blender-v3.2-release, blender-v3.3-release, master
Worked: 3.2 release

Short description of error
I'm testing the MaterialX standard surface shader. It seems to work when in Release versions, but in a debug build, it crashes when you connect the output of the shader to 'surface' in the terminal node.

Exact steps for others to reproduce the error
Using the default scene, switch from Eevee to Cycles + Open Shading Language. Select the Cube, switch to Shading tab. Create a new material, and add a new Script node. Load the attached .oso file (to compile the attached .osl, you need to have MaterialX installed. I'm using 1.38.5). Attach the output of the script node to the 'Surface' input of the terminal. Boom! Where the crash occurs depends on whether your in Eevee preview, or Cycles preview.

out.osl

out1.oso

**System Information** Operating system: OSX Monterey (12.6) Graphics card: Radeon Pro Vega 20 **Blender Version** Broken: git versions: blender-v3.2-release, blender-v3.3-release, master Worked: 3.2 release **Short description of error** I'm testing the MaterialX standard surface shader. It seems to work when in Release versions, but in a debug build, it crashes when you connect the output of the shader to 'surface' in the terminal node. **Exact steps for others to reproduce the error** Using the default scene, switch from Eevee to Cycles + Open Shading Language. Select the Cube, switch to Shading tab. Create a new material, and add a new Script node. Load the attached .oso file (to compile the attached .osl, you need to have MaterialX installed. I'm using 1.38.5). Attach the output of the script node to the 'Surface' input of the terminal. Boom! Where the crash occurs depends on whether your in Eevee preview, or Cycles preview. [out.osl](https://archive.blender.org/developer/F13638808/out.osl) [out1.oso](https://archive.blender.org/developer/F13638809/out1.oso)
Author

Added subscriber: @Mark-Alan-Bolstad

Added subscriber: @Mark-Alan-Bolstad

Added subscriber: @deadpin

Added subscriber: @deadpin

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Things seem ok here using your provided .oso file when using 3.3 and master at least:
osl.png

This is on Windows though. Is there some step that might be missing in order to reproduce the crash?

Things seem ok here using your provided .oso file when using 3.3 and master at least: ![osl.png](https://archive.blender.org/developer/F13639839/osl.png) This is on Windows though. Is there some step that might be missing in order to reproduce the crash?

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

Actually, I can confirm (mixed up builds locally).

When using a Debug build configuration the asserts will be active and you'll hit the following:

Assertion failed: input.type == SocketType::BOOLEAN, file D:\source\blender-git\blender\intern\cycles\graph\node.cpp, line 59

ucrtbased.dll       :0x00007FFC3DC539F0  wassert
blender.exe         :0x00007FF7A06BEF20  ccl::Node::set D:\source\blender-git\blender\intern\cycles\graph\node.cpp:59
blender.exe         :0x00007FF7A05E4BE0  ccl::set_default_value D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:209
blender.exe         :0x00007FF7A05CCA80  ccl::add_nodes D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1356
blender.exe         :0x00007FF7A05CC940  ccl::add_nodes D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1421
blender.exe         :0x00007FF7A05E9090  ccl::BlenderSync::sync_materials D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1452
blender.exe         :0x00007FF7A05E9970  ccl::BlenderSync::sync_shaders D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1718
blender.exe         :0x00007FF7A0560C20  ccl::BlenderSync::sync_data D:\source\blender-git\blender\intern\cycles\blender\sync.cpp:270
blender.exe         :0x00007FF7A052A130  ccl::BlenderSession::synchronize D:\source\blender-git\blender\intern\cycles\blender\session.cpp:772

There might be more issues after but the assert is triggered on the thin_walled input, which is of type int but wants to be treated like a boolean.

Actually, I can confirm (mixed up builds locally). When using a Debug build configuration the asserts will be active and you'll hit the following: ``` Assertion failed: input.type == SocketType::BOOLEAN, file D:\source\blender-git\blender\intern\cycles\graph\node.cpp, line 59 ucrtbased.dll :0x00007FFC3DC539F0 wassert blender.exe :0x00007FF7A06BEF20 ccl::Node::set D:\source\blender-git\blender\intern\cycles\graph\node.cpp:59 blender.exe :0x00007FF7A05E4BE0 ccl::set_default_value D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:209 blender.exe :0x00007FF7A05CCA80 ccl::add_nodes D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1356 blender.exe :0x00007FF7A05CC940 ccl::add_nodes D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1421 blender.exe :0x00007FF7A05E9090 ccl::BlenderSync::sync_materials D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1452 blender.exe :0x00007FF7A05E9970 ccl::BlenderSync::sync_shaders D:\source\blender-git\blender\intern\cycles\blender\shader.cpp:1718 blender.exe :0x00007FF7A0560C20 ccl::BlenderSync::sync_data D:\source\blender-git\blender\intern\cycles\blender\sync.cpp:270 blender.exe :0x00007FF7A052A130 ccl::BlenderSession::synchronize D:\source\blender-git\blender\intern\cycles\blender\session.cpp:772 ``` There might be more issues after but the assert is triggered on the `thin_walled` input, which is of type `int` but wants to be treated like a `boolean`.
Author

In render preview, it assert at the above.
In Material Preview mode, it asserts here (same reason though, int->bool):

  frame #2: 0x00007ff81a8dad24 libsystem_c.dylib`abort + 123
  • frame #3: 0x000000011909f6c9 Blender`_BLI_assert_abort at BLI_assert.c:46:3
  frame #4: 0x000000010aacbcd6 Blender`ntree_shader_weight_tree_invert(ntree=0x00007fc34070bee8, output_node=0x00007fc300723e38) at node_shader_tree.cc:899:11
  frame #5: 0x000000010aac9e97 Blender`::ntreeGPUMaterialNodes(localtree=0x00007fc34070bee8, mat=0x00007fc3407e37e8) at node_shader_tree.cc:1045:5
  frame #6: 0x0000000116bdbbbc Blender`GPU_material_from_nodetree(scene=0x00007fc342304008, ma=0x00007fc310c97cf8, ntree=0x00007fc310c99288, gpumaterials=0x00007fc310c97e48, name="MAMaterial.002", shader_uuid=1, is_volume_shader=false, is_lookdev=false, callback=(Blender`eevee_material_post_eval at eevee_shaders.c:1432), thunk=0x0000000000000000) at gpu_material.c:679:3
  frame #7: 0x0000000109aeee56 Blender`DRW_shader_from_material(ma=0x00007fc310c97cf8, ntree=0x00007fc310c99288, shader_id=1, is_volume_shader=false, deferred=true, callback=(Blender`eevee_material_post_eval at eevee_shaders.c:1432), thunk=0x0000000000000000) at draw_manager_shader.c:399:22
  frame #8: 0x0000000109a077bf Blender`eevee_material_get_ex(UNUSED_scene=0x00007fc342413608, ma=0x00007fc310c97cf8, wo=0x0000000000000000, options=1, deferred=true) at eevee_shaders.c:1460:11
  frame #9: 0x0000000109a07dc4 Blender`EEVEE_material_get(vedata=0x00007fc32080b018, scene=0x00007fc342413608, ma=0x00007fc310c97cf8, wo=0x0000000000000000, options=1) at eevee_shaders.c:1489:22
In render preview, it assert at the above. In Material Preview mode, it asserts here (same reason though, int->bool): ``` frame #2: 0x00007ff81a8dad24 libsystem_c.dylib`abort + 123 ``` * frame #3: 0x000000011909f6c9 Blender`_BLI_assert_abort at BLI_assert.c:46:3 ``` frame #4: 0x000000010aacbcd6 Blender`ntree_shader_weight_tree_invert(ntree=0x00007fc34070bee8, output_node=0x00007fc300723e38) at node_shader_tree.cc:899:11 frame #5: 0x000000010aac9e97 Blender`::ntreeGPUMaterialNodes(localtree=0x00007fc34070bee8, mat=0x00007fc3407e37e8) at node_shader_tree.cc:1045:5 frame #6: 0x0000000116bdbbbc Blender`GPU_material_from_nodetree(scene=0x00007fc342304008, ma=0x00007fc310c97cf8, ntree=0x00007fc310c99288, gpumaterials=0x00007fc310c97e48, name="MAMaterial.002", shader_uuid=1, is_volume_shader=false, is_lookdev=false, callback=(Blender`eevee_material_post_eval at eevee_shaders.c:1432), thunk=0x0000000000000000) at gpu_material.c:679:3 frame #7: 0x0000000109aeee56 Blender`DRW_shader_from_material(ma=0x00007fc310c97cf8, ntree=0x00007fc310c99288, shader_id=1, is_volume_shader=false, deferred=true, callback=(Blender`eevee_material_post_eval at eevee_shaders.c:1432), thunk=0x0000000000000000) at draw_manager_shader.c:399:22 frame #8: 0x0000000109a077bf Blender`eevee_material_get_ex(UNUSED_scene=0x00007fc342413608, ma=0x00007fc310c97cf8, wo=0x0000000000000000, options=1, deferred=true) at eevee_shaders.c:1460:11 frame #9: 0x0000000109a07dc4 Blender`EEVEE_material_get(vedata=0x00007fc32080b018, scene=0x00007fc342413608, ma=0x00007fc310c97cf8, wo=0x0000000000000000, options=1) at eevee_shaders.c:1489:22

This issue was referenced by 7e942b2a1e

This issue was referenced by 7e942b2a1e3d4d72ba90b498a514455452eab94c

This issue was referenced by aaa731a782

This issue was referenced by aaa731a7823a986c37745a9c48b485ce03205593
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Lukas Stockner self-assigned this 2022-10-10 01:33:45 +02:00
Member

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
Member

I found and fixed the Cycles-side crash, but the one in material preview is unrelated from what I can tell.

In Cycles, the crash happened because of the boolean input.

However, the material preview appears to crash for any OSL node that outputs a shader. It appears that the issue is that unlike regular BSDF nodes, the Script node does not have a hidden Weight input, which confuses ntree_shader_weight_tree_invert. The fix probably is to just ignore the script node since OSL is not supposed to work for Eevee anyways.

I found and fixed the Cycles-side crash, but the one in material preview is unrelated from what I can tell. In Cycles, the crash happened because of the boolean input. However, the material preview appears to crash for any OSL node that outputs a shader. It appears that the issue is that unlike regular BSDF nodes, the Script node does not have a hidden Weight input, which confuses `ntree_shader_weight_tree_invert`. The fix probably is to just ignore the script node since OSL is not supposed to work for Eevee anyways.
Lukas Stockner removed their assignment 2022-10-10 01:58:45 +02:00
Member

Added subscriber: @LukasStockner

Added subscriber: @LukasStockner
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Philipp Oeser self-assigned this 2022-10-26 10:55:32 +02:00
Member

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
Philipp Oeser was unassigned by Lukas Stockner 2022-10-28 00:11:00 +02:00
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Looks like this got auto-closed by the backport commit again. The material preview issue is still present, though.

Looks like this got auto-closed by the backport commit again. The material preview issue is still present, though.
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:04:06 +01:00
Brecht Van Lommel added
Module
EEVEE & Viewport
Interest
Render & Cycles
and removed
Module
Render & Cycles
labels 2023-02-09 14:37:43 +01:00
Brecht Van Lommel changed title from MaterialX Standard Surface (OSL) crashes Blender in debug to Script node with shader output crashes Eevee 2023-02-09 14:38:02 +01:00

Changing title and module now to make it clear where the remaining issue is.

Changing title and module now to make it clear where the remaining issue is.
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
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#101702
No description provided.