mirror of
https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git
synced 2025-01-05 00:53:36 +08:00
Merge branch 'godot-4.2'
This commit is contained in:
commit
c1c786f345
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeAdjustmentContrast extends VisualShaderNodeCustom
|
class_name VisualShaderNodeAdjustmentContrast extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Contrast"
|
return "Contrast"
|
||||||
@ -47,7 +47,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String = "vec3(1.0)"
|
var input: String = "vec3(1.0)"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeAdjustmentHue extends VisualShaderNodeCustom
|
class_name VisualShaderNodeAdjustmentHue extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Hue"
|
return "Hue"
|
||||||
@ -59,7 +59,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Degrees", "Normalize"]
|
return ["Degrees", "Normalize"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var range_index: int = get_option_index(0)
|
var range_index: int = get_option_index(0)
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeAdjustmentReplaceColor extends VisualShaderNodeCustom
|
class_name VisualShaderNodeAdjustmentReplaceColor extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ReplaceColor"
|
return "ReplaceColor"
|
||||||
@ -55,7 +55,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String = "vec3(1.0)"
|
var input: String = "vec3(1.0)"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeAdjustmentSaturation extends VisualShaderNodeCustom
|
class_name VisualShaderNodeAdjustmentSaturation extends ShaderLib
|
||||||
|
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
@ -48,7 +48,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String = "vec3(1.0)"
|
var input: String = "vec3(1.0)"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeWhiteBalance extends VisualShaderNodeCustom
|
class_name VisualShaderNodeWhiteBalance extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "WhiteBalance"
|
return "WhiteBalance"
|
||||||
@ -49,7 +49,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String = "vec3(1.0)"
|
var input: String = "vec3(1.0)"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMaskColorMask extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMaskColorMask extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ColorMask"
|
return "ColorMask"
|
||||||
@ -53,7 +53,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_4D
|
return PORT_TYPE_VECTOR_4D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Artistic/Artistic.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Artistic/Artistic.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String = "vec3(0.0)"
|
var input: String = "vec3(0.0)"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeGeometryMeshNode extends VisualShaderNodeCustom
|
class_name VisualShaderNodeGeometryMeshNode extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "MeshNode"
|
return "MeshNode"
|
||||||
@ -42,7 +42,7 @@ func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool:
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Geometry/Geometry.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Geometry/Geometry.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var code: String
|
var code: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeScalarSmoothMax extends VisualShaderNodeCustom
|
class_name VisualShaderNodeScalarSmoothMax extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "SmoothMax"
|
return "SmoothMax"
|
||||||
@ -45,7 +45,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var a: String = input_vars[0]
|
var a: String = input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeScalarSmoothMin extends VisualShaderNodeCustom
|
class_name VisualShaderNodeScalarSmoothMin extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "SmoothMin"
|
return "SmoothMin"
|
||||||
@ -45,7 +45,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var a: String = input_vars[0]
|
var a: String = input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsChebyshevDistance extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsChebyshevDistance extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ChebyshevDistance"
|
return "ChebyshevDistance"
|
||||||
@ -66,7 +66,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector2", "Vector3"]
|
return ["Vector2", "Vector3"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var point_a: String
|
var point_a: String
|
||||||
@ -92,4 +92,3 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
return output_vars[0] + " = chebyshev_distance_2d(%s, %s, %s);" % [point_a, point_b, power]
|
return output_vars[0] + " = chebyshev_distance_2d(%s, %s, %s);" % [point_a, point_b, power]
|
||||||
_:
|
_:
|
||||||
return output_vars[0] + " = chebyshev_distance_3d(%s, %s, %s);" % [point_a, point_b, power]
|
return output_vars[0] + " = chebyshev_distance_3d(%s, %s, %s);" % [point_a, point_b, power]
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsManhattanDistance extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsManhattanDistance extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ManhattanDistance"
|
return "ManhattanDistance"
|
||||||
@ -53,7 +53,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector2", "Vector3"]
|
return ["Vector2", "Vector3"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var point_a: String
|
var point_a: String
|
||||||
@ -78,4 +78,3 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
return output_vars[0] + " = manhattan_distance_2d(%s, %s);" % [point_a, point_b]
|
return output_vars[0] + " = manhattan_distance_2d(%s, %s);" % [point_a, point_b]
|
||||||
_:
|
_:
|
||||||
return output_vars[0] + " = manhattan_distance_3d(%s, %s);" % [point_a, point_b]
|
return output_vars[0] + " = manhattan_distance_3d(%s, %s);" % [point_a, point_b]
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeVectorProject extends VisualShaderNodeCustom
|
class_name VisualShaderNodeVectorProject extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Project"
|
return "Project"
|
||||||
@ -63,7 +63,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector2", "Vector3"]
|
return ["Vector2", "Vector3"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var vector_a: String = input_vars[0]
|
var vector_a: String = input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeVectorProjectOnPlane extends VisualShaderNodeCustom
|
class_name VisualShaderNodeVectorProjectOnPlane extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ProjectOnPlane"
|
return "ProjectOnPlane"
|
||||||
@ -36,7 +36,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var vector_a: String = input_vars[0]
|
var vector_a: String = input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeVectorTransform extends VisualShaderNodeCustom
|
class_name VisualShaderNodeVectorTransform extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "VectorTransform"
|
return "VectorTransform"
|
||||||
@ -55,7 +55,7 @@ func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool:
|
|||||||
return mode == Shader.MODE_SPATIAL
|
return mode == Shader.MODE_SPATIAL
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var code: String
|
var code: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsNoiseSineWave extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsNoiseSineWave extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "NoiseSineWave"
|
return "NoiseSineWave"
|
||||||
@ -87,7 +87,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String
|
var input: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsSawtoothWave extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsSawtoothWave extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "SawtoothWave"
|
return "SawtoothWave"
|
||||||
@ -71,7 +71,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String
|
var input: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsSquareWave extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsSquareWave extends ShaderLib
|
||||||
|
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
@ -72,7 +72,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String
|
var input: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeMathsTriangleWave extends VisualShaderNodeCustom
|
class_name VisualShaderNodeMathsTriangleWave extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "TriangleWave"
|
return "TriangleWave"
|
||||||
@ -70,7 +70,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
return ["Vector1", "Vector2", "Vector3", "Vector4"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Maths/Maths.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Maths/Maths.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var input: String
|
var input: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralCheckerBoard extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralCheckerBoard extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -60,7 +60,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_3D
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralKochFractal extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralKochFractal extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -68,7 +68,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
||||||
@ -82,4 +82,3 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
var height: String = input_vars[4]
|
var height: String = input_vars[4]
|
||||||
|
|
||||||
return output_vars[0] + " = koch_fractal(%s, %s, %s, %s, %s, %s);" % [uv, thickness, iterations, width, height, output_vars[1]]
|
return output_vars[0] + " = koch_fractal(%s, %s, %s, %s, %s, %s);" % [uv, thickness, iterations, width, height, output_vars[1]]
|
||||||
|
|
65
addons/ShaderLib_v2_2_4/Procedural/HeightToNormal.gd
Normal file
65
addons/ShaderLib_v2_2_4/Procedural/HeightToNormal.gd
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
@tool
|
||||||
|
class_name VisualShaderNodeProceduralHeightToNormal extends ShaderLib
|
||||||
|
|
||||||
|
func _get_name() -> String:
|
||||||
|
return "HeightToNormal"
|
||||||
|
|
||||||
|
func _get_category() -> String:
|
||||||
|
return "Procedural"
|
||||||
|
|
||||||
|
func _get_description() -> String:
|
||||||
|
return "Generates a normal map from a height map."
|
||||||
|
|
||||||
|
func _get_return_icon_type() -> PortType:
|
||||||
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
|
func _get_input_port_count() -> int:
|
||||||
|
return 3
|
||||||
|
|
||||||
|
func _get_input_port_name(port: int) -> String:
|
||||||
|
match port:
|
||||||
|
0:
|
||||||
|
return "height map"
|
||||||
|
1:
|
||||||
|
return "uv"
|
||||||
|
2:
|
||||||
|
return "bump strength"
|
||||||
|
return ""
|
||||||
|
|
||||||
|
func _get_input_port_type(port: int) -> PortType:
|
||||||
|
match port:
|
||||||
|
0:
|
||||||
|
return PORT_TYPE_SAMPLER
|
||||||
|
1:
|
||||||
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
_:
|
||||||
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
|
func _get_input_port_default_value(port: int) -> Variant:
|
||||||
|
match port:
|
||||||
|
2:
|
||||||
|
return 8.0
|
||||||
|
_:
|
||||||
|
return null
|
||||||
|
|
||||||
|
func _get_output_port_count() -> int:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
func _get_output_port_name(port: int) -> String:
|
||||||
|
return "normal"
|
||||||
|
|
||||||
|
func _get_output_port_type(port: int) -> PortType:
|
||||||
|
return PORT_TYPE_VECTOR_3D
|
||||||
|
|
||||||
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
|
var uv: String = "UV"
|
||||||
|
if input_vars[1]:
|
||||||
|
uv = input_vars[1]
|
||||||
|
|
||||||
|
var sampler: String = input_vars[0]
|
||||||
|
var bump: String = input_vars[2]
|
||||||
|
|
||||||
|
return output_vars[0] + " = heigth_to_normal(%s, %s, %s);" % [sampler, uv, bump]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralGradientNoise extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralGradientNoise extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -52,7 +52,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralGyroidNoise extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralGyroidNoise extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -62,7 +62,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodePseudoRandomNoise extends VisualShaderNodeCustom
|
class_name VisualShaderNodePseudoRandomNoise extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -41,5 +41,8 @@ func _get_output_port_name(port: int) -> String:
|
|||||||
func _get_output_port_type(port: int) -> PortType:
|
func _get_output_port_type(port: int) -> PortType:
|
||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
return output_vars[0] + " = pseudo_random_noise(UV, %s);" % input_vars[0]
|
return output_vars[0] + " = pseudo_random_noise(UV, %s);" % input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralSimpleNoise extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralSimpleNoise extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -56,7 +56,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,8 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralVoronoi extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralVoronoi extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
|
||||||
output_port_for_preview = 0
|
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Voronoi"
|
return "Voronoi"
|
||||||
@ -63,7 +60,7 @@ func _get_input_port_default_value(port: int) -> Variant:
|
|||||||
2:
|
2:
|
||||||
return 2.0
|
return 2.0
|
||||||
3:
|
3:
|
||||||
return 2.0
|
return 5.0
|
||||||
_:
|
_:
|
||||||
return null
|
return null
|
||||||
_:
|
_:
|
||||||
@ -101,7 +98,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Euclidean", "Manhattan", "Chebyshev"]
|
return ["Euclidean", "Manhattan", "Chebyshev"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
||||||
@ -113,13 +110,15 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
|
|
||||||
var cell_density: String = input_vars[1]
|
var cell_density: String = input_vars[1]
|
||||||
var angle_offset: String = input_vars[2]
|
var angle_offset: String = input_vars[2]
|
||||||
var chebyshev_power: String = "0."
|
|
||||||
|
|
||||||
if distance_index == 2:
|
|
||||||
if input_vars[3]:
|
|
||||||
chebyshev_power = input_vars[3]
|
|
||||||
|
|
||||||
var output: String = output_vars[0]
|
var output: String = output_vars[0]
|
||||||
var cells: String = output_vars[1]
|
var cells: String = output_vars[1]
|
||||||
|
|
||||||
return "voronoi_noise(%s, %s, %s, %s, %s, %s, %s);" % [uv, cell_density, angle_offset, distance_index, chebyshev_power, output, cells]
|
match distance_index:
|
||||||
|
1:
|
||||||
|
return "%s = voronoi_noise_manhattan(%s, %s, %s, %s);" % [output, uv, cell_density, angle_offset, cells]
|
||||||
|
2:
|
||||||
|
var chebyshev_power: String = input_vars[3]
|
||||||
|
return "%s = voronoi_noise_chebyshev(%s, %s, %s, %s, %s);" % [output, uv, cell_density, angle_offset, chebyshev_power, cells]
|
||||||
|
_:
|
||||||
|
return "%s = voronoi_noise_euclidean(%s, %s, %s, %s);" % [output, uv, cell_density, angle_offset, cells]
|
@ -1,4 +1,4 @@
|
|||||||
#include "res://addons/ShaderLib/Maths/Maths.gdshaderinc"
|
#include "res://addons/ShaderLib_v2_2_4/Maths/Maths.gdshaderinc"
|
||||||
|
|
||||||
vec3 checker_board(vec2 uv, vec3 color_a, vec3 color_b, vec2 frequency) {
|
vec3 checker_board(vec2 uv, vec3 color_a, vec3 color_b, vec2 frequency) {
|
||||||
uv = (uv.xy + 0.5) * frequency;
|
uv = (uv.xy + 0.5) * frequency;
|
||||||
@ -130,7 +130,7 @@ vec2 voronoi_random_vector(vec2 p) {
|
|||||||
return fract(sin(p * matrix) * 46839.32);
|
return fract(sin(p * matrix) * 46839.32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void voronoi_noise(vec2 uv, float cell_density, float angle_offset, int distance_index, float chebyshev_power, out float output, out float cells){
|
float voronoi_noise_euclidean(vec2 uv, float cell_density, float angle_offset, out float cells){
|
||||||
vec2 grid_uv = fract(uv * cell_density);
|
vec2 grid_uv = fract(uv * cell_density);
|
||||||
vec2 grid_id = floor(uv * cell_density);
|
vec2 grid_id = floor(uv * cell_density);
|
||||||
vec2 cell_id = vec2(0);
|
vec2 cell_id = vec2(0);
|
||||||
@ -142,18 +142,31 @@ void voronoi_noise(vec2 uv, float cell_density, float angle_offset, int distance
|
|||||||
vec2 n = voronoi_random_vector(grid_id + offset);
|
vec2 n = voronoi_random_vector(grid_id + offset);
|
||||||
vec2 p = offset + vec2(sin(n.x + angle_offset) * .5 + .5, cos(n.y + angle_offset) * .5 + .5);
|
vec2 p = offset + vec2(sin(n.x + angle_offset) * .5 + .5, cos(n.y + angle_offset) * .5 + .5);
|
||||||
float d = min_dist;
|
float d = min_dist;
|
||||||
|
d = distance(grid_uv, p);
|
||||||
switch(distance_index){
|
if(d < min_dist) {
|
||||||
case 1:
|
min_dist = d;
|
||||||
d = manhattan_distance_2d(grid_uv, p);
|
cell_id = voronoi_random_vector(grid_id + offset);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
d = chebyshev_distance_2d(grid_uv, p, chebyshev_power);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
d = distance(grid_uv, p);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cells = cell_id.y;
|
||||||
|
return min_dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
float voronoi_noise_manhattan(vec2 uv, float cell_density, float angle_offset, out float cells){
|
||||||
|
vec2 grid_uv = fract(uv * cell_density);
|
||||||
|
vec2 grid_id = floor(uv * cell_density);
|
||||||
|
vec2 cell_id = vec2(0);
|
||||||
|
float min_dist = 100.;
|
||||||
|
|
||||||
|
for(float y = -1.; y <= 1.; y++) {
|
||||||
|
for(float x = -1.; x <= 1.; x++) {
|
||||||
|
vec2 offset = vec2(x, y);
|
||||||
|
vec2 n = voronoi_random_vector(grid_id + offset);
|
||||||
|
vec2 p = offset + vec2(sin(n.x + angle_offset) * .5 + .5, cos(n.y + angle_offset) * .5 + .5);
|
||||||
|
float d = min_dist;
|
||||||
|
d = manhattan_distance_2d(grid_uv, p);
|
||||||
|
|
||||||
if(d < min_dist) {
|
if(d < min_dist) {
|
||||||
min_dist = d;
|
min_dist = d;
|
||||||
@ -162,8 +175,33 @@ void voronoi_noise(vec2 uv, float cell_density, float angle_offset, int distance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output = min_dist;
|
|
||||||
cells = cell_id.y;
|
cells = cell_id.y;
|
||||||
|
return min_dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
float voronoi_noise_chebyshev(vec2 uv, float cell_density, float angle_offset, float chebyshev_power, out float cells){
|
||||||
|
vec2 grid_uv = fract(uv * cell_density);
|
||||||
|
vec2 grid_id = floor(uv * cell_density);
|
||||||
|
vec2 cell_id = vec2(0);
|
||||||
|
float min_dist = 100.;
|
||||||
|
|
||||||
|
for(float y = -1.; y <= 1.; y++) {
|
||||||
|
for(float x = -1.; x <= 1.; x++) {
|
||||||
|
vec2 offset = vec2(x, y);
|
||||||
|
vec2 n = voronoi_random_vector(grid_id + offset);
|
||||||
|
vec2 p = offset + vec2(sin(n.x + angle_offset) * .5 + .5, cos(n.y + angle_offset) * .5 + .5);
|
||||||
|
float d = min_dist;
|
||||||
|
d = chebyshev_distance_2d(grid_uv, p, chebyshev_power);
|
||||||
|
|
||||||
|
if(d < min_dist) {
|
||||||
|
min_dist = d;
|
||||||
|
cell_id = voronoi_random_vector(grid_id + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cells = cell_id.y;
|
||||||
|
return min_dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ellipse_shape(vec2 uv, float width, float height) {
|
float ellipse_shape(vec2 uv, float width, float height) {
|
||||||
@ -229,4 +267,19 @@ float rounded_rectangle_shape(vec2 uv, float width, float height, float radius){
|
|||||||
uv = abs(uv * 2.0 - 1.0) - vec2(width, height) + radius;
|
uv = abs(uv * 2.0 - 1.0) - vec2(width, height) + radius;
|
||||||
float dist = length(max(vec2(0.0), uv)) / radius;
|
float dist = length(max(vec2(0.0), uv)) / radius;
|
||||||
return clamp((1.0 - dist) / fwidth(dist), 0.0, 1.0);
|
return clamp((1.0 - dist) / fwidth(dist), 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 heigth_to_normal(sampler2D height_map, vec2 uv, float bump_strength) {
|
||||||
|
float pixel_width = .002;
|
||||||
|
float height = texture(height_map, uv).r;
|
||||||
|
float r = height - texture(height_map, uv + vec2(pixel_width, 0)).r;
|
||||||
|
float l = height - texture(height_map, uv - vec2(pixel_width, 0)).r;
|
||||||
|
float u = height - texture(height_map, uv + vec2(0, pixel_width)).r;
|
||||||
|
float d = height - texture(height_map, uv - vec2(0, pixel_width)).r;
|
||||||
|
float h = (r - l) / pixel_width;
|
||||||
|
float v = (u - d) / pixel_width;
|
||||||
|
vec3 n = vec3(h, v, 1.);
|
||||||
|
n.x = n.x * (pixel_width * bump_strength * .5) + .5;
|
||||||
|
n.y = n.y * (pixel_width * bump_strength * .5) + .5;
|
||||||
|
return normalize(n);
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralEllipse extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralEllipse extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -54,7 +54,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralPolygon extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralPolygon extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -60,7 +60,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralRectangle extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralRectangle extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -54,7 +54,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralRoundedPolygon extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralRoundedPolygon extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -61,7 +61,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeProceduralRoundedRectangle extends VisualShaderNodeCustom
|
class_name VisualShaderNodeProceduralRoundedRectangle extends ShaderLib
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
output_port_for_preview = 0
|
output_port_for_preview = 0
|
||||||
@ -58,7 +58,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/Procedural/Procedural.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/Procedural/Procedural.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String = "UV"
|
var uv: String = "UV"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeRayMarch extends VisualShaderNodeCustom
|
class_name VisualShaderNodeRayMarch extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "RayMarch"
|
return "RayMarch"
|
||||||
@ -183,7 +183,7 @@ func _get_output_port_type(port: int) -> PortType:
|
|||||||
return PORT_TYPE_SCALAR
|
return PORT_TYPE_SCALAR
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/RayMarching/SignedDistanceFunctions.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/RayMarching/SignedDistanceFunctions.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var sdf_index: int = get_option_index(0)
|
var sdf_index: int = get_option_index(0)
|
||||||
@ -222,4 +222,3 @@ func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shad
|
|||||||
var small_radius: String = input_vars[7]
|
var small_radius: String = input_vars[7]
|
||||||
var big_radius: String = input_vars[8]
|
var big_radius: String = input_vars[8]
|
||||||
return output_vars[0] + " = ray_march_sd_torus(%s, %s, %s, %s, %s, %s, %s, %s, %s);" % [ray_origin, ray_direction, max_steps, max_dist, dist_threshold, torus_pos, eulers, small_radius, big_radius]
|
return output_vars[0] + " = ray_march_sd_torus(%s, %s, %s, %s, %s, %s, %s, %s, %s);" % [ray_origin, ray_direction, max_steps, max_dist, dist_threshold, torus_pos, eulers, small_radius, big_radius]
|
||||||
|
|
3
addons/ShaderLib_v2_2_4/ShaderLib.gd
Normal file
3
addons/ShaderLib_v2_2_4/ShaderLib.gd
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class_name ShaderLib extends VisualShaderNodeCustom
|
||||||
|
|
||||||
|
var version: String = "v2_2_4"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVFlipbook extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVFlipbook extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Flipbook"
|
return "Flipbook"
|
||||||
@ -57,7 +57,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool:
|
func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool:
|
||||||
match mode:
|
match mode:
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVParallaxMapping extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVParallaxMapping extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "ParallaxMapping"
|
return "ParallaxMapping"
|
||||||
@ -55,7 +55,7 @@ func _is_available(mode: Shader.Mode, type: VisualShader.Type) -> bool:
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var height_map: String = input_vars[0]
|
var height_map: String = input_vars[0]
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVRadialShear extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVRadialShear extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "RadialShear"
|
return "RadialShear"
|
||||||
@ -57,7 +57,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String
|
var uv: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVRotate extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVRotate extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Rotate"
|
return "Rotate"
|
||||||
@ -65,7 +65,7 @@ func _get_property_options(index: int) -> PackedStringArray:
|
|||||||
return ["Degrees", "Radians"]
|
return ["Degrees", "Radians"]
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String
|
var uv: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVSpherize extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVSpherize extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Spherize"
|
return "Spherize"
|
||||||
@ -57,7 +57,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String
|
var uv: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVSwirl extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVSwirl extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Swirl"
|
return "Swirl"
|
||||||
@ -57,7 +57,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String
|
var uv: String
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVTilingAndOffset extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVTilingAndOffset extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "TilingAndOffset"
|
return "TilingAndOffset"
|
@ -1,5 +1,5 @@
|
|||||||
@tool
|
@tool
|
||||||
class_name VisualShaderNodeUVTwirl extends VisualShaderNodeCustom
|
class_name VisualShaderNodeUVTwirl extends ShaderLib
|
||||||
|
|
||||||
func _get_name() -> String:
|
func _get_name() -> String:
|
||||||
return "Twirl"
|
return "Twirl"
|
||||||
@ -57,7 +57,7 @@ func _get_output_port_type(port: int) -> VisualShaderNode.PortType:
|
|||||||
return PORT_TYPE_VECTOR_2D
|
return PORT_TYPE_VECTOR_2D
|
||||||
|
|
||||||
func _get_global_code(mode: Shader.Mode) -> String:
|
func _get_global_code(mode: Shader.Mode) -> String:
|
||||||
return "#include \"res://addons/ShaderLib/UV/UV.gdshaderinc\""
|
return "#include \"res://addons/ShaderLib_%s/UV/UV.gdshaderinc\"" % [version]
|
||||||
|
|
||||||
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
func _get_code(input_vars: Array[String], output_vars: Array[String], mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||||
var uv: String
|
var uv: String
|
@ -56,6 +56,7 @@ For example if you want to rotate UV in your **_.gdshader_** file, you can use `
|
|||||||
<h2>Procedural nodes</h2>
|
<h2>Procedural nodes</h2>
|
||||||
|
|
||||||
<h4><a href="/documentation/Nodes/Procedural/CheckerBoard.md"> Checker Board node</a></h4>
|
<h4><a href="/documentation/Nodes/Procedural/CheckerBoard.md"> Checker Board node</a></h4>
|
||||||
|
<h4><a href="/documentation/Nodes/Procedural/HeightToNormal.md"> Height To Normal node</a></h4>
|
||||||
|
|
||||||
<h3> Fractals</h3>
|
<h3> Fractals</h3>
|
||||||
|
|
||||||
|
29
documentation/Nodes/Procedural/HeightToNormal.md
Normal file
29
documentation/Nodes/Procedural/HeightToNormal.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Height To Normal node
|
||||||
|
Generates a normal map from a height map.
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
**Inputs**
|
||||||
|
|Name|Type|Binding|Description|
|
||||||
|
|---|---|---|---|
|
||||||
|
|height map|sampler2D|none|Height map|
|
||||||
|
|uv|vec2|UV|Input UV value|
|
||||||
|
|bump strength|float|none|Bump strength for the height|
|
||||||
|
|
||||||
|
**Outputs**
|
||||||
|
|Name|Type|Binding|Description|
|
||||||
|
|---|---|---|---|
|
||||||
|
|Normal|vec3|None|Normal map|
|
||||||
|
|
||||||
|
**ShaderInc location**
|
||||||
|
<br>`res://addons/ShaderLib/Procedural/Procedural.gdshaderinc`
|
||||||
|
|
||||||
|
**Method signature**
|
||||||
|
<br>`vec3 heigth_to_normal(sampler2D height_map, vec2 uv, float bump_strength)`
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|Name|Type|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|height_map|sampler2D|Height map|
|
||||||
|
|uv|vec2|Input UV value|
|
||||||
|
|bump_strength|float|Bump strength for the height|
|
||||||
|
___
|
@ -25,7 +25,9 @@ Generates a Voronoi or Worley noise based on input UV. Voronoi noise is generate
|
|||||||
<br>`res://addons/ShaderLib/Procedural/Procedural.gdshaderinc`
|
<br>`res://addons/ShaderLib/Procedural/Procedural.gdshaderinc`
|
||||||
|
|
||||||
**Method signature**
|
**Method signature**
|
||||||
<br>`void voronoi_noise(vec2 uv, float cell_density, float angle_offset, int distance_index, float chebyshev_power, out float output, out float cells)`
|
<br>`float voronoi_noise_euclidean(vec2 uv, float cell_density, float angle_offset, out float cells)`
|
||||||
|
<br>`float voronoi_noise_manhattan(vec2 uv, float cell_density, float angle_offset, out float cells)`
|
||||||
|
<br>`float voronoi_noise_chebyshev(vec2 uv, float cell_density, float angle_offset, float chebyshev_power, out float cells)`
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|Name|Type|Description|
|
|Name|Type|Description|
|
||||||
@ -33,8 +35,6 @@ Generates a Voronoi or Worley noise based on input UV. Voronoi noise is generate
|
|||||||
|uv|vec2|Input UV value|
|
|uv|vec2|Input UV value|
|
||||||
|cell_density|float|Density of generated cells|
|
|cell_density|float|Density of generated cells|
|
||||||
|angle_offset|float|Offset values for points|
|
|angle_offset|float|Offset values for points|
|
||||||
|distance_index|int|Distance matrix to use for Voronoi, 0 = Euclidean, 1 = Manhattan, 2 = Chebyshev|
|
|
||||||
|chebyshev_power|float|Power for Chebyshev distance|
|
|chebyshev_power|float|Power for Chebyshev distance|
|
||||||
|output|out float|Output noise value|
|
|
||||||
|cells|out float|Output raw cell data|
|
|cells|out float|Output raw cell data|
|
||||||
___
|
___
|
@ -12,5 +12,5 @@ config_version=5
|
|||||||
|
|
||||||
config/name="Godot-shader-lib"
|
config/name="Godot-shader-lib"
|
||||||
config/tags=PackedStringArray("addons")
|
config/tags=PackedStringArray("addons")
|
||||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icons/icon.png"
|
config/icon="res://icons/icon.png"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user