diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-13 22:34:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-13 22:34:50 +0100 |
commit | ae66a4b301495911f8b4e68e20be282f00402e29 (patch) | |
tree | e1c4222dcfee4cc6829a2ea0b24e12c7e6eeb9fc /doc/classes | |
parent | 030a95dd611322a62e1200b722e03b035d13eaf5 (diff) | |
parent | 28410476576c7dd5adb1e40e8c6f29e19cd4585a (diff) |
Merge pull request #71235 from Calinou/doc-shader-per-instance-uniforms
Clarify the difference between uniforms and per-instance uniforms in docs
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/GeometryInstance3D.xml | 5 | ||||
-rw-r--r-- | doc/classes/ShaderMaterial.xml | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/doc/classes/GeometryInstance3D.xml b/doc/classes/GeometryInstance3D.xml index 1ae4718536..127c5daf95 100644 --- a/doc/classes/GeometryInstance3D.xml +++ b/doc/classes/GeometryInstance3D.xml @@ -21,7 +21,10 @@ <param index="0" name="name" type="StringName" /> <param index="1" name="value" type="Variant" /> <description> - Set the value of a shader parameter for this instance only. + Set the value of a shader uniform for this instance only ([url=$DOCS_URL/tutorials/shaders/shader_reference/shading_language.html#per-instance-uniforms]per-instance uniform[/url]). See also [method ShaderMaterial.set_shader_parameter] to assign a uniform on all instances using the same [ShaderMaterial]. + [b]Note:[/b] For a shader uniform to be assignable on a per-instance basis, it [i]must[/i] be defined with [code]instance uniform ...[/code] rather than [code]uniform ...[/code] in the shader code. + [b]Note:[/b] [param name] is case-sensitive and must match the name of the uniform in the code exactly (not the capitalized name in the inspector). + [b]Note:[/b] Per-instance shader uniforms are currently only available in 3D, so there is no 2D equivalent of this method. </description> </method> </methods> diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml index 1af7ac4fc5..a2346822e5 100644 --- a/doc/classes/ShaderMaterial.xml +++ b/doc/classes/ShaderMaterial.xml @@ -23,7 +23,8 @@ <param index="1" name="value" type="Variant" /> <description> Changes the value set for this material of a uniform in the shader. - [b]Note:[/b] [param param] must match the name of the uniform in the code exactly. + [b]Note:[/b] [param param] is case-sensitive and must match the name of the uniform in the code exactly (not the capitalized name in the inspector). + [b]Note:[/b] Changes to the shader uniform will be effective on all instances using this [ShaderMaterial]. To prevent this, use per-instance uniforms with [method GeometryInstance3D.set_instance_shader_parameter] or duplicate the [ShaderMaterial] resource using [method Resource.duplicate]. Per-instance uniforms allow for better shader reuse and are therefore faster, so they should be preferred over duplicating the [ShaderMaterial] when possible. </description> </method> </methods> |