Skip to content

Getting stencil_color or stencil_outline_thickness from StandardMaterial3D returns wrong value #108962

@DanielGSilva

Description

@DanielGSilva

Tested versions

  • Reproducible in 4.5.beta3

System information

Godot v4.5.beta3.mono - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 (NVIDIA; 32.0.15.6094) - 13th Gen Intel(R) Core(TM) i5-13500 (20 threads) - 31.78 GiB memory

Issue description

When using duplicate() on a StandardMaterial3D, its stencil material properties are on the next_pass material, which is not duplicated (this is expected, because we're not using deep_duplicate()). This results in changes of the stencil properties on one material affecting both materials. However, if you retrieve the stencil properties on the material that was not explicitly altered, you get their previous value.

Steps to reproduce

  1. Create a StandardMaterial3D
  2. Set stencil_mode to STENCIL_MODE_OUTLINE or STENCIL_MODE_XRAY
  3. Create another StandardMaterial3D using duplicate()
  4. Change the value of stencil_color or stencil_outline_thickness
  5. Assign the materials to 2 different meshes
  6. Print the values of the changed properties in both materials
  7. Same properties on both meshes can be observed, but different values were printed

Minimal reproduction project (MRP)

stencil_getters_mrp.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions