From d3a263f034d687027bb18df0f4ce80c6a7df3936 Mon Sep 17 00:00:00 2001 From: Digvijaysinh Gohil Date: Sun, 24 Dec 2023 20:54:36 +0530 Subject: [PATCH] Documentation for Parallax mapping node added --- README.md | 17 +++++++++++++++++ addons/ShaderLib/UV/ParallaxMappingUV.gd | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index c599aec..d2cda14 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,23 @@ This node can be used to create a texture animation functionality, commonly used |end frame|int|none|End tile index texture sheet| |anim speed|float|none|Animation speed| +**Outputs** +|Name|Type|Binding|Description| +|---|---|---|---| +|uv|vec2|None|Output UV value| +___ + +
+

Parallax mapping node

+The Parallax Mapping node lets you create a parallax effect that displaces a Material's UVs to create the illusion of depth inside a Material.

This node is only available in shader modes SPATIAL and CANVAS ITEM. +
+ +**Inputs** +|Name|Type|Binding|Description| +|---|---|---|---| +|height map|sampler2D|none|Height map texture| +|amplitude|float|none|amplitude or depth of the effect| + **Outputs** |Name|Type|Binding|Description| |---|---|---|---| diff --git a/addons/ShaderLib/UV/ParallaxMappingUV.gd b/addons/ShaderLib/UV/ParallaxMappingUV.gd index 8d7f956..5ac67f8 100644 --- a/addons/ShaderLib/UV/ParallaxMappingUV.gd +++ b/addons/ShaderLib/UV/ParallaxMappingUV.gd @@ -43,6 +43,13 @@ func _get_output_port_name(port: int) -> String: func _get_output_port_type(port: int) -> VisualShaderNode.PortType: return PORT_TYPE_VECTOR_2D +func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool: + match mode: + 0, 1: + return true + _: + return false + func _get_global_code(mode: Shader.Mode) -> String: var code: String = preload("ParallaxMappingUV.gdshaderinc").code return code