mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-18 14:07:17 +01:00
Created an addon from https://github.com/Relintai/mat_maker_gd . (Only the ported stuff). Also took the nodes from the newest https://github.com/RodZill4/material-maker .
This commit is contained in:
parent
2ab52ea5c8
commit
bc1c8b2718
2
game/addons/.gitignore
vendored
2
game/addons/.gitignore
vendored
@ -11,5 +11,7 @@
|
||||
!mesh_data_resource_editor/**
|
||||
!multirun
|
||||
!multirun/**
|
||||
!mat_maker_gd
|
||||
!mat_maker_gd/**
|
||||
!addon_versions
|
||||
|
||||
|
22
game/addons/mat_maker_gd/LICENSE.md
Normal file
22
game/addons/mat_maker_gd/LICENSE.md
Normal file
@ -0,0 +1,22 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2020 Péter Magyar
|
||||
Copyright (c) 2018-2020 Rodolphe Suescun and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
6
game/addons/mat_maker_gd/README.md
Normal file
6
game/addons/mat_maker_gd/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# mat_maker_gd
|
||||
|
||||
My goal with this project is to take Material Maker's ( https://github.com/RodZill4/material-maker ) code,
|
||||
and make it an in-godot texture/image generator.
|
||||
|
||||
If it turns out well I'll probably turn it into a c++ engine module eventually.
|
324
game/addons/mat_maker_gd/filter/filter.gd
Normal file
324
game/addons/mat_maker_gd/filter/filter.gd
Normal file
@ -0,0 +1,324 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
export(Vector2) var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
export(Vector2) var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
export(bool) var refresh setget reff,reffg
|
||||
|
||||
func _ready():
|
||||
if !Engine.editor_hint:
|
||||
gen()
|
||||
|
||||
|
||||
func gen() -> void:
|
||||
if !image:
|
||||
image = Image.new()
|
||||
image.create(300, 300, false, Image.FORMAT_RGBA8)
|
||||
|
||||
if !tex:
|
||||
tex = ImageTexture.new()
|
||||
|
||||
# var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
# var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
image.lock()
|
||||
|
||||
var w : float = image.get_width()
|
||||
var h : float = image.get_width()
|
||||
|
||||
var pseed : float = randf() + randi()
|
||||
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var v : Vector2 = Vector2(x / w, y / h)
|
||||
|
||||
var f : float = shape_circle(v, 3, 1.0 * 1.0, 1.0)
|
||||
var c : Color = Color(f, f, f, 1)
|
||||
|
||||
# c = invert(c)
|
||||
# c = brightness_contrast(c)
|
||||
|
||||
#needs work
|
||||
c = adjust_hsv(c)
|
||||
|
||||
image.set_pixel(x, y, c)
|
||||
|
||||
|
||||
image.unlock()
|
||||
|
||||
tex.create_from_image(image)
|
||||
texture = tex
|
||||
|
||||
func invert(color : Color) -> Color:
|
||||
return Color(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a);
|
||||
|
||||
var p_o91644_brightness = 0.000000000;
|
||||
var p_o91644_contrast = 1.000000000;
|
||||
|
||||
func brightness_contrast(color : Color) -> Color:
|
||||
var bv : Vector3 = Vector3(p_o91644_brightness, p_o91644_brightness, p_o91644_brightness)
|
||||
var cvv : Vector3 = Vector3(color.r * p_o91644_contrast, color.g * p_o91644_contrast, color.b * p_o91644_contrast)
|
||||
|
||||
var cv : Vector3 = cvv + bv + Vector3(0.5, 0.5, 0.5) - (Vector3(p_o91644_contrast, p_o91644_contrast, p_o91644_contrast) * 0.5)
|
||||
|
||||
var v : Vector3 = clampv3(cv, Vector3(), Vector3(1, 1, 1))
|
||||
|
||||
return Color(v.x, v.y, v.z, 1);
|
||||
|
||||
var p_o102649_hue = 0.000000000;
|
||||
var p_o102649_saturation = 1.000000000;
|
||||
var p_o102649_value = 1.000000000;
|
||||
|
||||
func adjust_hsv(color : Color) -> Color:
|
||||
var hsv : Vector3 = rgb_to_hsv(Vector3(color.r, color.g, color.b));
|
||||
|
||||
var x : float = fract(hsv.x + p_o102649_hue)
|
||||
var y : float = clamp(hsv.y * p_o102649_saturation, 0.0, 1.0)
|
||||
var z : float = clamp(hsv.z * p_o102649_value, 0.0, 1.0)
|
||||
|
||||
var h : Vector3 = hsv_to_rgb(Vector3(x, y, z))
|
||||
|
||||
return Color(h.x, h.y, h.z, color.a);
|
||||
|
||||
func rgb_to_hsv(c : Vector3) -> Vector3:
|
||||
var K : Color = Color(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
|
||||
var p : Color
|
||||
|
||||
if c.y < c.z:
|
||||
p = Color(c.z, c.y, K.a, K.b)
|
||||
else:
|
||||
p = Color(c.y, c.z, K.r, K.g);
|
||||
|
||||
var q : Color
|
||||
|
||||
if c.x < p.r:
|
||||
q = Color(p.r, p.g, p.a, c.x)
|
||||
else:
|
||||
q = Color(c.x, p.g, p.b, p.r);
|
||||
|
||||
var d : float = q.r - min(q.a, q.g);
|
||||
var e : float = 1.0e-10;
|
||||
|
||||
return Vector3(abs(q.b + (q.a - q.g) / (6.0 * d + e)), d / (q.r + e), q.r);
|
||||
|
||||
func hsv_to_rgb(c : Vector3) -> Vector3:
|
||||
var K : Color = Color(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
|
||||
var p : Vector3 = absv3(fractv3(Vector3(c.x, c.x, c.x) + Vector3(K.r, K.g, K.b)) * 6.0 - Vector3(K.a, K.a, K.a));
|
||||
|
||||
return c.z * lerp(Vector3(K.r, K.r, K.r), clampv3(p - Vector3(K.r, K.r, K.r), Vector3(), Vector3(1, 1, 1)), c.y);
|
||||
|
||||
func shape_circle(uv : Vector2, sides : float, size : float, edge : float) -> float:
|
||||
uv.x = 2.0 * uv.x - 1.0
|
||||
uv.y = 2.0 * uv.y - 1.0
|
||||
|
||||
edge = max(edge, 1.0e-8)
|
||||
|
||||
var distance : float = uv.length()
|
||||
|
||||
return clamp((1.0 - distance / size) / edge, 0.0, 1.0)
|
||||
|
||||
|
||||
func transform(uv : Vector2, translate : Vector2, rotate : float, scale : Vector2, repeat : bool) -> Vector2:
|
||||
var rv : Vector2 = Vector2();
|
||||
uv -= translate;
|
||||
uv -= Vector2(0.5, 0.5);
|
||||
rv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;
|
||||
rv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;
|
||||
rv /= scale;
|
||||
rv += Vector2(0.5, 0.5);
|
||||
|
||||
if (repeat):
|
||||
return fractv2(rv);
|
||||
else:
|
||||
return clampv2(rv, Vector2(0, 0), Vector2(1, 1));
|
||||
|
||||
|
||||
func clampv3(v : Vector3, mi : Vector3, ma : Vector3) -> Vector3:
|
||||
v.x = clamp(v.x, mi.x, ma.x)
|
||||
v.y = clamp(v.y, mi.y, ma.y)
|
||||
v.y = clamp(v.z, mi.z, ma.z)
|
||||
|
||||
return v
|
||||
|
||||
func floorc(a : Color) -> Color:
|
||||
var v : Color = Color()
|
||||
|
||||
v.r = floor(a.r)
|
||||
v.g = floor(a.g)
|
||||
v.b = floor(a.b)
|
||||
v.a = floor(a.a)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func floorv2(a : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = floor(a.x)
|
||||
v.y = floor(a.y)
|
||||
|
||||
return v
|
||||
|
||||
func smoothstepv2(a : float, b : float, c : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = smoothstep(a, b, c.x)
|
||||
v.y = smoothstep(a, b, c.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
v.z = max(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
func absv2(v : Vector2) -> Vector2:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func absv3(v : Vector3) -> Vector3:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv2(v : Vector2) -> Vector2:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv3(v : Vector3) -> Vector3:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func modv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
v.z = modf(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func modv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fractv2(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractv3(v : Vector3) -> Vector3:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
v.z = v.z - floor(v.z)
|
||||
|
||||
return v
|
||||
|
||||
func fract(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func clampv2(v : Vector2, pmin : Vector2, pmax : Vector2) -> Vector2:
|
||||
v.x = clamp(v.x, pmin.x, pmax.x)
|
||||
v.y = clamp(v.y, pmin.y, pmax.y)
|
||||
|
||||
return v
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fract(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func rand2(x : Vector2) -> Vector2:
|
||||
return fractv2(cosv2(Vector2(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)))) * 43758.5453);
|
||||
|
||||
func rand3(x : Vector2) -> Vector3:
|
||||
return fractv3(cosv3(Vector3(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)),
|
||||
x.dot(Vector2(13.254, 5.867)))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
func reff(bb):
|
||||
if bb:
|
||||
gen()
|
||||
|
12
game/addons/mat_maker_gd/filter/filter.tscn
Normal file
12
game/addons/mat_maker_gd/filter/filter.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mat_maker_gd/filter/filter.gd" type="Script" id=1]
|
||||
|
||||
[node name="TextureRect" type="TextureRect"]
|
||||
margin_right = 300.0
|
||||
margin_bottom = 300.0
|
||||
expand = true
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
286
game/addons/mat_maker_gd/filter/grayscale.gd
Normal file
286
game/addons/mat_maker_gd/filter/grayscale.gd
Normal file
@ -0,0 +1,286 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
export(Vector2) var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
export(Vector2) var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
export(bool) var refresh setget reff,reffg
|
||||
|
||||
func _ready():
|
||||
if !Engine.editor_hint:
|
||||
gen()
|
||||
|
||||
|
||||
func gen() -> void:
|
||||
if !image:
|
||||
image = Image.new()
|
||||
image.create(300, 300, false, Image.FORMAT_RGBA8)
|
||||
|
||||
if !tex:
|
||||
tex = ImageTexture.new()
|
||||
|
||||
# var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
# var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
image.lock()
|
||||
|
||||
var w : float = image.get_width()
|
||||
var h : float = image.get_width()
|
||||
|
||||
var pseed : float = randf() + randi()
|
||||
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var v : Vector2 = Vector2(x / w, y / h)
|
||||
|
||||
var f : float = shape_circle(v, 3, 1.0 * 1.0, 1.0)
|
||||
|
||||
f = gs_luminosity(Vector3(f, f, f));
|
||||
|
||||
var c : Color = Color(f, f, f, 1)
|
||||
|
||||
# c = invert(c)
|
||||
# c = brightness_contrast(c)
|
||||
|
||||
#needs work
|
||||
|
||||
image.set_pixel(x, y, c)
|
||||
|
||||
|
||||
image.unlock()
|
||||
|
||||
tex.create_from_image(image)
|
||||
texture = tex
|
||||
|
||||
func invert(color : Color) -> Color:
|
||||
return Color(1.0 - color.r, 1.0 - color.g, 1.0 - color.b, color.a);
|
||||
|
||||
|
||||
func gs_min(c : Vector3) -> float:
|
||||
return min(c.x, min(c.y, c.z));
|
||||
|
||||
func gs_max(c : Vector3) -> float:
|
||||
return max(c.x, max(c.y, c.z));
|
||||
|
||||
func gs_lightness(c : Vector3) -> float:
|
||||
return 0.5*(max(c.x, max(c.y, c.z)) + min(c.x, min(c.y, c.z)));
|
||||
|
||||
func gs_average(c : Vector3) -> float:
|
||||
return 0.333333333333*(c.x + c.y + c.z);
|
||||
|
||||
func gs_luminosity(c : Vector3) -> float:
|
||||
return 0.21 * c.x + 0.72 * c.y + 0.07 * c.z;
|
||||
|
||||
|
||||
func shape_circle(uv : Vector2, sides : float, size : float, edge : float) -> float:
|
||||
uv.x = 2.0 * uv.x - 1.0
|
||||
uv.y = 2.0 * uv.y - 1.0
|
||||
|
||||
edge = max(edge, 1.0e-8)
|
||||
|
||||
var distance : float = uv.length()
|
||||
|
||||
return clamp((1.0 - distance / size) / edge, 0.0, 1.0)
|
||||
|
||||
|
||||
func transform(uv : Vector2, translate : Vector2, rotate : float, scale : Vector2, repeat : bool) -> Vector2:
|
||||
var rv : Vector2 = Vector2();
|
||||
uv -= translate;
|
||||
uv -= Vector2(0.5, 0.5);
|
||||
rv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;
|
||||
rv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;
|
||||
rv /= scale;
|
||||
rv += Vector2(0.5, 0.5);
|
||||
|
||||
if (repeat):
|
||||
return fractv2(rv);
|
||||
else:
|
||||
return clampv2(rv, Vector2(0, 0), Vector2(1, 1));
|
||||
|
||||
|
||||
func clampv3(v : Vector3, mi : Vector3, ma : Vector3) -> Vector3:
|
||||
v.x = clamp(v.x, mi.x, ma.x)
|
||||
v.y = clamp(v.y, mi.y, ma.y)
|
||||
v.y = clamp(v.z, mi.z, ma.z)
|
||||
|
||||
return v
|
||||
|
||||
func floorc(a : Color) -> Color:
|
||||
var v : Color = Color()
|
||||
|
||||
v.r = floor(a.r)
|
||||
v.g = floor(a.g)
|
||||
v.b = floor(a.b)
|
||||
v.a = floor(a.a)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func floorv2(a : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = floor(a.x)
|
||||
v.y = floor(a.y)
|
||||
|
||||
return v
|
||||
|
||||
func smoothstepv2(a : float, b : float, c : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = smoothstep(a, b, c.x)
|
||||
v.y = smoothstep(a, b, c.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
v.z = max(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
func absv2(v : Vector2) -> Vector2:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func absv3(v : Vector3) -> Vector3:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv2(v : Vector2) -> Vector2:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv3(v : Vector3) -> Vector3:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func modv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
v.z = modf(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func modv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fractv2(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractv3(v : Vector3) -> Vector3:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
v.z = v.z - floor(v.z)
|
||||
|
||||
return v
|
||||
|
||||
func fract(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func clampv2(v : Vector2, pmin : Vector2, pmax : Vector2) -> Vector2:
|
||||
v.x = clamp(v.x, pmin.x, pmax.x)
|
||||
v.y = clamp(v.y, pmin.y, pmax.y)
|
||||
|
||||
return v
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fract(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func rand2(x : Vector2) -> Vector2:
|
||||
return fractv2(cosv2(Vector2(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)))) * 43758.5453);
|
||||
|
||||
func rand3(x : Vector2) -> Vector3:
|
||||
return fractv3(cosv3(Vector3(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)),
|
||||
x.dot(Vector2(13.254, 5.867)))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.y < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.x < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
func reff(bb):
|
||||
if bb:
|
||||
gen()
|
||||
|
12
game/addons/mat_maker_gd/filter/grayscale.tscn
Normal file
12
game/addons/mat_maker_gd/filter/grayscale.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mat_maker_gd/filter/grayscale.gd" type="Script" id=1]
|
||||
|
||||
[node name="TextureRect" type="TextureRect"]
|
||||
margin_right = 300.0
|
||||
margin_bottom = 300.0
|
||||
expand = true
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
265
game/addons/mat_maker_gd/filter/sharpen.gd
Normal file
265
game/addons/mat_maker_gd/filter/sharpen.gd
Normal file
@ -0,0 +1,265 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
export(Vector2) var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
export(Vector2) var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
export(bool) var refresh setget reff,reffg
|
||||
|
||||
func _ready():
|
||||
if !Engine.editor_hint:
|
||||
gen()
|
||||
|
||||
|
||||
func gen() -> void:
|
||||
if !image:
|
||||
image = Image.new()
|
||||
image.create(300, 300, false, Image.FORMAT_RGBA8)
|
||||
|
||||
if !tex:
|
||||
tex = ImageTexture.new()
|
||||
|
||||
# var bmin : Vector2 = Vector2(0.1, 0.1)
|
||||
# var bmax : Vector2 = Vector2(1, 1)
|
||||
|
||||
image.lock()
|
||||
|
||||
var w : float = image.get_width()
|
||||
var h : float = image.get_width()
|
||||
|
||||
var pseed : float = randf() + randi()
|
||||
|
||||
for x in range(image.get_width()):
|
||||
for y in range(image.get_height()):
|
||||
var v : Vector2 = Vector2(x / w, y / h)
|
||||
|
||||
var f : Vector3 = sharpen(v)
|
||||
|
||||
var c : Color = Color(f.x, f.y, f.z, 1)
|
||||
|
||||
# c = invert(c)
|
||||
# c = brightness_contrast(c)
|
||||
|
||||
#needs work
|
||||
|
||||
image.set_pixel(x, y, c)
|
||||
|
||||
|
||||
image.unlock()
|
||||
|
||||
tex.create_from_image(image)
|
||||
texture = tex
|
||||
|
||||
func o11853_input_in(uv : Vector2) -> Vector3:
|
||||
var f : float = shape_circle(uv, 3, 1.0 * 1.0, 1.0)
|
||||
|
||||
return Vector3(f, f, f);
|
||||
|
||||
func sharpen(uv : Vector2) -> Vector3:
|
||||
var e : Vector2 = Vector2(1.0 / 32.000000000, 0.0);
|
||||
var rv : Vector3 = 5.0 * o11853_input_in(uv);
|
||||
|
||||
rv -= o11853_input_in(uv + Vector2(e.x, e.y));
|
||||
rv -= o11853_input_in(uv - Vector2(e.x, e.y));
|
||||
rv -= o11853_input_in(uv + Vector2(e.y, e.x));
|
||||
rv -= o11853_input_in(uv - Vector2(e.y, e.x));
|
||||
|
||||
return rv
|
||||
|
||||
func shape_circle(uv : Vector2, sides : float, size : float, edge : float) -> float:
|
||||
uv.x = 2.0 * uv.x - 1.0
|
||||
uv.y = 2.0 * uv.y - 1.0
|
||||
|
||||
edge = max(edge, 1.0e-8)
|
||||
|
||||
var distance : float = uv.length()
|
||||
|
||||
return clamp((1.0 - distance / size) / edge, 0.0, 1.0)
|
||||
|
||||
|
||||
func clampv3(v : Vector3, mi : Vector3, ma : Vector3) -> Vector3:
|
||||
v.x = clamp(v.x, mi.x, ma.x)
|
||||
v.y = clamp(v.y, mi.y, ma.y)
|
||||
v.y = clamp(v.z, mi.z, ma.z)
|
||||
|
||||
return v
|
||||
|
||||
func floorc(a : Color) -> Color:
|
||||
var v : Color = Color()
|
||||
|
||||
v.r = floor(a.r)
|
||||
v.g = floor(a.g)
|
||||
v.b = floor(a.b)
|
||||
v.a = floor(a.a)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func floorv2(a : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = floor(a.x)
|
||||
v.y = floor(a.y)
|
||||
|
||||
return v
|
||||
|
||||
func smoothstepv2(a : float, b : float, c : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = smoothstep(a, b, c.x)
|
||||
v.y = smoothstep(a, b, c.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func maxv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = max(a.x, b.x)
|
||||
v.y = max(a.y, b.y)
|
||||
v.z = max(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
func absv2(v : Vector2) -> Vector2:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func absv3(v : Vector3) -> Vector3:
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv2(v : Vector2) -> Vector2:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func cosv3(v : Vector3) -> Vector3:
|
||||
v.x = cos(v.x)
|
||||
v.y = cos(v.y)
|
||||
v.y = cos(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func modv3(a : Vector3, b : Vector3) -> Vector3:
|
||||
var v : Vector3 = Vector3()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
v.z = modf(a.z, b.z)
|
||||
|
||||
return v
|
||||
|
||||
|
||||
func modv2(a : Vector2, b : Vector2) -> Vector2:
|
||||
var v : Vector2 = Vector2()
|
||||
|
||||
v.x = modf(a.x, b.x)
|
||||
v.y = modf(a.y, b.y)
|
||||
|
||||
return v
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fractv2(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractv3(v : Vector3) -> Vector3:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
v.z = v.z - floor(v.z)
|
||||
|
||||
return v
|
||||
|
||||
func fract(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func clampv2(v : Vector2, pmin : Vector2, pmax : Vector2) -> Vector2:
|
||||
v.x = clamp(v.x, pmin.x, pmax.x)
|
||||
v.y = clamp(v.y, pmin.y, pmax.y)
|
||||
|
||||
return v
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fract(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func rand2(x : Vector2) -> Vector2:
|
||||
return fractv2(cosv2(Vector2(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)))) * 43758.5453);
|
||||
|
||||
func rand3(x : Vector2) -> Vector3:
|
||||
return fractv3(cosv3(Vector3(x.dot(Vector2(13.9898, 8.141)),
|
||||
x.dot(Vector2(3.4562, 17.398)),
|
||||
x.dot(Vector2(13.254, 5.867)))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.y < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.x < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
func reff(bb):
|
||||
if bb:
|
||||
gen()
|
||||
|
12
game/addons/mat_maker_gd/filter/sharpen.tscn
Normal file
12
game/addons/mat_maker_gd/filter/sharpen.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mat_maker_gd/filter/sharpen.gd" type="Script" id=1]
|
||||
|
||||
[node name="TextureRect" type="TextureRect"]
|
||||
margin_right = 300.0
|
||||
margin_bottom = 300.0
|
||||
expand = true
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
77
game/addons/mat_maker_gd/material_maker_nodes/adjust_hsv.mmg
Normal file
77
game/addons/mat_maker_gd/material_maker_nodes/adjust_hsv.mmg
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "adjust_hsv",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"hue": 0,
|
||||
"saturation": 1,
|
||||
"value": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_rbga = $in($(uv));\nvec3 $(name_uv)_hsv = rgb_to_hsv($(name_uv)_rbga.rgb);\n$(name_uv)_hsv.x += $(hue);\n$(name_uv)_hsv.y = clamp($(name_uv)_hsv.y*$(saturation), 0.0, 1.0);\n$(name_uv)_hsv.z = clamp($(name_uv)_hsv.z*$(value), 0.0, 1.0);\n\t",
|
||||
"global": "vec3 rgb_to_hsv(vec3 c) {\n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\tvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n\tvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n\tfloat d = q.x - min(q.w, q.y);\n\tfloat e = 1.0e-10;\n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nvec3 hsv_to_rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv.x, $uv.y, 0.0, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Adjusts the Hue, Saturation and Value of its input",
|
||||
"name": "AdjustHSV",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the image with adjusted Hue, Saturation and Value",
|
||||
"rgba": "vec4(hsv_to_rgb($(name_uv)_hsv), $(name_uv)_rbga.a)",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Hue",
|
||||
"longdesc": "The Hue adjustment",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "hue",
|
||||
"shortdesc": "Hue",
|
||||
"step": 0,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Saturation",
|
||||
"longdesc": "The Saturation adjustment",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "saturation",
|
||||
"shortdesc": "Saturation",
|
||||
"step": 0,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Value",
|
||||
"longdesc": "The Value adjustment",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "value",
|
||||
"shortdesc": "Value",
|
||||
"step": 0,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Adjust HSV"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
109
game/addons/mat_maker_gd/material_maker_nodes/arc_pavement.mmg
Normal file
109
game/addons/mat_maker_gd/material_maker_nodes/arc_pavement.mmg
Normal file
@ -0,0 +1,109 @@
|
||||
{
|
||||
"name": "arc_pavement",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"bevel": 0.2,
|
||||
"bricks": 8,
|
||||
"mortar": 0.05,
|
||||
"repeat": 2,
|
||||
"rows": 12
|
||||
},
|
||||
"seed": 0,
|
||||
"seed_locked": false,
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_uv = fract($uv)*vec2($repeat, -1.0);\nvec2 $(name_uv)_seed;\nvec4 $(name_uv)_ap = arc_pavement($(name_uv)_uv, $rows, $bricks, $(name_uv)_seed);\n",
|
||||
"global": "float pavement(vec2 uv, float bevel, float mortar) {\n\tuv = abs(uv-vec2(0.5));\n\treturn clamp((0.5*(1.0-mortar)-max(uv.x, uv.y))/max(0.0001, bevel), 0.0, 1.0);\n}\n\nvec4 arc_pavement(vec2 uv, float acount, float lcount, out vec2 seed) {\n\tfloat PI = 3.141592654;\n\tfloat radius = (0.5/sqrt(2.0));\n float uvx = uv.x;\n uv.x = 0.5*fract(uv.x+0.5)+0.25;\n float center = (uv.x-0.5)/radius;\n center *= center;\n center = floor(acount*(uv.y-radius*sqrt(1.0-center))+0.5)/acount;\n vec2 v = uv-vec2(0.5, center);\n float cornerangle = 0.85/acount+0.25*PI;\n float acountangle = (PI-2.0*cornerangle)/(lcount+floor(mod(center*acount, 2.0)));\n float angle = mod(atan(v.y, v.x), 2.0*PI);\n\tfloat base_angle;\n\tfloat local_uvy = 0.5+acount*(length(v)-radius)*(1.54-0.71*cos(1.44*(angle-PI*0.5)));\n\tvec2 local_uv;\n if (angle < cornerangle) {\n base_angle = 0.25*PI;\n\t\tlocal_uv = vec2((angle-0.25*PI)/cornerangle*0.38*acount+0.5, 1.0-local_uvy);\n\t\tseed = vec2(fract(center), 0.0);\n } else if (angle > PI-cornerangle) {\n base_angle = 0.75*PI;\n\t\tlocal_uv = vec2(local_uvy, 0.5-(0.75*PI-angle)/cornerangle*0.38*acount);\n\t\tseed = vec2(fract(center), 0.0);\n } else {\n base_angle = cornerangle+(floor((angle-cornerangle)/acountangle)+0.5)*acountangle;\n\t\tlocal_uv = vec2((angle-base_angle)/acountangle+0.5, 1.0-local_uvy);\n\t\tseed = vec2(fract(center), base_angle);\n }\n vec2 brick_center = vec2(0.5, center)+radius*vec2(cos(base_angle), sin(base_angle));\n return vec4(brick_center.x+uvx-uv.x, brick_center.y, local_uv);\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Draws a white shape on a black background",
|
||||
"name": "Arc pavement",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "pavement($(name_uv)_ap.zw, $bevel, 2.0*$mortar)",
|
||||
"longdesc": "A greyscale image that shows the bricks pattern",
|
||||
"shortdesc": "Bricks pattern",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "A random color for each brick",
|
||||
"rgb": "rand3($(name_uv)_seed)",
|
||||
"shortdesc": "Random color",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "vec3($(name_uv)_ap.zw, 0.0)",
|
||||
"shortdesc": "Brick UV",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 2,
|
||||
"label": "Repeat:",
|
||||
"longdesc": "The number of repetitions of the whole pattern",
|
||||
"max": 4,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 8,
|
||||
"label": "Rows:",
|
||||
"longdesc": "The number of rows",
|
||||
"max": 16,
|
||||
"min": 4,
|
||||
"name": "rows",
|
||||
"shortdesc": "Rows",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 8,
|
||||
"label": "Bricks:",
|
||||
"longdesc": "The number of bricks per row",
|
||||
"max": 16,
|
||||
"min": 4,
|
||||
"name": "bricks",
|
||||
"shortdesc": "Bricks",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Mortar:",
|
||||
"longdesc": "The width of the space between bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "mortar",
|
||||
"shortdesc": "Mortar",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Bevel:",
|
||||
"longdesc": "The width of the edge of each brick",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "bevel",
|
||||
"shortdesc": "Bevel",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
386
game/addons/mat_maker_gd/material_maker_nodes/auto_tones.mmg
Normal file
386
game/addons/mat_maker_gd/material_maker_nodes/auto_tones.mmg
Normal file
@ -0,0 +1,386 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "graph",
|
||||
"from_port": 0,
|
||||
"to": "tones_map",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "graph",
|
||||
"from_port": 1,
|
||||
"to": "tones_map",
|
||||
"to_port": 2
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "graph",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "tones_map",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "tones_map",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Auto Tones",
|
||||
"longdesc": "Finds the minimum and maximum values in the input texture and tone maps it to the full 0.0 - 1.0 range.",
|
||||
"name": "auto_tones",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "combine",
|
||||
"from_port": 0,
|
||||
"to": "iterate_buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "decompose",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "decompose",
|
||||
"from_port": 1,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "iterate_buffer",
|
||||
"from_port": 0,
|
||||
"to": "decompose",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "iterate_buffer",
|
||||
"from_port": 1,
|
||||
"to": "14423",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "14423",
|
||||
"from_port": 0,
|
||||
"to": "iterate_buffer",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "combine",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "combine",
|
||||
"to_port": 1
|
||||
}
|
||||
],
|
||||
"label": "Find Min Max",
|
||||
"longdesc": "",
|
||||
"name": "graph",
|
||||
"node_position": {
|
||||
"x": 1105.399902,
|
||||
"y": -179.398849
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "14423",
|
||||
"node_position": {
|
||||
"x": 344,
|
||||
"y": 217
|
||||
},
|
||||
"parameters": {
|
||||
"size": 10
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "vec3 $(name)_compare(vec2 uv, float size) {\n\tfloat iter = $in(uv).b;\n\tsize = size / pow(2.0, (iter * 100.0) );\n\titer += 0.01;\n\tfloat pixel_offset = 1.0 / size;\n\tvec2 half_res_uv = floor(uv * size / 2.0) / size * 2.0 + pixel_offset / 2.0;\n\tvec3 values[4];\n\tvalues[0] = $in(half_res_uv);\n\tvalues[1] = $in(half_res_uv + vec2(pixel_offset, 0.0));\n\tvalues[2] = $in(half_res_uv + vec2(0.0, pixel_offset));\n\tvalues[3] = $in(half_res_uv + vec2(pixel_offset, pixel_offset));\n\t\n\tfloat lowest = 1.0;\n\tfloat highest = 0.0;\n\t\n\tfor (int i = 0; i < 4; i++) {\n\t\tlowest = values[i].r < lowest ? values[i].r : lowest;\n\t\thighest = values[i].g > highest ? values[i].g : highest;\n\t}\n\t\n\treturn vec3( lowest, highest , iter);\n}",
|
||||
"name": "Compare Neighbor",
|
||||
"outputs": [
|
||||
{
|
||||
"rgb": "$(name)_compare($uv, $size)",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 10,
|
||||
"first": 1,
|
||||
"label": "",
|
||||
"last": 13,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"name": "iterate_buffer",
|
||||
"node_position": {
|
||||
"x": 328,
|
||||
"y": 63
|
||||
},
|
||||
"parameters": {
|
||||
"filter": false,
|
||||
"iterations": 13,
|
||||
"mipmap": false,
|
||||
"size": 10
|
||||
},
|
||||
"seed_value": 29168,
|
||||
"type": "iterate_buffer"
|
||||
},
|
||||
{
|
||||
"name": "combine",
|
||||
"node_position": {
|
||||
"x": 376,
|
||||
"y": -75
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"type": "combine"
|
||||
},
|
||||
{
|
||||
"name": "decompose",
|
||||
"node_position": {
|
||||
"x": 605,
|
||||
"y": 64
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"type": "decompose"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -199,
|
||||
"y": 23
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "in",
|
||||
"shortdesc": "In",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 831,
|
||||
"y": 42
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "min",
|
||||
"shortdesc": "Min",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "max",
|
||||
"shortdesc": "Max",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": 248.399994,
|
||||
"y": -292
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 10
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Size",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "iterate_buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "14423",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"name": "param0",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 10
|
||||
},
|
||||
"shortdesc": "",
|
||||
"type": "graph"
|
||||
},
|
||||
{
|
||||
"name": "tones_map",
|
||||
"node_position": {
|
||||
"x": 1142.528442,
|
||||
"y": -88.26989
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.5 ,0.5, 0.5, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in_min",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "in_max",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Maps linearly an input tones interval to an output tones interval.",
|
||||
"name": "Mapping",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "($in($uv)-$in_min($uv))/($in_max($uv)-$in_min($uv))",
|
||||
"longdesc": "Shows the generated remapped image",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Tones map"
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": 665.528564,
|
||||
"y": -136.535721
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 1425.400024,
|
||||
"y": -135.535721
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Shows the generated remapped image",
|
||||
"name": "out",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": 1024.664307,
|
||||
"y": -298.400757
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 10
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "graph",
|
||||
"widget": "param0"
|
||||
}
|
||||
],
|
||||
"longdesc": "Buffers are used to find the mininum and maximum values for the input image. If the input has small details a higher resolution buffer might be needed to capture precise min and max values.\n\nNote: The output itself will not be buffered.",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 10
|
||||
},
|
||||
"shortdesc": "Auto Tones",
|
||||
"type": "graph"
|
||||
}
|
69
game/addons/mat_maker_gd/material_maker_nodes/beehive.mmg
Normal file
69
game/addons/mat_maker_gd/material_maker_nodes/beehive.mmg
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "beehive",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"sx": 4,
|
||||
"sy": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_uv = $uv*vec2($sx, $sy*1.73205080757);\nvec4 $(name_uv)_center = beehive_center($(name_uv)_uv);",
|
||||
"global": "float beehive_dist(vec2 p){\n\tvec2 s = vec2(1.0, 1.73205080757);\n p = abs(p);\n return max(dot(p, s*.5), p.x);\n}\n\nvec4 beehive_center(vec2 p) {\n\tvec2 s = vec2(1.0, 1.73205080757);\n vec4 hC = floor(vec4(p, p - vec2(.5, 1))/vec4(s,s)) + .5;\n vec4 h = vec4(p - hC.xy*s, p - (hC.zw + .5)*s);\n return dot(h.xy, h.xy)<dot(h.zw, h.zw) ? vec4(h.xy, hC.xy) : vec4(h.zw, hC.zw + 9.73);\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Draws a greyscale hexagonal tiles pattern",
|
||||
"name": "Beehive",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "1.0-2.0*beehive_dist($(name_uv)_center.xy)",
|
||||
"longdesc": "Shows the greyscale pattern",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows a random color for each hexagonal tile",
|
||||
"rgb": "rand3(fract($(name_uv)_center.zw/vec2($sx, $sy))+vec2(float($seed)))",
|
||||
"shortdesc": "Random color",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows an UV map to be connected to the UV map port of the Custom UV node",
|
||||
"rgb": "vec3(vec2(0.5)+$(name_uv)_center.xy, rand(fract($(name_uv)_center.zw/vec2($sx, $sy))+vec2(float($seed))))",
|
||||
"shortdesc": "UV map",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 2,
|
||||
"label": "Size X",
|
||||
"longdesc": "The number of columns of the pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "sx",
|
||||
"shortdesc": "Size.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 2,
|
||||
"label": "Size Y",
|
||||
"longdesc": "The number of rows of the pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "sy",
|
||||
"shortdesc": "Size.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Hexagonal tiles pattern"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
126
game/addons/mat_maker_gd/material_maker_nodes/blend.mmg
Normal file
126
game/addons/mat_maker_gd/material_maker_nodes/blend.mmg
Normal file
@ -0,0 +1,126 @@
|
||||
{
|
||||
"name": "blend",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 0.5,
|
||||
"blend_type": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_s1 = $s1($uv);\nvec4 $(name_uv)_s2 = $s2($uv);\nfloat $(name_uv)_a = $amount*$a($uv);\n",
|
||||
"global": "vec3 blend_normal(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*c1 + (1.0-opacity)*c2;\n}\n\nvec3 blend_dissolve(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\tif (rand(uv) < opacity) {\n\t\treturn c1;\n\t} else {\n\t\treturn c2;\n\t}\n}\n\nvec3 blend_multiply(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*c1*c2 + (1.0-opacity)*c2;\n}\n\nvec3 blend_screen(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*(1.0-(1.0-c1)*(1.0-c2)) + (1.0-opacity)*c2;\n}\n\nfloat blend_overlay_f(float c1, float c2) {\n\treturn (c1 < 0.5) ? (2.0*c1*c2) : (1.0-2.0*(1.0-c1)*(1.0-c2));\n}\n\nvec3 blend_overlay(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*vec3(blend_overlay_f(c1.x, c2.x), blend_overlay_f(c1.y, c2.y), blend_overlay_f(c1.z, c2.z)) + (1.0-opacity)*c2;\n}\n\nvec3 blend_hard_light(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*0.5*(c1*c2+blend_overlay(uv, c1, c2, 1.0)) + (1.0-opacity)*c2;\n}\n\nfloat blend_soft_light_f(float c1, float c2) {\n\treturn (c2 < 0.5) ? (2.0*c1*c2+c1*c1*(1.0-2.0*c2)) : 2.0*c1*(1.0-c2)+sqrt(c1)*(2.0*c2-1.0);\n}\n\nvec3 blend_soft_light(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*vec3(blend_soft_light_f(c1.x, c2.x), blend_soft_light_f(c1.y, c2.y), blend_soft_light_f(c1.z, c2.z)) + (1.0-opacity)*c2;\n}\n\nfloat blend_burn_f(float c1, float c2) {\n\treturn (c1==0.0)?c1:max((1.0-((1.0-c2)/c1)),0.0);\n}\n\nvec3 blend_burn(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*vec3(blend_burn_f(c1.x, c2.x), blend_burn_f(c1.y, c2.y), blend_burn_f(c1.z, c2.z)) + (1.0-opacity)*c2;\n}\n\nfloat blend_dodge_f(float c1, float c2) {\n\treturn (c1==1.0)?c1:min(c2/(1.0-c1),1.0);\n}\n\nvec3 blend_dodge(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*vec3(blend_dodge_f(c1.x, c2.x), blend_dodge_f(c1.y, c2.y), blend_dodge_f(c1.z, c2.z)) + (1.0-opacity)*c2;\n}\n\nvec3 blend_lighten(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*max(c1, c2) + (1.0-opacity)*c2;\n}\n\nvec3 blend_darken(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*min(c1, c2) + (1.0-opacity)*c2;\n}\n\nvec3 blend_difference(vec2 uv, vec3 c1, vec3 c2, float opacity) {\n\treturn opacity*clamp(c2-c1, vec3(0.0), vec3(1.0)) + (1.0-opacity)*c2;\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv.x, 1.0, 1.0, 1.0)",
|
||||
"label": "Source1",
|
||||
"longdesc": "The foreground input",
|
||||
"name": "s1",
|
||||
"shortdesc": "Foreground",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "vec4(1.0, $uv.y, 1.0, 1.0)",
|
||||
"label": "Source2",
|
||||
"longdesc": "The background input",
|
||||
"name": "s2",
|
||||
"shortdesc": "Background",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "Opacity",
|
||||
"longdesc": "The optional opacity mask",
|
||||
"name": "a",
|
||||
"shortdesc": "Mask",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Blends its input, using an optional mask",
|
||||
"name": "Blend",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the result of the blend operation",
|
||||
"rgba": "vec4(blend_$blend_type($uv, $(name_uv)_s1.rgb, $(name_uv)_s2.rgb, $(name_uv)_a*$(name_uv)_s1.a), min(1.0, $(name_uv)_s2.a+$(name_uv)_a*$(name_uv)_s1.a))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The algorithm used to blend the inputs",
|
||||
"name": "blend_type",
|
||||
"shortdesc": "Blend mode",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Normal",
|
||||
"value": "normal"
|
||||
},
|
||||
{
|
||||
"name": "Dissolve",
|
||||
"value": "dissolve"
|
||||
},
|
||||
{
|
||||
"name": "Multiply",
|
||||
"value": "multiply"
|
||||
},
|
||||
{
|
||||
"name": "Screen",
|
||||
"value": "screen"
|
||||
},
|
||||
{
|
||||
"name": "Overlay",
|
||||
"value": "overlay"
|
||||
},
|
||||
{
|
||||
"name": "Hard Light",
|
||||
"value": "hard_light"
|
||||
},
|
||||
{
|
||||
"name": "Soft Light",
|
||||
"value": "soft_light"
|
||||
},
|
||||
{
|
||||
"name": "Burn",
|
||||
"value": "burn"
|
||||
},
|
||||
{
|
||||
"name": "Dodge",
|
||||
"value": "dodge"
|
||||
},
|
||||
{
|
||||
"name": "Lighten",
|
||||
"value": "lighten"
|
||||
},
|
||||
{
|
||||
"name": "Darken",
|
||||
"value": "darken"
|
||||
},
|
||||
{
|
||||
"name": "Difference",
|
||||
"value": "difference"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "3:",
|
||||
"longdesc": "The opacity of the blend operation",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "amount",
|
||||
"shortdesc": "Opacity",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Blend"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
146
game/addons/mat_maker_gd/material_maker_nodes/box.mmg
Normal file
146
game/addons/mat_maker_gd/material_maker_nodes/box.mmg
Normal file
@ -0,0 +1,146 @@
|
||||
{
|
||||
"name": "box",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"cx": 0.5,
|
||||
"cy": 0.5,
|
||||
"cz": 0.5,
|
||||
"rx": 0,
|
||||
"ry": 0,
|
||||
"rz": 0,
|
||||
"sx": 0.25,
|
||||
"sy": 0.25,
|
||||
"sz": 0.25
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float box(vec2 uv, vec3 center, vec3 rad, vec3 rot) {\n\tvec3 ro = vec3(uv, 1.0)-center;\n\tvec3 rd = vec3(0.0000001, 0.0000001, -1.0);\n\tmat3 r = mat3(vec3(1, 0, 0), vec3(0, cos(rot.x), -sin(rot.x)), vec3(0, sin(rot.x), cos(rot.x)));\n\tr *= mat3(vec3(cos(rot.y), 0, -sin(rot.y)), vec3(0, 1, 0), vec3(sin(rot.y), 0, cos(rot.y)));\n\tr *= mat3(vec3(cos(rot.z), -sin(rot.z), 0), vec3(sin(rot.z), cos(rot.z), 0), vec3(0, 0, 1));\n\tro = r * ro;\n\trd = r * rd;\n vec3 m = 1.0/rd;\n vec3 n = m*ro;\n vec3 k = abs(m)*rad;\n vec3 t1 = -n - k;\n vec3 t2 = -n + k;\n\n float tN = max(max(t1.x, t1.y), t1.z);\n float tF = min(min(t2.x, t2.y), t2.z);\n if(tN>tF || tF<0.0) return 1.0;\n return tN;\n}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Box",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "1.0-box($uv, vec3($cx, $cy, $cz), vec3($sx, $sy, $sz), 0.01745329251*vec3($rx, $ry, $rz))",
|
||||
"longdesc": "A heightmap of the specified box",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Center X",
|
||||
"longdesc": "X coordinate of the center of the box",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "cx",
|
||||
"shortdesc": "Center.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Center Y",
|
||||
"longdesc": "Y coordinate of the center of the box",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "cy",
|
||||
"shortdesc": "Center.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Center Z",
|
||||
"longdesc": "Z coordinate of the center of the box",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "cz",
|
||||
"shortdesc": "Center.z",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Size X",
|
||||
"longdesc": "Size along X axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "sx",
|
||||
"shortdesc": "Size.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Size Y",
|
||||
"longdesc": "Size along Y axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "sy",
|
||||
"shortdesc": "Size.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Size Z",
|
||||
"longdesc": "Size along Z axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "sz",
|
||||
"shortdesc": "Size.z",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rot X",
|
||||
"longdesc": "Rotation angle around X axis",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "rx",
|
||||
"shortdesc": "Rot.x",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rot Y",
|
||||
"longdesc": "Rotation angle around Y axis",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "ry",
|
||||
"shortdesc": "Rot.y",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rot Z",
|
||||
"longdesc": "Rotation angle around Y axis",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "rz",
|
||||
"shortdesc": "Rot.z",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
225
game/addons/mat_maker_gd/material_maker_nodes/bricks.mmg
Normal file
225
game/addons/mat_maker_gd/material_maker_nodes/bricks.mmg
Normal file
@ -0,0 +1,225 @@
|
||||
{
|
||||
"name": "bricks",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"bevel": 0.1,
|
||||
"columns": 3,
|
||||
"corner": 0.3,
|
||||
"mortar": 0.1,
|
||||
"pattern": 0,
|
||||
"repeat": 1,
|
||||
"round": 0,
|
||||
"row_offset": 0.5,
|
||||
"rows": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_rect = bricks_$pattern($uv, vec2($columns, $rows), $repeat, $row_offset);\nvec4 $(name_uv) = brick($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $round*$round_map($uv), max(0.001, $bevel*$bevel_map($uv)));\n",
|
||||
"global": "vec4 brick(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float round, float bevel) {\n\tfloat color;\n\tvec2 size = bmax - bmin;\n\tfloat min_size = min(size.x, size.y);\n\tmortar *= min_size;\n\tbevel *= min_size;\n\tround *= min_size;\n\tvec2 center = 0.5*(bmin+bmax);\n vec2 d = abs(uv-center)-0.5*(size)+vec2(round+mortar);\n color = length(max(d,vec2(0))) + min(max(d.x,d.y),0.0)-round;\n\tcolor = clamp(-color/bevel, 0.0, 1.0);\n\tvec2 tiled_brick_pos = mod(bmin, vec2(1.0, 1.0));\n\treturn vec4(color, center, tiled_brick_pos.x+7.0*tiled_brick_pos.y);\n}\n\nvec3 brick_random_color(vec2 bmin, vec2 bmax, float seed) {\n\tvec2 center = 0.5*(bmin + bmax);\n\treturn rand3(fract(center + vec2(seed)));\n}\n\nvec3 brick_uv(vec2 uv, vec2 bmin, vec2 bmax, float seed) {\n\tvec2 center = 0.5*(bmin + bmax);\n\tvec2 size = bmax - bmin;\n\tfloat max_size = max(size.x, size.y);\n\treturn vec3(0.5+(uv-center)/max_size, rand(fract(center)+vec2(seed)));\n}\n\nvec3 brick_corner_uv(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float corner, float seed) {\n\tvec2 center = 0.5*(bmin + bmax);\n\tvec2 size = bmax - bmin;\n\tfloat max_size = max(size.x, size.y);\n\tfloat min_size = min(size.x, size.y);\n\tmortar *= min_size;\n\tcorner *= min_size;\n\treturn vec3(clamp((0.5*size-vec2(mortar)-abs(uv-center))/corner, vec2(0.0), vec2(1.0)), rand(fract(center)+vec2(seed)+ceil(vec2(uv-center))));\n}\n\nvec4 bricks_rb(vec2 uv, vec2 count, float repeat, float offset) {\n\tcount *= repeat;\n\tfloat x_offset = offset*step(0.5, fract(uv.y*count.y*0.5));\n\tvec2 bmin = floor(vec2(uv.x*count.x-x_offset, uv.y*count.y));\n\tbmin.x += x_offset;\n\tbmin /= count;\n\treturn vec4(bmin, bmin+vec2(1.0)/count);\n}\n\nvec4 bricks_rb2(vec2 uv, vec2 count, float repeat, float offset) {\n\tcount *= repeat;\n\tfloat x_offset = offset*step(0.5, fract(uv.y*count.y*0.5));\n\tcount.x = count.x*(1.0+step(0.5, fract(uv.y*count.y*0.5)));\n\tvec2 bmin = floor(vec2(uv.x*count.x-x_offset, uv.y*count.y));\n\tbmin.x += x_offset;\n\tbmin /= count;\n\treturn vec4(bmin, bmin+vec2(1.0)/count);\n}\n\nvec4 bricks_hb(vec2 uv, vec2 count, float repeat, float offset) {\n\tfloat pc = count.x+count.y;\n\tfloat c = pc*repeat;\n\tvec2 corner = floor(uv*c);\n\tfloat cdiff = mod(corner.x-corner.y, pc);\n\tif (cdiff < count.x) {\n\t\treturn vec4((corner-vec2(cdiff, 0.0))/c, (corner-vec2(cdiff, 0.0)+vec2(count.x, 1.0))/c);\n\t} else {\n\t\treturn vec4((corner-vec2(0.0, pc-cdiff-1.0))/c, (corner-vec2(0.0, pc-cdiff-1.0)+vec2(1.0, count.y))/c);\n\t}\n}\n\nvec4 bricks_bw(vec2 uv, vec2 count, float repeat, float offset) {\n\tvec2 c = 2.0*count*repeat;\n\tfloat mc = max(c.x, c.y);\n\tvec2 corner1 = floor(uv*c);\n\tvec2 corner2 = count*floor(repeat*2.0*uv);\n\tfloat cdiff = mod(dot(floor(repeat*2.0*uv), vec2(1.0)), 2.0);\n\tvec2 corner;\n\tvec2 size;\n\tif (cdiff == 0.0) {\n\t\tcorner = vec2(corner1.x, corner2.y);\n\t\tsize = vec2(1.0, count.y);\n\t} else {\n\t\tcorner = vec2(corner2.x, corner1.y);\n\t\tsize = vec2(count.x, 1.0);\n\t}\n\treturn vec4(corner/c, (corner+size)/c);\n}\n\nvec4 bricks_sb(vec2 uv, vec2 count, float repeat, float offset) {\n\tvec2 c = (count+vec2(1.0))*repeat;\n\tfloat mc = max(c.x, c.y);\n\tvec2 corner1 = floor(uv*c);\n\tvec2 corner2 = (count+vec2(1.0))*floor(repeat*uv);\n\tvec2 rcorner = corner1 - corner2;\n\tvec2 corner;\n\tvec2 size;\n\tif (rcorner.x == 0.0 && rcorner.y < count.y) {\n\t\tcorner = corner2;\n\t\tsize = vec2(1.0, count.y);\n\t} else if (rcorner.y == 0.0) {\n\t\tcorner = corner2+vec2(1.0, 0.0);\n\t\tsize = vec2(count.x, 1.0);\n\t} else if (rcorner.x == count.x) {\n\t\tcorner = corner2+vec2(count.x, 1.0);\n\t\tsize = vec2(1.0, count.y);\n\t} else if (rcorner.y == count.y) {\n\t\tcorner = corner2+vec2(0.0, count.y);\n\t\tsize = vec2(count.x, 1.0);\n\t} else {\n\t\tcorner = corner2+vec2(1.0);\n\t\tsize = vec2(count.x-1.0, count.y-1.0);\n\t}\n\treturn vec4(corner/c, (corner+size)/c);\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "6:",
|
||||
"longdesc": "A map that affects the Mortar parameter",
|
||||
"name": "mortar_map",
|
||||
"shortdesc": "Mortar map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Bevel parameter",
|
||||
"name": "bevel_map",
|
||||
"shortdesc": "Bevel map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Round parameter",
|
||||
"name": "round_map",
|
||||
"shortdesc": "Round map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates different bricks patterns, with many useful outputs.",
|
||||
"name": "Bricks",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name_uv).x",
|
||||
"longdesc": "A greyscale image that shows the bricks pattern",
|
||||
"shortdesc": "Bricks pattern",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "A random color for each brick",
|
||||
"rgb": "brick_random_color($(name_uv)_rect.xy, $(name_uv)_rect.zw, float($seed))",
|
||||
"shortdesc": "Random color",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).y",
|
||||
"longdesc": "The position of each brick along the X axis",
|
||||
"shortdesc": "Position.x",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).z",
|
||||
"longdesc": "The position of each brick along the Y axis",
|
||||
"shortdesc": "Position.y",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, float($seed))",
|
||||
"shortdesc": "Brick UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick corner, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_corner_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $corner, float($seed))",
|
||||
"shortdesc": "Corner UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "0.5*(sign($(name_uv)_rect.z-$(name_uv)_rect.x-$(name_uv)_rect.w+$(name_uv)_rect.y)+1.0)",
|
||||
"longdesc": "The direction of each brick (white: horizontal, black: vertical)",
|
||||
"shortdesc": "Direction",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The type of brick pattern",
|
||||
"name": "pattern",
|
||||
"shortdesc": "Pattern",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Running bond",
|
||||
"value": "rb"
|
||||
},
|
||||
{
|
||||
"name": "Running bond (2)",
|
||||
"value": "rb2"
|
||||
},
|
||||
{
|
||||
"name": "HerringBone",
|
||||
"value": "hb"
|
||||
},
|
||||
{
|
||||
"name": "Basket weave",
|
||||
"value": "bw"
|
||||
},
|
||||
{
|
||||
"name": "Spanish bond",
|
||||
"value": "sb"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat:",
|
||||
"longdesc": "The number of repetitions of the whole pattern",
|
||||
"max": 8,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 6,
|
||||
"label": "Rows:",
|
||||
"longdesc": "The number of rows of a pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "rows",
|
||||
"shortdesc": "Rows",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "Columns:",
|
||||
"longdesc": "The number of columns of a pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "columns",
|
||||
"shortdesc": "Columns",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Offset:",
|
||||
"longdesc": "The offset of the pattern (not useful for all patterns)",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "row_offset",
|
||||
"shortdesc": "Offset",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Mortar:",
|
||||
"longdesc": "The width of the space between bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "mortar",
|
||||
"shortdesc": "Mortar",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Bevel:",
|
||||
"longdesc": "The width of the edge of each brick",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "bevel",
|
||||
"shortdesc": "Bevel",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Round:",
|
||||
"longdesc": "The radius of the round corners of bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "round",
|
||||
"shortdesc": "Round",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Corner:",
|
||||
"longdesc": "The size of the corner part of each brick (only used by the Corner UV output)",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "corner",
|
||||
"shortdesc": "Corner",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Simple bricks patterns"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,228 @@
|
||||
{
|
||||
"name": "bricks_nontileable",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"bevel": 0.1,
|
||||
"columns": 3,
|
||||
"corner": 0.3,
|
||||
"mortar": 0.1,
|
||||
"pattern": 0,
|
||||
"repeat": 1,
|
||||
"round": 0,
|
||||
"row_offset": 0.5,
|
||||
"rows": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_rect = bricks_$pattern($uv, vec2($columns, $rows), $repeat, $row_offset);\nvec4 $(name_uv) = brick($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $round*$round_map($uv), max(0.001, $bevel*$bevel_map($uv)));\n",
|
||||
"global": "vec3 brick_infinite_random_color(vec2 bmin, vec2 bmax, float seed) {\n\tvec2 center = 0.5*(bmin + bmax);\n\treturn rand3(center + vec2(seed));\n}\n",
|
||||
"includes": [
|
||||
"bricks"
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "6:",
|
||||
"longdesc": "A map that affects the Mortar parameter",
|
||||
"name": "mortar_map",
|
||||
"shortdesc": "Mortar map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Bevel parameter",
|
||||
"name": "bevel_map",
|
||||
"shortdesc": "Bevel map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Round parameter",
|
||||
"name": "round_map",
|
||||
"shortdesc": "Round map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates different bricks patterns, with many useful outputs.",
|
||||
"name": "Bricks NonTileable",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name_uv).x",
|
||||
"longdesc": "A greyscale image that shows the bricks pattern",
|
||||
"shortdesc": "Bricks pattern",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "A random color for each brick",
|
||||
"rgb": "brick_infinite_random_color($(name_uv)_rect.xy, $(name_uv)_rect.zw, float($seed))",
|
||||
"shortdesc": "Random color",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).y",
|
||||
"longdesc": "The position of each brick along the X axis",
|
||||
"shortdesc": "Position.x",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).z",
|
||||
"longdesc": "The position of each brick along the Y axis",
|
||||
"shortdesc": "Position.y",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, float($seed))",
|
||||
"shortdesc": "Brick UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick corner, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_corner_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $corner, float($seed))",
|
||||
"shortdesc": "Corner UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "0.5*(sign($(name_uv)_rect.z-$(name_uv)_rect.x-$(name_uv)_rect.w+$(name_uv)_rect.y)+1.0)",
|
||||
"longdesc": "The direction of each brick (white: horizontal, black: vertical)",
|
||||
"shortdesc": "Direction",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The type of brick pattern",
|
||||
"name": "pattern",
|
||||
"shortdesc": "Pattern",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Running bond",
|
||||
"value": "rb"
|
||||
},
|
||||
{
|
||||
"name": "Running bond (2)",
|
||||
"value": "rb2"
|
||||
},
|
||||
{
|
||||
"name": "HerringBone",
|
||||
"value": "hb"
|
||||
},
|
||||
{
|
||||
"name": "Basket weave",
|
||||
"value": "bw"
|
||||
},
|
||||
{
|
||||
"name": "Spanish bond",
|
||||
"value": "sb"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat:",
|
||||
"longdesc": "The number of repetitions of the whole pattern",
|
||||
"max": 8,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 6,
|
||||
"label": "Rows:",
|
||||
"longdesc": "The number of rows of a pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "rows",
|
||||
"shortdesc": "Rows",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "Columns:",
|
||||
"longdesc": "The number of columns of a pattern",
|
||||
"max": 64,
|
||||
"min": 1,
|
||||
"name": "columns",
|
||||
"shortdesc": "Columns",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Offset:",
|
||||
"longdesc": "The offset of the pattern (not useful for all patterns)",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "row_offset",
|
||||
"shortdesc": "Offset",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Mortar:",
|
||||
"longdesc": "The width of the space between bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "mortar",
|
||||
"shortdesc": "Mortar",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Bevel:",
|
||||
"longdesc": "The width of the edge of each brick",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "bevel",
|
||||
"shortdesc": "Bevel",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Round:",
|
||||
"longdesc": "The radius of the round corners of bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "round",
|
||||
"shortdesc": "Round",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Corner:",
|
||||
"longdesc": "The size of the corner part of each brick (only used by the Corner UV output)",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "corner",
|
||||
"shortdesc": "Corner",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Simple bricks patterns"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
184
game/addons/mat_maker_gd/material_maker_nodes/bricks_uneven.mmg
Normal file
184
game/addons/mat_maker_gd/material_maker_nodes/bricks_uneven.mmg
Normal file
@ -0,0 +1,184 @@
|
||||
{
|
||||
"name": "bricks_uneven",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"bevel": 0.01,
|
||||
"corner": 0,
|
||||
"iterations": 8,
|
||||
"min_size": 0.3,
|
||||
"mortar": 0.01,
|
||||
"randomness": 0.5,
|
||||
"round": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_rect = bricks_uneven($uv, int($iterations), $min_size, $randomness, float($seed));\nvec4 $(name_uv) = brick2($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $round*$round_map($uv), max(0.00001, $bevel*$bevel_map($uv)));\n",
|
||||
"global": "vec4 brick2(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float round, float bevel) {\n\tfloat color;\n\tvec2 size = bmax - bmin;\n\tvec2 center = 0.5*(bmin+bmax);\n vec2 d = abs(uv-center)-0.5*(size)+vec2(round+mortar);\n color = length(max(d,vec2(0))) + min(max(d.x,d.y),0.0)-round;\n\tcolor = clamp(-color/bevel, 0.0, 1.0);\n\tvec2 tiled_brick_pos = mod(bmin, vec2(1.0, 1.0));\n\treturn vec4(color, center, tiled_brick_pos.x+7.0*tiled_brick_pos.y);\n}\n\nvec4 bricks_uneven(vec2 uv, int iterations, float min_size, float randomness, float seed) {\n\tvec2 a = vec2(0.0);\n\tvec2 b = vec2(1.0);\n\t\n\tfor (int i = 0; i < iterations; ++i) {\n\t\tvec2 size = b-a;\n\t\tif (max(size.x, size.y) < min_size) {\n\t\tbreak;\n\t\t}\n\t\tfloat x = rand(rand2(vec2(rand(a+b), seed)))*randomness+(1.0-randomness)*0.5;\n\t\tif (size.x > size.y) {\n\t\t\tx *= size.x;\n\t\t\tif (uv.x > a.x+x) {\n\t\t\t\ta.x += x;\n\t\t\t} else {\n\t\t\t\tb.x = a.x + x;\n\t\t\t}\n\t\t} else {\n\t\t\tx *= size.y;\n\t\t\tif (uv.y > a.y+x) {\n\t\t\t\ta.y += x;\n\t\t\t} else {\n\t\t\t\tb.y = a.y + x;\n\t\t\t}\n\t\t}\n\t}\n\treturn vec4(a, b);\n}\n",
|
||||
"includes": [
|
||||
"bricks"
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "4:",
|
||||
"longdesc": "A map that affects the Mortar parameter",
|
||||
"name": "mortar_map",
|
||||
"shortdesc": "Mortar map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Bevel parameter",
|
||||
"name": "bevel_map",
|
||||
"shortdesc": "Bevel map",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "A map that affects the Round parameter",
|
||||
"name": "round_map",
|
||||
"shortdesc": "Round map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates an uneven bricks pattern.",
|
||||
"name": "Uneven Bricks",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name_uv).x",
|
||||
"longdesc": "A greyscale image that shows the bricks pattern",
|
||||
"shortdesc": "Bricks pattern",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "A random color for each brick",
|
||||
"rgb": "rand3(fract($(name_uv)_rect.xy)+rand2(vec2(float($seed))))",
|
||||
"shortdesc": "Random color",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).y",
|
||||
"longdesc": "The position of each brick along the X axis",
|
||||
"shortdesc": "Position.x",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$(name_uv).z",
|
||||
"longdesc": "The position of each brick along the Y axis",
|
||||
"shortdesc": "Position.y",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, float($seed))",
|
||||
"shortdesc": "Brick UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "An UV map output for each brick corner, to be connected to the Map input of a CustomUV node",
|
||||
"rgb": "brick_corner_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar*$mortar_map($uv), $corner, float($seed))",
|
||||
"shortdesc": "Corner UV",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"f": "0.5*(sign($(name_uv)_rect.z-$(name_uv)_rect.x-$(name_uv)_rect.w+$(name_uv)_rect.y)+1.0)",
|
||||
"longdesc": "The direction of each brick (white: horizontal, black: vertical)",
|
||||
"shortdesc": "Direction",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 8,
|
||||
"label": "Iterations",
|
||||
"longdesc": "The number of iterations of the brick split operation",
|
||||
"max": 16,
|
||||
"min": 1,
|
||||
"name": "iterations",
|
||||
"shortdesc": "Iterations",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.3,
|
||||
"label": "Min size:",
|
||||
"longdesc": "The minimum size of a brick",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "min_size",
|
||||
"shortdesc": "Minimum size",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Randomness",
|
||||
"longdesc": "The randomness of the pattern",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "randomness",
|
||||
"shortdesc": "Randomness",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.05,
|
||||
"label": "Mortar:",
|
||||
"longdesc": "The width of the space between bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "mortar",
|
||||
"shortdesc": "Mortar",
|
||||
"step": 0.001,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.05,
|
||||
"label": "Bevel:",
|
||||
"longdesc": "The width of the edge of each brick",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "bevel",
|
||||
"shortdesc": "Bevel",
|
||||
"step": 0.001,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Round:",
|
||||
"longdesc": "The radius of the round corners of bricks",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "round",
|
||||
"shortdesc": "Round",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Corner:",
|
||||
"longdesc": "The size of the corner part of each brick (only used by the Corner UV output)",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "corner",
|
||||
"shortdesc": "Corner",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Uneven bricks"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "brightness_contrast",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"brightness": 0,
|
||||
"contrast": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.5 ,0.5, 0.5, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Adjusts the Brightness and Contrast of its input",
|
||||
"name": "Brightness/Contrast",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the image with modified Brightness and Contrast",
|
||||
"rgba": "vec4(clamp($in($uv).rgb*$contrast+vec3($brightness)+0.5-$contrast*0.5, vec3(0.0), vec3(1.0)), $in($uv).a)",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Brightness",
|
||||
"longdesc": "The Brightness adjustment",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"name": "brightness",
|
||||
"shortdesc": "Brightness",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Contrast",
|
||||
"longdesc": "The Contrast adjustment",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "contrast",
|
||||
"shortdesc": "Contrast",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Brightness/Contrast"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
169
game/addons/mat_maker_gd/material_maker_nodes/brush.mmg
Normal file
169
game/addons/mat_maker_gd/material_maker_nodes/brush.mmg
Normal file
@ -0,0 +1,169 @@
|
||||
{
|
||||
"name": "brush",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"has_albedo": true,
|
||||
"has_depth": false,
|
||||
"has_emission": false,
|
||||
"has_normal": false,
|
||||
"has_metallic": true,
|
||||
"has_roughness": true,
|
||||
"mode": 0
|
||||
},
|
||||
"is_brush": true,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "clamp(1.0-2.0*length($uv-vec2(0.5)), 0.0, 1.0)",
|
||||
"label": "Brush",
|
||||
"name": "brush",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"group_size": 5,
|
||||
"label": "Albedo",
|
||||
"name": "albedo",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "Metallic",
|
||||
"name": "metallic",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "Roughness",
|
||||
"name": "roughness",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "Emission",
|
||||
"name": "emission",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "vec4(0.5, 0.5, 0.0, 0.0)",
|
||||
"label": "Normal",
|
||||
"name": "normal",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "Depth",
|
||||
"name": "depth",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "Occlusion",
|
||||
"name": "ao",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Brush",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$brush($uv)",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"rgba": "$albedo($uv)",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"rgba": "vec4($metallic($uv), $roughness($uv), $has_metallic ? $albedo($uv).a : 0.0, $has_roughness ? $albedo($uv).a : 0.0)",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"rgba": "$emission($uv)",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"rgba": "$normal($uv)",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"rgba": "vec4($depth($uv), $ao($uv), $has_depth ? $albedo($uv).a : 0.0, $has_ao ? $albedo($uv).a : 0.0)",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"rgba": "vec4(vec3(1.0), $albedo($uv).a)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"name": "mode",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Stamp",
|
||||
"value": "stamp"
|
||||
},
|
||||
{
|
||||
"name": "Pattern",
|
||||
"value": "pattern"
|
||||
},
|
||||
{
|
||||
"name": "UV Pattern",
|
||||
"value": "uv_pattern"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": true,
|
||||
"label": "",
|
||||
"name": "has_albedo",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_metallic",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_roughness",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_emission",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_normal",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_depth",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "",
|
||||
"name": "has_ao",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "brush_node"
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "brush_select_from_id",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"id": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 0,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"name": "ids",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Select From ID",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$in($uv)*vec4(1.0, 1.0, 1.0, step(length($ids($uv)-$id), 0.01))",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"label": "",
|
||||
"name": "id",
|
||||
"type": "color"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
64
game/addons/mat_maker_gd/material_maker_nodes/circle_map.mmg
Normal file
64
game/addons/mat_maker_gd/material_maker_nodes/circle_map.mmg
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "circle_map",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"radius": 1,
|
||||
"repeat": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv, 0.0, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image to be remapped",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Maps its input into a circle",
|
||||
"name": "CircleMap",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the remapped image",
|
||||
"rgba": "$in(vec2(fract($repeat*atan($uv.y-0.5, $uv.x-0.5)*0.15915494309), min(0.99999, 2.0/$radius*length($uv-vec2(0.5)))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Radius",
|
||||
"longdesc": "The radius of the circle where the input is mapped",
|
||||
"max": 1.5,
|
||||
"min": 0,
|
||||
"name": "radius",
|
||||
"shortdesc": "Radius",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat",
|
||||
"longdesc": "The number of repetitions of the input image around the circle",
|
||||
"max": 16,
|
||||
"min": 0,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "CircleMap"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,219 @@
|
||||
{
|
||||
"name": "circle_splatter",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 20,
|
||||
"i_rotate": 0,
|
||||
"i_scale": 0,
|
||||
"radius": 0.4,
|
||||
"rings": 2,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"scale_x": 1,
|
||||
"scale_y": 1,
|
||||
"select_inputs": 0,
|
||||
"spiral": 0,
|
||||
"value": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_rch = splatter_$(name)($uv, int($count), int($rings), vec2(float($seed)));",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image or atlas of 4 or 16 input images",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The mask applied to the pattern",
|
||||
"name": "mask",
|
||||
"shortdesc": "Mask",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 splatter_$(name)(vec2 uv, int count, int rings, vec2 seed) {\n\tfloat c = 0.0;\n\tvec3 rc = vec3(0.0);\n\tvec3 rc1;\n\tseed = rand2(seed);\n\tfor (int i = 0; i < count; ++i) {\n\t\tfloat a = -1.57079632679+6.28318530718*float(i)*$rings/float(count);\n\t\tfloat rings_distance = ceil(float(i+1)*float(rings)/float(count))/float(rings);\n\t\tfloat spiral_distance = float(i+1)/float(count);\n\t\tvec2 pos = $radius*mix(rings_distance, spiral_distance, $spiral)*vec2(cos(a), sin(a));\n\t\tfloat mask = $mask(fract(pos-vec2(0.5)));\n\t\tif (mask > 0.01) {\n\t\t\tvec2 pv = uv-0.5-pos;\n\t\t\trc1 = rand3(seed);\n\t\t\tseed = rand2(seed);\n\t\t\tfloat angle = (seed.x * 2.0 - 1.0) * $rotate * 0.01745329251 + (a+1.57079632679) * $i_rotate;\n\t\t\tfloat ca = cos(angle);\n\t\t\tfloat sa = sin(angle);\n\t\t\tpv = vec2(ca*pv.x+sa*pv.y, -sa*pv.x+ca*pv.y);\n\t\t\tpv /= mix(1.0, float(i+1)/float(count+1), $i_scale);\n\t\t\tpv /= vec2($scale_x, $scale_y);\n\t\t\tpv *= (seed.y-0.5)*2.0*$scale+1.0;\n\t\t\tpv += vec2(0.5);\n\t\t\tseed = rand2(seed);\n\t\t\tif (pv != clamp(pv, vec2(0.0), vec2(1.0))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$select_inputs\n\t\t\tfloat c1 = $in(pv)*mask*(1.0-$value*seed.x);\n\t\t\tc = max(c, c1);\n\t\t\trc = mix(rc, rc1, step(c, c1));\n\t\t}\n\t}\n\treturn vec4(rc, c);\n}\n",
|
||||
"longdesc": "Spreads several occurences of an input image in a circle or spiral pattern.",
|
||||
"name": "Circle Splatter",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name_uv)_rch.a",
|
||||
"longdesc": "Shows the generated pattern",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows a random color for each instance of the input image",
|
||||
"rgb": "$(name_uv)_rch.rgb",
|
||||
"shortdesc": "Instance map",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 10,
|
||||
"label": "Count",
|
||||
"longdesc": "The number of occurences of the input image",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "count",
|
||||
"shortdesc": "Count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Rings",
|
||||
"longdesc": "The number of rings of the circle pattern",
|
||||
"max": 16,
|
||||
"min": 1,
|
||||
"name": "rings",
|
||||
"shortdesc": "Rings",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Inputs",
|
||||
"longdesc": "The input type of the node:\n- 1: single image\n- 4: atlas of 4 images\n- 16: atlas of 16 images\nAtlases can be created using the Tile2x2 node.",
|
||||
"name": "select_inputs",
|
||||
"shortdesc": "Input",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "1",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"value": "pv = clamp(0.5*(pv+floor(rand2(seed)*2.0)), vec2(0.0), vec2(1.0));"
|
||||
},
|
||||
{
|
||||
"name": "16",
|
||||
"value": "pv = clamp(0.25*(pv+floor(rand2(seed)*4.0)), vec2(0.0), vec2(1.0));"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale of input images on the X axis",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale of input images on the Y axis",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.25,
|
||||
"label": "Radius",
|
||||
"longdesc": "The radius of the outer circle pattern",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "radius",
|
||||
"shortdesc": "Radius",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Spiral",
|
||||
"longdesc": "The type of pattern:\n- 0: circles\n- 1: spiral",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "spiral",
|
||||
"shortdesc": "Spiral",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Inc Rotate",
|
||||
"longdesc": "The rotate increment along the pattern",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "i_rotate",
|
||||
"shortdesc": "IncRotate",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Inc Scale",
|
||||
"longdesc": "The scale increment of the pattern",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "i_scale",
|
||||
"shortdesc": "IncScale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rnd Rotate",
|
||||
"longdesc": "The random rotation applied to each image instance",
|
||||
"max": 180,
|
||||
"min": 0,
|
||||
"name": "rotate",
|
||||
"shortdesc": "RndRotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rnd Scale",
|
||||
"longdesc": "The random scale applied to each image instance",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"shortdesc": "RndScale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Rnd Value",
|
||||
"longdesc": "The random greyscale value applied to each image instance",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "value",
|
||||
"shortdesc": "RndValue",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
{
|
||||
"name": "circle_splatter_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 20,
|
||||
"i_rotate": 0,
|
||||
"i_scale": 0,
|
||||
"opacity": 0,
|
||||
"radius": 0.4,
|
||||
"rings": 2,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"scale_x": 1,
|
||||
"scale_y": 1,
|
||||
"select_inputs": 0,
|
||||
"spiral": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0, 0.0, 0.0, 1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image or atlas of 4 or 16 input images",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The mask applied to the pattern",
|
||||
"name": "mask",
|
||||
"shortdesc": "Mask",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 splatter_$(name)(vec2 uv, int count, int rings, vec2 seed) {\n\tvec4 c = vec4(0.0);\n\tvec3 rc = vec3(0.0);\n\tvec3 rc1;\n\tseed = rand2(seed);\n\tfor (int i = 0; i < count; ++i) {\n\t\tfloat a = -1.57079632679+6.28318530718*float(i)*$rings/float(count);\n\t\tfloat rings_distance = ceil(float(i+1)*float(rings)/float(count))/float(rings);\n\t\tfloat spiral_distance = float(i+1)/float(count);\n\t\tvec2 pos = $radius*mix(rings_distance, spiral_distance, $spiral)*vec2(cos(a), sin(a));\n\t\tfloat mask = $mask(fract(pos-vec2(0.5)));\n\t\tif (mask > 0.01) {\n\t\t\tvec2 pv = uv-0.5-pos;\n\t\t\trc1 = rand3(seed);\n\t\t\tseed = rand2(seed);\n\t\t\tfloat angle = (seed.x * 2.0 - 1.0) * $rotate * 0.01745329251 + (a+1.57079632679) * $i_rotate;\n\t\t\tfloat ca = cos(angle);\n\t\t\tfloat sa = sin(angle);\n\t\t\tpv = vec2(ca*pv.x+sa*pv.y, -sa*pv.x+ca*pv.y);\n\t\t\tpv /= mix(1.0, float(i+1)/float(count+1), $i_scale);\n\t\t\tpv /= vec2($scale_x, $scale_y);\n\t\t\tpv *= (seed.y-0.5)*2.0*$scale+1.0;\n\t\t\tpv += vec2(0.5);\n\t\t\tseed = rand2(seed);\n\t\t\tif (pv != clamp(pv, vec2(0.0), vec2(1.0))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$select_inputs\n\t\t\tvec4 n = $in(pv);\n\t\t\tfloat na = n.a*mask*(1.0-$opacity*seed.x);\n\t\t\tc = mix(c, n, na);\n\t\t}\n\t}\n\treturn c;\n}\n",
|
||||
"longdesc": "Spreads several occurences of an input image in a circle or spiral pattern.",
|
||||
"name": "Color Circle Splatter",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the generated pattern",
|
||||
"rgba": "splatter_$(name)($uv, int($count), int($rings), vec2(float($seed)))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 10,
|
||||
"label": "Count",
|
||||
"longdesc": "The number of occurences of the input image",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "count",
|
||||
"shortdesc": "Count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Rings",
|
||||
"longdesc": "The number of rings of the circle pattern",
|
||||
"max": 16,
|
||||
"min": 1,
|
||||
"name": "rings",
|
||||
"shortdesc": "Rings",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Inputs",
|
||||
"longdesc": "The input type of the node:\n- 1: single image\n- 4: atlas of 4 images\n- 16: atlas of 16 images\nAtlases can be created using the Tile2x2 node.",
|
||||
"name": "select_inputs",
|
||||
"shortdesc": "Input",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "1",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"value": "pv = clamp(0.5*(pv+floor(rand2(seed)*2.0)), vec2(0.0), vec2(1.0));"
|
||||
},
|
||||
{
|
||||
"name": "16",
|
||||
"value": "pv = clamp(0.25*(pv+floor(rand2(seed)*4.0)), vec2(0.0), vec2(1.0));"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale of input images on the X axis",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale of input images on the Y axis",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.25,
|
||||
"label": "Radius",
|
||||
"longdesc": "The radius of the outer circle pattern",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "radius",
|
||||
"shortdesc": "Radius",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Spiral",
|
||||
"longdesc": "The type of pattern:\n- 0: circles\n- 1: spiral",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "spiral",
|
||||
"shortdesc": "Spiral",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Inc Rotate",
|
||||
"longdesc": "The rotate increment along the pattern",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "i_rotate",
|
||||
"shortdesc": "IncRotate",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Inc Scale",
|
||||
"longdesc": "The scale increment of the pattern",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "i_scale",
|
||||
"shortdesc": "IncScale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rnd Rotate",
|
||||
"longdesc": "The random rotation applied to each image instance",
|
||||
"max": 180,
|
||||
"min": 0,
|
||||
"name": "rotate",
|
||||
"shortdesc": "RndRotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rnd Scale",
|
||||
"longdesc": "The random scale applied to each image instance",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"shortdesc": "RndScale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Rnd Opacity",
|
||||
"longdesc": "The random opacity applied to each image instance",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "opacity",
|
||||
"shortdesc": "RndOpacity",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
{
|
||||
"name": "circular_gradient",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
},
|
||||
"repeat": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Circular Gradient",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Number of repetitions of the gradient",
|
||||
"rgba": "$gradient(fract($repeat*0.15915494309*atan($uv.y-0.5, $uv.x-0.5)))",
|
||||
"shortdesc": "Repeat",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat",
|
||||
"longdesc": "Number of repetitions of the gradient",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
},
|
||||
"label": "Gradient",
|
||||
"longdesc": "Gradient to be spread on the image",
|
||||
"name": "gradient",
|
||||
"shortdesc": "Gradient",
|
||||
"type": "gradient"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "color_noise",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 9
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec3 color_dots(vec2 uv, float size, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\treturn rand3(seed2+point_pos);\n}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates a grid made of random color squares",
|
||||
"name": "Color Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the noise pattern",
|
||||
"rgb": "color_dots($(uv), 1.0/$(size), $(seed))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 8,
|
||||
"first": 2,
|
||||
"label": "Grid Size:",
|
||||
"last": 12,
|
||||
"longdesc": "The grid size",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Color Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
85
game/addons/mat_maker_gd/material_maker_nodes/colorize.mmg
Normal file
85
game/addons/mat_maker_gd/material_maker_nodes/colorize.mmg
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "colorize",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "$uv.x",
|
||||
"label": "",
|
||||
"longdesc": "The input greyscale image",
|
||||
"name": "input",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Remaps a greyscale image to a custom gradient",
|
||||
"name": "Colorize",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "The remapped RGBA image",
|
||||
"rgba": "$gradient($input($uv))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
},
|
||||
"label": "",
|
||||
"longdesc": "The gradient to which the input is remapped",
|
||||
"name": "gradient",
|
||||
"shortdesc": "Gradient",
|
||||
"type": "gradient"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Colorize"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
64
game/addons/mat_maker_gd/material_maker_nodes/combine.mmg
Normal file
64
game/addons/mat_maker_gd/material_maker_nodes/combine.mmg
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "combine",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "R",
|
||||
"longdesc": "The greyscale input for the red channel",
|
||||
"name": "r",
|
||||
"shortdesc": "Red",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "G",
|
||||
"longdesc": "The greyscale input for the green channel",
|
||||
"name": "g",
|
||||
"shortdesc": "Green",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "B",
|
||||
"longdesc": "The greyscale input for the blue channel",
|
||||
"name": "b",
|
||||
"shortdesc": "Blue",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "A",
|
||||
"longdesc": "The greyscale input for the alpha channel",
|
||||
"name": "a",
|
||||
"shortdesc": "Alpha",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Combines 4 greyscale inputs into an RGBA image",
|
||||
"name": "Combine",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the combined RGBA image",
|
||||
"rgba": "vec4($r($uv), $g($uv), $b($uv), $a($uv))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Combine"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
40
game/addons/mat_maker_gd/material_maker_nodes/compare.mmg
Normal file
40
game/addons/mat_maker_gd/material_maker_nodes/compare.mmg
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "compare",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in1",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in2",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Compare",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "dot(abs($in1($uv)-$in2($uv)), vec4(1.0))",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
140
game/addons/mat_maker_gd/material_maker_nodes/curve.mmg
Normal file
140
game/addons/mat_maker_gd/material_maker_nodes/curve.mmg
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"name": "curve",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"ax": -0.4,
|
||||
"ay": -0.3,
|
||||
"bx": 0,
|
||||
"by": 0.5,
|
||||
"cx": 0.4,
|
||||
"cy": -0.3,
|
||||
"repeat": 1,
|
||||
"width": 0.05
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_bezier = sdBezier($uv, vec2($ax+0.5, $ay+0.5), vec2($bx+0.5, $by+0.5), vec2($cx+0.5, $cy+0.5));\nvec2 $(name_uv)_uv = vec2($(name_uv)_bezier.x, $(name_uv)_bezier.y/$width+0.5);\nvec2 $(name_uv)_uvtest = step(vec2(0.5), abs($(name_uv)_uv-vec2(0.5)));\n$(name_uv)_uv = mix(vec2(fract($repeat*$(name_uv)_uv.x), $(name_uv)_uv.y), vec2(0.0), max($(name_uv)_uvtest.x, $(name_uv)_uvtest.y));\n",
|
||||
"global": "float cross2( in vec2 a, in vec2 b ) { return a.x*b.y - a.y*b.x; }\n\n// signed distance to a quadratic bezier\nvec2 sdBezier( in vec2 pos, in vec2 A, in vec2 B, in vec2 C ) { \n vec2 a = B - A;\n vec2 b = A - 2.0*B + C;\n vec2 c = a * 2.0;\n vec2 d = A - pos;\n\n float kk = 1.0/dot(b,b);\n float kx = kk * dot(a,b);\n float ky = kk * (2.0*dot(a,a)+dot(d,b))/3.0;\n float kz = kk * dot(d,a); \n\n float res = 0.0;\n float sgn = 0.0;\n\n float p = ky - kx*kx;\n float p3 = p*p*p;\n float q = kx*(2.0*kx*kx - 3.0*ky) + kz;\n float h = q*q + 4.0*p3;\n\tfloat rvx;\n\n if( h>=0.0 ) { // 1 root\n h = sqrt(h);\n vec2 x = (vec2(h,-h)-q)/2.0;\n vec2 uv = sign(x)*pow(abs(x), vec2(1.0/3.0));\n\t\trvx = uv.x+uv.y-kx;\n float t = clamp(rvx, 0.0, 1.0);\n vec2 q2 = d+(c+b*t)*t;\n res = dot(q2, q2);\n \tsgn = cross2(c+2.0*b*t, q2);\n } else { // 3 roots\n float z = sqrt(-p);\n float v = acos(q/(p*z*2.0))/3.0;\n float m = cos(v);\n float n = sin(v)*1.732050808;\n vec3 t = clamp(vec3(m+m,-n-m,n-m)*z-kx, 0.0, 1.0);\n vec2 qx=d+(c+b*t.x)*t.x; float dx=dot(qx, qx), sx = cross2(c+2.0*b*t.x,qx);\n vec2 qy=d+(c+b*t.y)*t.y; float dy=dot(qy, qy), sy = cross2(c+2.0*b*t.y,qy);\n if( dx<dy ) { res=dx; sgn=sx; rvx = t.x; } else { res=dy; sgn=sy; rvx = t.y; }\n }\n \n return vec2(rvx, sqrt(res)*sign(sgn));\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(vec3(step(abs($uv.y-0.5), 0.4999)), 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "Input pattern to be drawn along the curve",
|
||||
"name": "in",
|
||||
"shortdesc": "Pattern",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Curve",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "An image showing the specified curve",
|
||||
"rgba": "$in($(name_uv)_uv)",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "P1.x",
|
||||
"default": -0.3,
|
||||
"label": "AX",
|
||||
"longdesc": "Position on X axis of the first control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "ax",
|
||||
"shortdesc": "A.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P1.y",
|
||||
"default": -0.1,
|
||||
"label": "AY",
|
||||
"longdesc": "Position on Y axis of the first control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "ay",
|
||||
"shortdesc": "A.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P3.x",
|
||||
"default": -0,
|
||||
"label": "BX",
|
||||
"longdesc": "Position on X axis of the second control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "bx",
|
||||
"shortdesc": "B.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P3.y",
|
||||
"default": 0.2,
|
||||
"label": "BY",
|
||||
"longdesc": "Position on Y axis of the second control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "by",
|
||||
"shortdesc": "B.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P2.x",
|
||||
"default": 0.3,
|
||||
"label": "CX",
|
||||
"longdesc": "Position on X axis of the third control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "cx",
|
||||
"shortdesc": "C.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P2.y",
|
||||
"default": -0.1,
|
||||
"label": "CY",
|
||||
"longdesc": "Position on Y axis of the third control point",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "cy",
|
||||
"shortdesc": "C.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Width",
|
||||
"longdesc": "Width of the curve pattern",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "width",
|
||||
"shortdesc": "Width",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat",
|
||||
"longdesc": "Number of repetitions of the input pattern",
|
||||
"max": 16,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
121
game/addons/mat_maker_gd/material_maker_nodes/custom_uv.mmg
Normal file
121
game/addons/mat_maker_gd/material_maker_nodes/custom_uv.mmg
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"name": "custom_uv",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"inputs": 0,
|
||||
"rotate": 0,
|
||||
"scale": 0,
|
||||
"sx": 1,
|
||||
"sy": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec3 $(name_uv)_map = $map($uv);\nfloat $(name_uv)_rnd = float($seed)+$(name_uv)_map.z;\n",
|
||||
"global": "vec2 get_from_tileset(float count, float seed, vec2 uv) {\n\treturn clamp((uv+floor(rand2(vec2(seed))*count))/count, vec2(0.0), vec2(1.0));\n}\n\nvec2 custom_uv_transform(vec2 uv, vec2 cst_scale, float rnd_rotate, float rnd_scale, vec2 seed) {\n\tseed = rand2(seed);\n\tuv -= vec2(0.5);\n\tfloat angle = (seed.x * 2.0 - 1.0) * rnd_rotate;\n\tfloat ca = cos(angle);\n\tfloat sa = sin(angle);\n\tuv = vec2(ca*uv.x+sa*uv.y, -sa*uv.x+ca*uv.y);\n\tuv *= (seed.y-0.5)*2.0*rnd_scale+1.0;\n\tuv /= cst_scale;\n\tuv += vec2(0.5);\n\treturn uv;\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "Input",
|
||||
"longdesc": "The image or atlas of images to be remapped.",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"label": "UV",
|
||||
"longdesc": "The custom UV map to be used for remapping.",
|
||||
"name": "map",
|
||||
"shortdesc": "Map",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Remaps an Input image using a custom UV map.",
|
||||
"name": "Custom UV",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the remapped image",
|
||||
"rgba": "$in(get_from_tileset($inputs, $(name_uv)_rnd, custom_uv_transform($(name_uv)_map.xy, vec2($sx, $sy), $rotate*0.01745329251, $scale, vec2($(name_uv)_map.z, float($seed)))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Inputs",
|
||||
"longdesc": "The input type of the node:\n- 1: single image\n- 4: atlas of 4 images\n- 16: atlas of 16 images\nAtlases can be created using the Tile2x2 node.",
|
||||
"name": "inputs",
|
||||
"shortdesc": "Inputs",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "1",
|
||||
"value": "1.0"
|
||||
},
|
||||
{
|
||||
"name": "4",
|
||||
"value": "2.0"
|
||||
},
|
||||
{
|
||||
"name": "16",
|
||||
"value": "4.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale of the input image along the X axis.",
|
||||
"max": 5,
|
||||
"min": 0,
|
||||
"name": "sx",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale of the input image along the Y axis.",
|
||||
"max": 5,
|
||||
"min": 0,
|
||||
"name": "sy",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Rnd Rotate",
|
||||
"longdesc": "The random rotation applied to each remapped instance.",
|
||||
"max": 180,
|
||||
"min": 0,
|
||||
"name": "rotate",
|
||||
"shortdesc": "RndRotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Rnd Scale",
|
||||
"longdesc": "The random scale applied to each remapped instance.",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"shortdesc": "RndScale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Custom UV remapper"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
58
game/addons/mat_maker_gd/material_maker_nodes/decompose.mmg
Normal file
58
game/addons/mat_maker_gd/material_maker_nodes/decompose.mmg
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "decompose",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The RGBA input image",
|
||||
"name": "i",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Decomposes an RGBA input into 4 greyscale images",
|
||||
"name": "Decompose",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$i($uv).r",
|
||||
"longdesc": "Shows the Red channel of the input",
|
||||
"shortdesc": "Red",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$i($uv).g",
|
||||
"longdesc": "Shows the Green channel of the input",
|
||||
"shortdesc": "Green",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$i($uv).b",
|
||||
"longdesc": "Shows the Blue channel of the input",
|
||||
"shortdesc": "Blue",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"f": "$i($uv).a",
|
||||
"longdesc": "Shows the Alpha channel of the input",
|
||||
"shortdesc": "Alpha",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Decompose"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "default_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "$default",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Default color",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$in($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"label": "",
|
||||
"name": "default",
|
||||
"type": "color"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
322
game/addons/mat_maker_gd/material_maker_nodes/dilate.mmg
Normal file
322
game/addons/mat_maker_gd/material_maker_nodes/dilate.mmg
Normal file
@ -0,0 +1,322 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "dilate_pass_1",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "dilate_pass_1",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer_2",
|
||||
"from_port": 0,
|
||||
"to": "dilate_pass_4",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "dilate_pass_3",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2_3",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer_2_3",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer_2_2",
|
||||
"from_port": 0,
|
||||
"to": "dilate_pass_3",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "dilate_pass_4",
|
||||
"from_port": 0,
|
||||
"to": "dilate_pass_3",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "default_color",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 1,
|
||||
"to": "default_color",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Dilate",
|
||||
"longdesc": "Dilates the white areas of a mask, using the colors of an optional input",
|
||||
"name": "dilate",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -473.691315,
|
||||
"y": -200.988342
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "buffer_2",
|
||||
"node_position": {
|
||||
"x": -255.691315,
|
||||
"y": -123.988342
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -140.306458,
|
||||
"y": -377.953613
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 0.1,
|
||||
"param2": 0,
|
||||
"param3": 0
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "buffer_2",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "buffer_2_2",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "dilate_pass_1",
|
||||
"widget": "s"
|
||||
},
|
||||
{
|
||||
"node": "dilate_pass_4",
|
||||
"widget": "s"
|
||||
},
|
||||
{
|
||||
"node": "buffer_2_3",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input images",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "dilate_pass_1",
|
||||
"widget": "d"
|
||||
},
|
||||
{
|
||||
"node": "dilate_pass_4",
|
||||
"widget": "d"
|
||||
}
|
||||
],
|
||||
"longdesc": "The length of the dilate effect",
|
||||
"name": "param1",
|
||||
"shortdesc": "Length",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "dilate_pass_3",
|
||||
"widget": "amount"
|
||||
}
|
||||
],
|
||||
"longdesc": "0 to generate a gradient to black while dilating, 1 to fill with input color",
|
||||
"name": "param2",
|
||||
"shortdesc": "Fill",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "dilate_pass_4",
|
||||
"widget": "distance"
|
||||
}
|
||||
],
|
||||
"name": "param3",
|
||||
"shortdesc": "Distance function",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -872.306458,
|
||||
"y": -171.4814
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input mask whose white areas will be dilated",
|
||||
"name": "mask",
|
||||
"shortdesc": "Mask",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The optional source for colors",
|
||||
"name": "source",
|
||||
"shortdesc": "Source",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 254.21106,
|
||||
"y": -64.4814
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Shows the dilated image",
|
||||
"name": "out",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"seed_value": -14401,
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "buffer_2_2",
|
||||
"node_position": {
|
||||
"x": -255.323547,
|
||||
"y": -44.695679
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "dilate_pass_1",
|
||||
"node_position": {
|
||||
"x": -252.698792,
|
||||
"y": -201.368988
|
||||
},
|
||||
"parameters": {
|
||||
"d": 0.1,
|
||||
"s": 9
|
||||
},
|
||||
"seed_value": 71939,
|
||||
"type": "dilate_pass_1"
|
||||
},
|
||||
{
|
||||
"name": "dilate_pass_3",
|
||||
"node_position": {
|
||||
"x": -31.698792,
|
||||
"y": -72.368988
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 0
|
||||
},
|
||||
"type": "dilate_pass_3"
|
||||
},
|
||||
{
|
||||
"name": "dilate_pass_4",
|
||||
"node_position": {
|
||||
"x": -31.689392,
|
||||
"y": -186.577301
|
||||
},
|
||||
"parameters": {
|
||||
"d": 0.1,
|
||||
"distance": 0,
|
||||
"s": 9
|
||||
},
|
||||
"type": "dilate_pass_2"
|
||||
},
|
||||
{
|
||||
"name": "buffer_2_3",
|
||||
"node_position": {
|
||||
"x": -46.966125,
|
||||
"y": -0.711548
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "default_color",
|
||||
"node_position": {
|
||||
"x": -469.868713,
|
||||
"y": -98.02066
|
||||
},
|
||||
"parameters": {
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"type": "default_color"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 0.1,
|
||||
"param2": 0,
|
||||
"param3": 0
|
||||
},
|
||||
"shortdesc": "Dilate",
|
||||
"type": "graph"
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "distance_pass_1",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"d": 0.1,
|
||||
"s": 9
|
||||
},
|
||||
"seed_value": 8258,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec3 $(name)_distance_h(vec2 uv) {\n\tvec2 e = vec2(1.0/$s, 0.0);\n\tint steps = int($s*$d);\n\tfloat rv = 0.0;\n\tvec2 source_uv;\n\tfor (int i = 0; i < steps; ++i) {\n\t\tsource_uv = uv+float(i)*e;\n\t\tif ($in(source_uv) > 0.5) {\n\t\t\trv = 1.0-float(i)*e.x/$d;\n\t\t\tbreak;\n\t\t}\n\t\tsource_uv = uv-float(i)*e;\n\t\tif ($in(source_uv) > 0.5) {\n\t\t\trv = 1.0-float(i)*e.x/$d;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn vec3(rv, source_uv);\n}\n",
|
||||
"name": "Distance pass 1",
|
||||
"outputs": [
|
||||
{
|
||||
"rgb": "$(name)_distance_h($uv)",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 6,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "s",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "dilate_pass_2",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"d": 0.25,
|
||||
"distance": 0,
|
||||
"s": 9
|
||||
},
|
||||
"seed_value": 44978,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float dilate_distance_euclidian(float x, float y, float d) {\n\treturn 1.0-sqrt((1.0-x)*(1.0-x)+y*y/d/d);\n}\n\nfloat dilate_distance_manhattan(float x, float y, float d) {\n\treturn 1.0-(abs(1.0-x)+abs(y)/d);\n}\n\nfloat dilate_distance_chebyshev(float x, float y, float d) {\n\treturn 1.0-max(abs(1.0-x), abs(y)/d);\n}\n\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "vec3 $(name)_distance_v(vec2 uv) {\n\tvec2 e = vec2(0.0, 1.0/$s);\n\tint steps = int($s*$d);\n\tvec3 p = $in(uv);\n\tfor (int i = 0; i < steps; ++i) {\n\t\tvec2 dx = float(i)*e;\n\t\tvec3 p2 = $in(uv+dx);\n\t\tif (p2.x > p.x) {\n\t\t\tp2.x = dilate_distance_$distance(p2.x, dx.y, $d);\n\t\t\tp = mix(p, p2, step(p.x, p2.x));\n\t\t}\n\t\tp2 = $in(uv-dx);\n\t\tif (p2.x > p.x) {\n\t\t\tp2.x = dilate_distance_$distance(p2.x, dx.y, $d);\n\t\t\tp = mix(p, p2, step(p.x, p2.x));\n\t\t}\n\t}\n\treturn p;\n}\n",
|
||||
"name": "Distance pass 2",
|
||||
"outputs": [
|
||||
{
|
||||
"rgb": "$(name)_distance_v($uv)",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 6,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "s",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 2,
|
||||
"label": "",
|
||||
"name": "distance",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Euclidian",
|
||||
"value": "euclidian"
|
||||
},
|
||||
{
|
||||
"name": "Manhattan",
|
||||
"value": "manhattan"
|
||||
},
|
||||
{
|
||||
"name": "Chebyshev",
|
||||
"value": "chebyshev"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "distance_pass_3",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"name": "distance",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"label": "",
|
||||
"name": "source",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Distance pass 3",
|
||||
"outputs": [
|
||||
{
|
||||
"rgb": "$source($distance($uv).yz)*mix($distance($uv).x, 1.0, $amount)",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "amount",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,234 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "edge_detect_3_3_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "edge_detect_3_3_2",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 1,
|
||||
"to": "edge_detect_3_3_2",
|
||||
"to_port": 1
|
||||
}
|
||||
],
|
||||
"label": "Directional Blur",
|
||||
"longdesc": "Applies a directional gaussian blur to its input",
|
||||
"name": "directional_blur",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -381.25,
|
||||
"y": -270.75
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -436.666626,
|
||||
"y": -413.666656
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 50,
|
||||
"param2": 45
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Grid size:",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "edge_detect_3_3_2",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Sigma",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "edge_detect_3_3_2",
|
||||
"widget": "sigma"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the blur filter",
|
||||
"name": "param1",
|
||||
"shortdesc": "Sigma",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Angle",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "edge_detect_3_3_2",
|
||||
"widget": "angle"
|
||||
}
|
||||
],
|
||||
"longdesc": "The angle of the directional blur effect",
|
||||
"name": "param2",
|
||||
"shortdesc": "Angle",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -779.666626,
|
||||
"y": -247.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "A map that controls the strength of the blur filter",
|
||||
"name": "amount",
|
||||
"shortdesc": "Strength map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"seed_value": 91624,
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": -45.452393,
|
||||
"y": -195.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Shows the generated blurred image",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "edge_detect_3_3_2",
|
||||
"node_position": {
|
||||
"x": -376.725464,
|
||||
"y": -184.178955
|
||||
},
|
||||
"parameters": {
|
||||
"angle": 45,
|
||||
"sigma": 50,
|
||||
"size": 9
|
||||
},
|
||||
"seed_value": -47470,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "Label",
|
||||
"name": "amount",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_fct(vec2 uv) {\n\tvec2 e = vec2(cos($angle*0.01745329251), -sin($angle*0.01745329251))/$size;\n\tvec4 rv = vec4(0.0);\n\tfloat sum = 0.0;\n\tfloat sigma = $sigma*$amount(uv);\n\tfor (float i = -50.0; i <= 50.0; i += 1.0) {\n\t\tfloat coef = exp(-0.5*(pow(i/sigma, 2.0)))/(6.28318530718*sigma*sigma);\n\t\trv += $in(uv+i*e)*coef;\n\t\tsum += coef;\n\t}\n\treturn rv/sum;\n}",
|
||||
"name": "Directional Blur",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_fct($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Sigma",
|
||||
"max": 50,
|
||||
"min": 0,
|
||||
"name": "sigma",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Angle",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "angle",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 50,
|
||||
"param2": 45
|
||||
},
|
||||
"shortdesc": "Directional blur",
|
||||
"type": "graph"
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "edge_detect",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 9,
|
||||
"threshold": 0.4,
|
||||
"width": 2
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\tvec3 e_base = vec3(1.0/$size, -1.0/$size, 0);\n\tvec3 ref = $in(uv);\n\tvec3 e = vec3(0);\n\tfloat rv = 0.0;\n\tfor (int i = 0; i < int($width); ++i) {\n\t\te += e_base;\n\t\trv += length($in(uv+e.xy)-ref);\n\t\trv += length($in(uv-e.xy)-ref);\n\t\trv += length($in(uv+e.xx)-ref);\n\t\trv += length($in(uv-e.xx)-ref);\n\t\trv += length($in(uv+e.xz)-ref);\n\t\trv += length($in(uv-e.xz)-ref);\n\t\trv += length($in(uv+e.zx)-ref);\n\t\trv += length($in(uv-e.zx)-ref);\n\t\trv *= 2.0;\n\t}\n\treturn rv*pow(2.0, -$width);\n}",
|
||||
"longdesc": "An edge detect filter that detects edges along all directions and draws them in white on a black background",
|
||||
"name": "Edge detect",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "clamp(100.0*($(name)_fct($uv)-$threshold), 0.0, 1.0)",
|
||||
"longdesc": "Shows the generated outlines",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Width",
|
||||
"max": 5,
|
||||
"min": 1,
|
||||
"name": "width",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Threshold",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "threshold",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Edge detect"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "edge_detect_1",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\tvec3 e = vec3(1.0/$size, -1.0/$size, 0);\n\tvec3 rv = 8.0*$in(uv);\n\trv -= $in(uv+e.xy);\n\trv -= $in(uv-e.xy);\n\trv -= $in(uv+e.xx);\n\trv -= $in(uv-e.xx);\n\trv -= $in(uv+e.xz);\n\trv -= $in(uv-e.xz);\n\trv -= $in(uv+e.zx);\n\trv -= $in(uv-e.zx);\n\trv = abs(rv);\n\treturn max(rv.x, max(rv.y ,rv.z))*$size;\n}",
|
||||
"longdesc": "An edge detect filter that detects edges along all directions and draws them in white on a black background",
|
||||
"name": "Edge detect 1",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "clamp($(name)_fct($uv), 0.0, 1.0)",
|
||||
"longdesc": "Shows the generated outlines",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Edge detect"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "edge_detect_2",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\tvec2 e = vec2(1.0/$size, 0.0);\n\tvec3 rv = 4.0*$in(uv);\n\trv -= $in(uv+e.xy);\n\trv -= $in(uv-e.xy);\n\trv -= $in(uv+e.yx);\n\trv -= $in(uv-e.yx);\n\trv = abs(rv);\n\treturn max(rv.x, max(rv.y ,rv.z))*$size;\n}",
|
||||
"longdesc": "An edge detect filter that detects edges horizontally and vertically and draws them in white on a black background",
|
||||
"name": "Edge detect 2",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "clamp($(name)_fct($uv), 0.0, 1.0)",
|
||||
"longdesc": "Shows the generated outlines",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Edge detect"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "edge_detect_3",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 6
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\tvec2 e = vec2(1.0/$size, -1.0/$size);\n\tvec3 rv = 4.0*$in(uv);\n\trv -= $in(uv+e.xy);\n\trv -= $in(uv-e.xy);\n\trv -= $in(uv+e.xx);\n\trv -= $in(uv-e.xx);\n\trv = abs(rv);\n\treturn max(rv.x, max(rv.y ,rv.z))*$size;\n}",
|
||||
"longdesc": "An edge detect filter that detects edges along diagonals and draws them in white on a black background",
|
||||
"name": "Edge detect 3",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "clamp($(name)_fct($uv), 0.0, 1.0)",
|
||||
"longdesc": "Shows the generated outlines",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Edge detect"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
242
game/addons/mat_maker_gd/material_maker_nodes/emboss.mmg
Normal file
242
game/addons/mat_maker_gd/material_maker_nodes/emboss.mmg
Normal file
@ -0,0 +1,242 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "598",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "598",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Emboss",
|
||||
"longdesc": "Creates highlights and shadows from an input heightmap",
|
||||
"name": "emboss",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -65.493774,
|
||||
"y": -609.5
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"seed_value": 10109,
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "598",
|
||||
"node_position": {
|
||||
"x": -77.579605,
|
||||
"y": -529.738281
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 5,
|
||||
"angle": 0,
|
||||
"size": 9,
|
||||
"width": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"includes": [
|
||||
""
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\tfloat pixels = max(1.0, $width);\n\tfloat e = 1.0/$size;\n\tfloat rv = 0.0;\n\tfor (float dx = -pixels; dx <= pixels; dx += 1.0) {\n\t\tfor (float dy = -pixels; dy <= pixels; dy += 1.0) {\n\t\t\tif (abs(dx) > 0.5 || abs(dy) > 0.5) {\n\t\t\t\trv += $in(uv+e*vec2(dx, dy))*cos(atan(dy, dx)-$angle*3.14159265359/180.0)/length(vec2(dx, dy));\n\t\t\t}\n\t\t}\n\t}\n\treturn $amount*rv/pixels+0.5;\n}",
|
||||
"name": "Emboss",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_fct($uv)",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 6,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Angle",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "angle",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Amount",
|
||||
"max": 10,
|
||||
"min": 0,
|
||||
"name": "amount",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Width",
|
||||
"max": 5,
|
||||
"min": 1,
|
||||
"name": "width",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -461.57959,
|
||||
"y": -574.119141
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input height map",
|
||||
"name": "port0",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 187.506226,
|
||||
"y": -557.119141
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The generated image",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -111.036682,
|
||||
"y": -777.5
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 0,
|
||||
"param2": 5,
|
||||
"param3": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Size",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "598",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Angle",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "598",
|
||||
"widget": "angle"
|
||||
}
|
||||
],
|
||||
"longdesc": "The angle of the simulated light",
|
||||
"name": "param1",
|
||||
"shortdesc": "Angle",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Amount",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "598",
|
||||
"widget": "amount"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the emboss effect",
|
||||
"name": "param2",
|
||||
"shortdesc": "Strength",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Width",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "598",
|
||||
"widget": "width"
|
||||
}
|
||||
],
|
||||
"longdesc": "The width (in pixels) of the area sampled for each pixel",
|
||||
"name": "param3",
|
||||
"shortdesc": "Width",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 0,
|
||||
"param2": 5,
|
||||
"param3": 1
|
||||
},
|
||||
"shortdesc": "Emboss",
|
||||
"type": "graph"
|
||||
}
|
156
game/addons/mat_maker_gd/material_maker_nodes/fast_blur.mmg
Normal file
156
game/addons/mat_maker_gd/material_maker_nodes/fast_blur.mmg
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "buffer_2",
|
||||
"from_port": 0,
|
||||
"to": "fast_blur_shader",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "fast_blur_shader",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Fast Blur",
|
||||
"longdesc": "",
|
||||
"name": "fast_blur",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "fast_blur_shader",
|
||||
"node_position": {
|
||||
"x": -168,
|
||||
"y": 120
|
||||
},
|
||||
"parameters": {
|
||||
"quality": 1,
|
||||
"sigma": 100
|
||||
},
|
||||
"type": "fast_blur_shader"
|
||||
},
|
||||
{
|
||||
"name": "buffer_2",
|
||||
"node_position": {
|
||||
"x": -187,
|
||||
"y": 61.5
|
||||
},
|
||||
"parameters": {
|
||||
"size": 11
|
||||
},
|
||||
"type": "buffer",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -602,
|
||||
"y": 91.75
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input image",
|
||||
"name": "input",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 88,
|
||||
"y": 61.75
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The generated blurred image",
|
||||
"name": "output",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -254.5,
|
||||
"y": -122.5
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 100,
|
||||
"param2": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Resolution",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer_2",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution used to sample the input image",
|
||||
"name": "param0",
|
||||
"shortdesc": "Resolution",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Sigma",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur_shader",
|
||||
"widget": "sigma"
|
||||
}
|
||||
],
|
||||
"longdesc": "The standard deviation of the gaussian distribution",
|
||||
"name": "param1",
|
||||
"shortdesc": "Sigma",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Quality",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur_shader",
|
||||
"widget": "quality"
|
||||
}
|
||||
],
|
||||
"longdesc": "The quality of the effect (increasing quality increases compute time)",
|
||||
"name": "param2",
|
||||
"shortdesc": "Quality",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 100,
|
||||
"param2": 1
|
||||
},
|
||||
"shortdesc": "",
|
||||
"type": "graph"
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "fast_blur_shader",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"quality": 1,
|
||||
"sigma": 100
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_blur(vec2 uv, vec2 scale, float sigma, int quality) {\n vec4 O = vec4(0.0);\n\tfloat samples = sigma * 4.0; \n\tint LOD = max(0, int(log2(float(samples)))-quality-2);\n\tint sLOD = 1 << LOD;\n int s = max(1, int(samples/float(sLOD)));\n\tfloat sum = 0.0;\n for (int i = 0; i < s*s; i++) {\n vec2 d = vec2(float(i%s), float(i/s))*float(sLOD) - 0.5*float(samples);\n\t\tvec2 dd = d / sigma;\n\t\tfloat g = exp(-.5*dot(dd,dd))/(6.28*sigma*sigma);\n O += g * textureLod($in.texture, uv + scale * d, float(LOD));\n\t\tsum += g;\n }\n \n return O / sum;\n}\n",
|
||||
"name": "Fast Blur",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_blur($uv, vec2(1.0)/$in.size, max(1.0, floor($sigma*$in.size/2048.0)), int($quality))",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "sigma",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 3,
|
||||
"min": 0,
|
||||
"name": "quality",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
139
game/addons/mat_maker_gd/material_maker_nodes/fbm.mmg
Normal file
139
game/addons/mat_maker_gd/material_maker_nodes/fbm.mmg
Normal file
@ -0,0 +1,139 @@
|
||||
{
|
||||
"name": "fbm",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"folds": 0,
|
||||
"iterations": 5,
|
||||
"noise": 0,
|
||||
"persistence": 0.5,
|
||||
"scale_x": 2,
|
||||
"scale_y": 2
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float fbm_value(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat p00 = rand(mod(o, size));\n\tfloat p01 = rand(mod(o + vec2(0.0, 1.0), size));\n\tfloat p10 = rand(mod(o + vec2(1.0, 0.0), size));\n\tfloat p11 = rand(mod(o + vec2(1.0, 1.0), size));\n\tvec2 t = f * f * (3.0 - 2.0 * f);\n\treturn mix(mix(p00, p10, t.x), mix(p01, p11, t.x), t.y);\n}\n\nfloat fbm_perlin(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat a00 = rand(mod(o, size)) * 6.28318530718;\n\tfloat a01 = rand(mod(o + vec2(0.0, 1.0), size)) * 6.28318530718;\n\tfloat a10 = rand(mod(o + vec2(1.0, 0.0), size)) * 6.28318530718;\n\tfloat a11 = rand(mod(o + vec2(1.0, 1.0), size)) * 6.28318530718;\n\tvec2 v00 = vec2(cos(a00), sin(a00));\n\tvec2 v01 = vec2(cos(a01), sin(a01));\n\tvec2 v10 = vec2(cos(a10), sin(a10));\n\tvec2 v11 = vec2(cos(a11), sin(a11));\n\tfloat p00 = dot(v00, f);\n\tfloat p01 = dot(v01, f - vec2(0.0, 1.0));\n\tfloat p10 = dot(v10, f - vec2(1.0, 0.0));\n\tfloat p11 = dot(v11, f - vec2(1.0, 1.0));\n\tvec2 t = f * f * (3.0 - 2.0 * f);\n\treturn 0.5 + mix(mix(p00, p10, t.x), mix(p01, p11, t.x), t.y);\n}\n\nfloat fbm_perlinabs(vec2 coord, vec2 size, float seed) {\n\treturn abs(2.0*fbm_perlin(coord, size, seed)-1.0);\n}\n\nfloat fbm_cellular(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size)) + vec2(x, y);\n\t\t\tfloat dist = sqrt((f - node).x * (f - node).x + (f - node).y * (f - node).y);\n\t\t\tmin_dist = min(min_dist, dist);\n\t\t}\n\t}\n\treturn min_dist;\n}\n\nfloat fbm_cellular2(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist1 = 2.0;\n\tfloat min_dist2 = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size)) + vec2(x, y);\n\t\t\tfloat dist = sqrt((f - node).x * (f - node).x + (f - node).y * (f - node).y);\n\t\t\tif (min_dist1 > dist) {\n\t\t\t\tmin_dist2 = min_dist1;\n\t\t\t\tmin_dist1 = dist;\n\t\t\t} else if (min_dist2 > dist) {\n\t\t\t\tmin_dist2 = dist;\n\t\t\t}\n\t\t}\n\t}\n\treturn min_dist2-min_dist1;\n}\n\nfloat fbm_cellular3(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size))*0.5 + vec2(x, y);\n\t\t\tfloat dist = abs((f - node).x) + abs((f - node).y);\n\t\t\tmin_dist = min(min_dist, dist);\n\t\t}\n\t}\n\treturn min_dist;\n}\n\nfloat fbm_cellular4(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist1 = 2.0;\n\tfloat min_dist2 = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size))*0.5 + vec2(x, y);\n\t\t\tfloat dist = abs((f - node).x) + abs((f - node).y);\n\t\t\tif (min_dist1 > dist) {\n\t\t\t\tmin_dist2 = min_dist1;\n\t\t\t\tmin_dist1 = dist;\n\t\t\t} else if (min_dist2 > dist) {\n\t\t\t\tmin_dist2 = dist;\n\t\t\t}\n\t\t}\n\t}\n\treturn min_dist2-min_dist1;\n}\n\nfloat fbm_cellular5(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size)) + vec2(x, y);\n\t\t\tfloat dist = max(abs((f - node).x), abs((f - node).y));\n\t\t\tmin_dist = min(min_dist, dist);\n\t\t}\n\t}\n\treturn min_dist;\n}\n\nfloat fbm_cellular6(vec2 coord, vec2 size, float seed) {\n\tvec2 o = floor(coord)+rand2(vec2(seed, 1.0-seed))+size;\n\tvec2 f = fract(coord);\n\tfloat min_dist1 = 2.0;\n\tfloat min_dist2 = 2.0;\n\tfor(float x = -1.0; x <= 1.0; x++) {\n\t\tfor(float y = -1.0; y <= 1.0; y++) {\n\t\t\tvec2 node = rand2(mod(o + vec2(x, y), size)) + vec2(x, y);\n\t\t\tfloat dist = max(abs((f - node).x), abs((f - node).y));\n\t\t\tif (min_dist1 > dist) {\n\t\t\t\tmin_dist2 = min_dist1;\n\t\t\t\tmin_dist1 = dist;\n\t\t\t} else if (min_dist2 > dist) {\n\t\t\t\tmin_dist2 = dist;\n\t\t\t}\n\t\t}\n\t}\n\treturn min_dist2-min_dist1;\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "float $(name)_fbm(vec2 coord, vec2 size, int folds, int octaves, float persistence, float seed) {\n\tfloat normalize_factor = 0.0;\n\tfloat value = 0.0;\n\tfloat scale = 1.0;\n\tfor (int i = 0; i < octaves; i++) {\n\t\tfloat noise = fbm_$noise(coord*size, size, seed);\n\t\tfor (int f = 0; f < folds; ++f) {\n\t\t\tnoise = abs(2.0*noise-1.0);\n\t\t}\n\t\tvalue += noise * scale;\n\t\tnormalize_factor += scale;\n\t\tsize *= 2.0;\n\t\tscale *= persistence;\n\t}\n\treturn value / normalize_factor;\n}\n",
|
||||
"longdesc": "Generates a noise made of several octaves of a simple noise",
|
||||
"name": "FBM",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_fbm($(uv), vec2($(scale_x), $(scale_y)), int($(folds)), int($(iterations)), $(persistence), float($(seed)))",
|
||||
"longdesc": "Shows a greyscale image of the generated noise",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Noise",
|
||||
"longdesc": "The simple noise type",
|
||||
"name": "noise",
|
||||
"shortdesc": "Noise type",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Value",
|
||||
"value": "value"
|
||||
},
|
||||
{
|
||||
"name": "Perlin",
|
||||
"value": "perlin"
|
||||
},
|
||||
{
|
||||
"name": "Cellular",
|
||||
"value": "cellular"
|
||||
},
|
||||
{
|
||||
"name": "Cellular2",
|
||||
"value": "cellular2"
|
||||
},
|
||||
{
|
||||
"name": "Cellular3",
|
||||
"value": "cellular3"
|
||||
},
|
||||
{
|
||||
"name": "Cellular4",
|
||||
"value": "cellular4"
|
||||
},
|
||||
{
|
||||
"name": "Cellular5",
|
||||
"value": "cellular5"
|
||||
},
|
||||
{
|
||||
"name": "Cellular6",
|
||||
"value": "cellular6"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale of the first octave along the X axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale of the first octave along the Y axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Folds",
|
||||
"longdesc": "The number of times the basic noise is folded",
|
||||
"max": 5,
|
||||
"min": 0,
|
||||
"name": "folds",
|
||||
"shortdesc": "Folds",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "Iterations",
|
||||
"longdesc": "The number of noise octaves",
|
||||
"max": 10,
|
||||
"min": 1,
|
||||
"name": "iterations",
|
||||
"shortdesc": "Octaves",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Persistence",
|
||||
"longdesc": "The persistence between two consecutive octaves",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "persistence",
|
||||
"shortdesc": "Persistence",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fractional Brownian Motion Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
143
game/addons/mat_maker_gd/material_maker_nodes/fbm2.mmg
Normal file
143
game/addons/mat_maker_gd/material_maker_nodes/fbm2.mmg
Normal file
File diff suppressed because one or more lines are too long
172
game/addons/mat_maker_gd/material_maker_nodes/fill.mmg
Normal file
172
game/addons/mat_maker_gd/material_maker_nodes/fill.mmg
Normal file
@ -0,0 +1,172 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "iterate_buffer",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "iterate_buffer",
|
||||
"from_port": 1,
|
||||
"to": "fill_iterate",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "fill_iterate",
|
||||
"from_port": 0,
|
||||
"to": "iterate_buffer",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "fill_preprocess",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "fill_preprocess",
|
||||
"from_port": 0,
|
||||
"to": "iterate_buffer",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Fill",
|
||||
"longdesc": "Fills areas defined by white outlines of its input",
|
||||
"name": "fill",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "iterate_buffer",
|
||||
"node_position": {
|
||||
"x": -129.307083,
|
||||
"y": -370.480591
|
||||
},
|
||||
"parameters": {
|
||||
"iterations": 10,
|
||||
"size": 8
|
||||
},
|
||||
"seed_value": 29168,
|
||||
"type": "iterate_buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -542.307068,
|
||||
"y": -370.662445
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input image whose white outlines must be filled",
|
||||
"name": "port0",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 198.267258,
|
||||
"y": -362.662445
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Generates fill data, to be connected to a fill companion node",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -171.110138,
|
||||
"y": -541.509705
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 8,
|
||||
"param1": 10
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "iterate_buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "fill_preprocess",
|
||||
"widget": "s"
|
||||
},
|
||||
{
|
||||
"node": "fill_iterate",
|
||||
"widget": "s"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the inptu image",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "iterate_buffer",
|
||||
"widget": "iterations"
|
||||
}
|
||||
],
|
||||
"longdesc": "The number of iterations of the algorithm. The optimal value depends a lot on the input image.",
|
||||
"name": "param1",
|
||||
"shortdesc": "Iterations",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fill_iterate",
|
||||
"node_position": {
|
||||
"x": -92.913391,
|
||||
"y": -290.886963
|
||||
},
|
||||
"parameters": {
|
||||
"s": 8
|
||||
},
|
||||
"type": "fill_iterate"
|
||||
},
|
||||
{
|
||||
"name": "fill_preprocess",
|
||||
"node_position": {
|
||||
"x": -110.443481,
|
||||
"y": -427.202026
|
||||
},
|
||||
"parameters": {
|
||||
"s": 8
|
||||
},
|
||||
"type": "fill_preprocess"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 8,
|
||||
"param1": 10
|
||||
},
|
||||
"shortdesc": "Fill",
|
||||
"type": "graph"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "fill_iterate",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"s": 11
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_fill(vec2 uv) {\n\tfloat size = $s;\n\tint iterations = min(int(size), 256);\n\tvec4 color = $in(fract(uv));\n\tif (color.z+color.w < 1.0/size) {\n\t\treturn vec4(0.0);\n\t}\n\tvec2 offsets[8] = { vec2(1.0, 0.0), vec2(-1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, -1.0), vec2(1.0, 1.0), vec2(-1.0, 1.0), vec2(-1.0, 1.0), vec2(-1.0, -1.0) };\n\tfor (int o = 0; o < 8; ++o) {\n\t\tvec2 uv2 = uv;\n\t\tvec2 offset = offsets[o]/size;\n\t\tfor (int i = 1; i < iterations; i += 1) {\n\t\t\tuv2 += offset;\n\t\t\tvec4 color2 = $in(fract(uv2));\n\t\t\tif (color2.z+color2.w == 0.0) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvec2 p1 = color.xy+floor(uv-color.xy);\n\t\t\tvec2 p2 = color2.xy+floor(uv2-color2.xy);\n\t\t\tvec2 p = min(p1, p2);\n\t\t\tvec2 s = max(p1+color.zw, p2+color2.zw)-p;\n\t\t\tcolor = mix(vec4(0.0, 0.0, 1.0, 1.0), vec4(fract(p), s), step(s.xyxy, vec4(1.0)));\n\t\t}\n\t}\n\treturn floor(color*size)/size;\n}\n",
|
||||
"name": "Fill iterate",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_fill($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 6,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "s",
|
||||
"type": "size"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "fill_preprocess",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"s": 8
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec4 flood_fill_preprocess(vec2 uv, float c, float s) {\n\tif (c > 0.5) {\n\t\treturn vec4(0.0);\n\t} else {\n\t\treturn vec4(floor(uv*s)/s, vec2(1.0/s));\n\t}\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Fill preprocess",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "flood_fill_preprocess($uv, $in($uv), $s)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 10,
|
||||
"first": 0,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "s",
|
||||
"type": "size"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "fill_to_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"edgecolor": {
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"r": 0,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_bb = $in($uv);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The image from which colors are taken",
|
||||
"name": "map",
|
||||
"shortdesc": "Color map",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that fills each area with a color taken from a color map image",
|
||||
"name": "Fill to Color",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "The generated output image",
|
||||
"rgba": "mix($edgecolor, $map(fract($(name_uv)_bb.xy+0.5*$(name_uv)_bb.zw)), step(0.0000001, dot($(name_uv)_bb.zw, vec2(1.0))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"label": "Edge Color",
|
||||
"longdesc": "The color used to draw outlines",
|
||||
"name": "edgecolor",
|
||||
"shortdesc": "Outline color",
|
||||
"type": "color"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to color"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "fill_to_position",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"axis": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_c = fract($in($uv).xy+0.5*$in($uv).zw);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that fills each area with a greyscale value that depends on its position",
|
||||
"name": "Fill to Position",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$axis",
|
||||
"longdesc": "The generated output image",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 2,
|
||||
"label": "",
|
||||
"longdesc": "The position value to be used:\n- X for horizontal axis\n- Y for vertical axis\n- Radial for distance to center",
|
||||
"name": "axis",
|
||||
"shortdesc": "Position",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "X",
|
||||
"value": "$(name_uv)_c.x"
|
||||
},
|
||||
{
|
||||
"name": "Y",
|
||||
"value": "$(name_uv)_c.y"
|
||||
},
|
||||
{
|
||||
"name": "Radial",
|
||||
"value": "length($(name_uv)_c-vec2(0.5))"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to position"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "fill_to_random_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"edgecolor": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_bb = $in($uv);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that fills each area with a random color",
|
||||
"name": "Fill to Random Color ",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "The generated output image",
|
||||
"rgb": "mix($edgecolor.rgb, rand3(vec2(float($seed), rand(vec2(rand($(name_uv)_bb.xy), rand($(name_uv)_bb.zw))))), step(0.0000001, dot($(name_uv)_bb.zw, vec2(1.0))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"label": "Edge Color",
|
||||
"longdesc": "The color used for outlines",
|
||||
"name": "edgecolor",
|
||||
"shortdesc": "Outline color",
|
||||
"type": "color"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to random color"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "fill_to_random_grey",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"edgecolor": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_bb = $in($uv);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that fills each area with a random greyscale value",
|
||||
"name": "Fill to Random Grey",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "mix($edgecolor, rand(vec2(float($seed), rand(vec2(rand($(name_uv)_bb.xy), rand($(name_uv)_bb.zw))))), step(0.0000001, dot($(name_uv)_bb.zw, vec2(1.0))))",
|
||||
"longdesc": "The generated output image",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Edge color",
|
||||
"longdesc": "The value used for the outlines",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "edgecolor",
|
||||
"shortdesc": "Outline color",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to random grey"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "fill_to_size",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"formula": 0
|
||||
},
|
||||
"seed_value": -52887,
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_bb = $in($uv);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that fills each area with a greyscale value that depends on its size",
|
||||
"name": "Fill to Size",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$formula",
|
||||
"longdesc": "The generated output image",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The size value to be used (area, width, height or maximum between width and height)",
|
||||
"name": "formula",
|
||||
"shortdesc": "Size",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Area",
|
||||
"value": "sqrt($(name_uv)_bb.z*$(name_uv)_bb.w)"
|
||||
},
|
||||
{
|
||||
"name": "Width",
|
||||
"value": "$(name_uv)_bb.z"
|
||||
},
|
||||
{
|
||||
"name": "Height",
|
||||
"value": "$(name_uv)_bb.w"
|
||||
},
|
||||
{
|
||||
"name": "max(W, H)",
|
||||
"value": "max($(name_uv)_bb.z, $(name_uv)_bb.w)"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to size"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
57
game/addons/mat_maker_gd/material_maker_nodes/fill_to_uv.mmg
Normal file
57
game/addons/mat_maker_gd/material_maker_nodes/fill_to_uv.mmg
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "fill_to_uv",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"mode": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec4 $(name_uv)_bb = $in($uv);",
|
||||
"global": "vec3 fill_to_uv_stretch(vec2 coord, vec4 bb, float seed) {\n\tvec2 uv_islands = fract(coord-bb.xy)/bb.zw;\n\tfloat random_value = rand(vec2(seed)+bb.xy+bb.zw);\n\treturn vec3(uv_islands, random_value);\n}\n\nvec3 fill_to_uv_square(vec2 coord, vec4 bb, float seed) {\n\tvec2 uv_islands;\n\tif (bb.z > bb.w) {\n\t\tvec2 adjusted_coord = coord + vec2(0.0, (bb.z - bb.w) / 2.0);\n\t\tuv_islands = fract(adjusted_coord-bb.xy)/bb.zz;\n\t} else {\n\t\tvec2 adjusted_coord = coord + vec2((bb.w - bb.z) / 2.0, 0.0);\n\t\tuv_islands = fract(adjusted_coord-bb.xy)/bb.ww;\n\t}\n\tfloat random_value = rand(vec2(seed)+bb.xy+bb.zw);\n\treturn vec3(uv_islands, random_value);\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input fill data, to be connected to the output of a Fill node",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A fill companion node that generated an UV map that follows each filled area",
|
||||
"name": "Fill to UV ",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "The generated output UV map, to be connected to a Custom UV node",
|
||||
"rgb": "fill_to_uv_$mode($uv, $(name_uv)_bb, float($seed))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The mode decides how the UVs are layed out on each bounding box:\n- Stretch mode where the UV layout is stretched to the bounding box. \n- Square mode where the UV layout is even and centerered based on the longest axis of the bounding box.",
|
||||
"name": "mode",
|
||||
"shortdesc": "Mode",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Stretch",
|
||||
"value": "stretch"
|
||||
},
|
||||
{
|
||||
"name": "Square",
|
||||
"value": "square"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"shortdesc": "Fill to UV"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
343
game/addons/mat_maker_gd/material_maker_nodes/gaussian_blur.mmg
Normal file
343
game/addons/mat_maker_gd/material_maker_nodes/gaussian_blur.mmg
Normal file
@ -0,0 +1,343 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "switch",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "switch",
|
||||
"from_port": 0,
|
||||
"to": "switch_2",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "switch",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "gaussian_blur_x",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gaussian_blur_x",
|
||||
"from_port": 0,
|
||||
"to": "switch",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gaussian_blur_y",
|
||||
"from_port": 0,
|
||||
"to": "switch_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer_2",
|
||||
"from_port": 0,
|
||||
"to": "gaussian_blur_y",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 1,
|
||||
"to": "gaussian_blur_x",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 1,
|
||||
"to": "gaussian_blur_y",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "buffer_3",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "switch_2",
|
||||
"from_port": 0,
|
||||
"to": "buffer_3",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Gaussian Blur",
|
||||
"longdesc": "Applys a gaussian blur on its input",
|
||||
"name": "gaussian_blur",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer_2",
|
||||
"node_position": {
|
||||
"x": -399.875,
|
||||
"y": -43.625
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "switch",
|
||||
"node_position": {
|
||||
"x": -496.452393,
|
||||
"y": -130.166656
|
||||
},
|
||||
"parameters": {
|
||||
"choices": 2,
|
||||
"outputs": 1,
|
||||
"source": 0
|
||||
},
|
||||
"type": "switch"
|
||||
},
|
||||
{
|
||||
"name": "switch_2",
|
||||
"node_position": {
|
||||
"x": -240.452393,
|
||||
"y": -133.666656
|
||||
},
|
||||
"parameters": {
|
||||
"choices": 2,
|
||||
"outputs": 1,
|
||||
"source": 0
|
||||
},
|
||||
"type": "switch"
|
||||
},
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -402.25,
|
||||
"y": -315.75
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -439.666626,
|
||||
"y": -456.666656
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 50,
|
||||
"param2": 0
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Grid size:",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "buffer_2",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "gaussian_blur_x",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "gaussian_blur_y",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "buffer_3",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input image",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Sigma:",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "gaussian_blur_x",
|
||||
"widget": "sigma"
|
||||
},
|
||||
{
|
||||
"node": "gaussian_blur_y",
|
||||
"widget": "sigma"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the blur filter",
|
||||
"name": "param1",
|
||||
"shortdesc": "Sigma",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"configurations": {
|
||||
"Both": [
|
||||
{
|
||||
"node": "switch",
|
||||
"value": 0,
|
||||
"widget": "source"
|
||||
},
|
||||
{
|
||||
"node": "switch_2",
|
||||
"value": 0,
|
||||
"widget": "source"
|
||||
}
|
||||
],
|
||||
"X": [
|
||||
{
|
||||
"node": "switch",
|
||||
"value": 0,
|
||||
"widget": "source"
|
||||
},
|
||||
{
|
||||
"node": "switch_2",
|
||||
"value": 1,
|
||||
"widget": "source"
|
||||
}
|
||||
],
|
||||
"Y": [
|
||||
{
|
||||
"node": "switch",
|
||||
"value": 1,
|
||||
"widget": "source"
|
||||
},
|
||||
{
|
||||
"node": "switch_2",
|
||||
"value": 0,
|
||||
"widget": "source"
|
||||
}
|
||||
]
|
||||
},
|
||||
"label": "Direction:",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "switch",
|
||||
"widget": "source"
|
||||
},
|
||||
{
|
||||
"node": "switch_2",
|
||||
"widget": "source"
|
||||
}
|
||||
],
|
||||
"longdesc": "Apply the blur filter horizontally, vertically of in both directions",
|
||||
"name": "param2",
|
||||
"shortdesc": "Direction",
|
||||
"type": "config_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -928.666626,
|
||||
"y": -188.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input image",
|
||||
"name": "input",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "A map that controls the strength of the blur filter",
|
||||
"name": "amount",
|
||||
"shortdesc": "Strength map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 193.547607,
|
||||
"y": -135.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Shows the generated blurred image",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"seed_value": 77778,
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gaussian_blur_x",
|
||||
"node_position": {
|
||||
"x": -412.993408,
|
||||
"y": -221.281738
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 50,
|
||||
"size": 9
|
||||
},
|
||||
"type": "gaussian_blur_x"
|
||||
},
|
||||
{
|
||||
"name": "gaussian_blur_y",
|
||||
"node_position": {
|
||||
"x": -405.993408,
|
||||
"y": 38.718262
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 50,
|
||||
"size": 9
|
||||
},
|
||||
"seed_value": 12279,
|
||||
"type": "gaussian_blur_y"
|
||||
},
|
||||
{
|
||||
"name": "buffer_3",
|
||||
"node_position": {
|
||||
"x": -50.246796,
|
||||
"y": -133.96936
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 9
|
||||
},
|
||||
"type": "buffer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 9,
|
||||
"param1": 50,
|
||||
"param2": 0
|
||||
},
|
||||
"shortdesc": "Gaussian blur",
|
||||
"type": "graph"
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "gaussian_blur_x",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 35.700001,
|
||||
"size": 9
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "amount",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_fct(vec2 uv) {\n\tfloat e = 1.0/$size;\n\tvec4 rv = vec4(0.0);\n\tfloat sum = 0.0;\n\tfloat sigma = max(0.000001, $sigma*$amount(uv));\n\tfor (float i = -50.0; i <= 50.0; i += 1.0) {\n\t\tfloat coef = exp(-0.5*(pow(i/sigma, 2.0)))/(6.28318530718*sigma*sigma);\n\t\trv += $in(uv+vec2(i*e, 0.0))*coef;\n\t\tsum += coef;\n\t}\n\treturn rv/sum;\n}",
|
||||
"name": "Gaussian blur X",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_fct($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Sigma",
|
||||
"max": 50,
|
||||
"min": 0,
|
||||
"name": "sigma",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "gaussian_blur_y",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 35.700001,
|
||||
"size": 9
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "amount",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_fct(vec2 uv) {\n\tfloat e = 1.0/$size;\n\tvec4 rv = vec4(0.0);\n\tfloat sum = 0.0;\n\tfloat sigma = max(0.000001, $sigma*$amount(uv));\n\tfor (float i = -50.0; i <= 50.0; i += 1.0) {\n\t\tfloat coef = exp(-0.5*(pow(i/sigma, 2.0)))/(6.28318530718*sigma*sigma);\n\t\trv += $in(uv+vec2(0.0, i*e))*coef;\n\t\tsum += coef;\n\t}\n\treturn rv/sum;\n}",
|
||||
"name": "Gaussian blur Y",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_fct($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "Size",
|
||||
"last": 12,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Sigma",
|
||||
"max": 50,
|
||||
"min": 0,
|
||||
"name": "sigma",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
34
game/addons/mat_maker_gd/material_maker_nodes/glsl_defs.tmpl
Normal file
34
game/addons/mat_maker_gd/material_maker_nodes/glsl_defs.tmpl
Normal file
@ -0,0 +1,34 @@
|
||||
float rand(vec2 x) {
|
||||
return fract(cos(mod(dot(x, vec2(13.9898, 8.141)), 3.14)) * 43758.5453);
|
||||
}
|
||||
|
||||
vec2 rand2(vec2 x) {
|
||||
return fract(cos(mod(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
dot(x, vec2(3.4562, 17.398))), vec2(3.14))) * 43758.5453);
|
||||
}
|
||||
|
||||
vec3 rand3(vec2 x) {
|
||||
return fract(cos(mod(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
dot(x, vec2(3.4562, 17.398)),
|
||||
dot(x, vec2(13.254, 5.867))), vec3(3.14))) * 43758.5453);
|
||||
}
|
||||
|
||||
float param_rnd(float minimum, float maximum, float seed) {
|
||||
return minimum+(maximum-minimum)*rand(vec2(seed));
|
||||
}
|
||||
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
[gd_resource type="SpatialMaterial" load_steps=5 format=2]
|
||||
|
||||
$if $(connected:albedo_tex)
|
||||
[ext_resource path="$(file_prefix)_albedo.png" type="Texture" id=1]
|
||||
$fi
|
||||
$if $(connected:ao_tex) or $(connected:roughness_tex) or $(connected:metallic_tex)
|
||||
[ext_resource path="$(file_prefix)_orm.png" type="Texture" id=2]
|
||||
$fi
|
||||
$if $(connected:normal_tex)
|
||||
[ext_resource path="$(file_prefix)_normal.png" type="Texture" id=3]
|
||||
$fi
|
||||
$if $(connected:depth_tex)
|
||||
[ext_resource path="$(file_prefix)_depth.png" type="Texture" id=4]
|
||||
$fi
|
||||
$if $(connected:emission_tex)
|
||||
[ext_resource path="$(file_prefix)_emission.png" type="Texture" id=5]
|
||||
$fi
|
||||
|
||||
|
||||
[resource]
|
||||
albedo_color = Color($(param:albedo_color.r), $(param:albedo_color.g), $(param:albedo_color.b), $(param:albedo_color.a))
|
||||
$if $(connected:albedo_tex)
|
||||
albedo_texture = ExtResource( 1 )
|
||||
$fi
|
||||
metallic = $(param:metallic)
|
||||
$if $(connected:metallic_tex)
|
||||
metallic_texture = ExtResource( 2 )
|
||||
metallic_texture_channel = 2
|
||||
$fi
|
||||
roughness = $(param:roughness)
|
||||
$if $(connected:ao_tex) or $(connected:roughness_tex) or $(connected:metallic_tex)
|
||||
roughness_texture = ExtResource( 2 )
|
||||
roughness_texture_channel = 1
|
||||
$fi
|
||||
$if $(connected:normal_tex)
|
||||
normal_enabled = true
|
||||
normal_scale = $(param:normal)
|
||||
normal_texture = ExtResource( 3 )
|
||||
$fi
|
||||
$if $(connected:emission_tex)
|
||||
emission_enabled = true
|
||||
emission = Color( 0, 0, 0, 1 )
|
||||
emission_energy = $(param:emission_energy)
|
||||
emission_operator = 0
|
||||
emission_on_uv2 = false
|
||||
emission_texture = ExtResource( 5 )
|
||||
$fi
|
||||
$if $(connected:ao_tex)
|
||||
ao_enabled = true
|
||||
ao_light_affect = $(param:ao)
|
||||
ao_texture = ExtResource( 2 )
|
||||
ao_on_uv2 = false
|
||||
ao_texture_channel = 0
|
||||
$fi
|
||||
$if $(connected:depth_tex)
|
||||
depth_enabled = true
|
||||
depth_scale = $(expr:0.2*$(param:depth_scale))
|
||||
depth_deep_parallax = true
|
||||
depth_min_layers = 8
|
||||
depth_max_layers = 32
|
||||
depth_flip_tangent = false
|
||||
depth_flip_binormal = false
|
||||
depth_texture = ExtResource( 4 )
|
||||
$fi
|
102
game/addons/mat_maker_gd/material_maker_nodes/gradient.mmg
Normal file
102
game/addons/mat_maker_gd/material_maker_nodes/gradient.mmg
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
"name": "gradient",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
},
|
||||
"repeat": 1,
|
||||
"rotate": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "float $(name_uv)_r = 0.5+(cos($rotate*0.01745329251)*($uv.x-0.5)+sin($rotate*0.01745329251)*($uv.y-0.5))/(cos(abs(mod($rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Gradient",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "An image showing the gradient",
|
||||
"rgba": "$gradient(fract($(name_uv)_r*$repeat))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat",
|
||||
"longdesc": "Number of repetitions of the gradient",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "Radius1.a",
|
||||
"default": 0,
|
||||
"label": "Rotate",
|
||||
"longdesc": "Angle of the gradient pattern",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "rotate",
|
||||
"shortdesc": "Rotate",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 0,
|
||||
"r": 0
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 1,
|
||||
"r": 1
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
},
|
||||
"label": "Gradient",
|
||||
"longdesc": "Gradient to be spread on the image",
|
||||
"name": "gradient",
|
||||
"shortdesc": "Gradient",
|
||||
"type": "gradient"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
69
game/addons/mat_maker_gd/material_maker_nodes/greyscale.mmg
Normal file
69
game/addons/mat_maker_gd/material_maker_nodes/greyscale.mmg
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "greyscale",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"mode": 2
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float gs_min(vec3 c) {\n\treturn min(c.r, min(c.g, c.b));\n}\nfloat gs_max(vec3 c) {\n\treturn max(c.r, max(c.g, c.b));\n}\nfloat gs_lightness(vec3 c) {\n\treturn 0.5*(max(c.r, max(c.g, c.b)) + min(c.r, min(c.g, c.b)));\n}\nfloat gs_average(vec3 c) {\n\treturn 0.333333333333*(c.r + c.g + c.b);\n}\nfloat gs_luminosity(vec3 c) {\n\treturn 0.21 * c.r + 0.72 * c.g + 0.07 * c.b;\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Converts its input into greyscale",
|
||||
"name": "Greyscale",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "gs_$mode($in($uv))",
|
||||
"longdesc": "Shows the image converted to greyscale",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 4,
|
||||
"label": "",
|
||||
"longdesc": "The algorithm used to convert the input into greyscale",
|
||||
"name": "mode",
|
||||
"shortdesc": "Mode",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Lightness",
|
||||
"value": "lightness"
|
||||
},
|
||||
{
|
||||
"name": "Average",
|
||||
"value": "average"
|
||||
},
|
||||
{
|
||||
"name": "Luminosity",
|
||||
"value": "luminosity"
|
||||
},
|
||||
{
|
||||
"name": "Min",
|
||||
"value": "min"
|
||||
},
|
||||
{
|
||||
"name": "Max",
|
||||
"value": "max"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"shortdesc": "Greyscale"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "height_to_angle",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"angle": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The input heightmap",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv, float epsilon) {\n\tvec3 e = vec3(epsilon, -epsilon, 0);\n\tvec2 rv = vec2(1.0, -1.0)*$in(uv+e.xy);\n\trv += vec2(-1.0, 1.0)*$in(uv-e.xy);\n\trv += vec2(1.0, 1.0)*$in(uv+e.xx);\n\trv += vec2(-1.0, -1.0)*$in(uv-e.xx);\n\trv += vec2(2.0, 0.0)*$in(uv+e.xz);\n\trv += vec2(-2.0, 0.0)*$in(uv-e.xz);\n\trv += vec2(0.0, 2.0)*$in(uv+e.zx);\n\trv += vec2(0.0, -2.0)*$in(uv-e.zx);\n\treturn atan(rv.y, rv.x)/3.141592;\n}",
|
||||
"longdesc": "Generates an angle map to be used by Advances Tiler nodes from a heightmap",
|
||||
"name": "Height To Angle",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_fct($uv, 0.0001)+$angle/180.0",
|
||||
"longdesc": "The generated angle map. Values are between -1 and 1 and the corresponding Advanced Tiler parameter (Rotate) must be set to 180.",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The offset angle applied to the generated map",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "angle",
|
||||
"shortdesc": "Angle",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Height to angle"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
41
game/addons/mat_maker_gd/material_maker_nodes/hlsl_defs.tmpl
Normal file
41
game/addons/mat_maker_gd/material_maker_nodes/hlsl_defs.tmpl
Normal file
@ -0,0 +1,41 @@
|
||||
#define hlsl_atan(x,y) atan2(x, y)
|
||||
#define mod(x,y) ((x)-(y)*floor((x)/(y)))
|
||||
inline float4 textureLod(sampler2D tex, float2 uv, float lod) {
|
||||
return tex2D(tex, uv);
|
||||
}
|
||||
inline float2 tofloat2(float x) {
|
||||
return float2(x, x);
|
||||
}
|
||||
inline float2 tofloat2(float x, float y) {
|
||||
return float2(x, y);
|
||||
}
|
||||
inline float3 tofloat3(float x) {
|
||||
return float3(x, x, x);
|
||||
}
|
||||
inline float3 tofloat3(float x, float y, float z) {
|
||||
return float3(x, y, z);
|
||||
}
|
||||
inline float3 tofloat3(float2 xy, float z) {
|
||||
return float3(xy.x, xy.y, z);
|
||||
}
|
||||
inline float3 tofloat3(float x, float2 yz) {
|
||||
return float3(x, yz.x, yz.y);
|
||||
}
|
||||
inline float4 tofloat4(float x, float y, float z, float w) {
|
||||
return float4(x, y, z, w);
|
||||
}
|
||||
inline float4 tofloat4(float x) {
|
||||
return float4(x, x, x, x);
|
||||
}
|
||||
inline float4 tofloat4(float x, float3 yzw) {
|
||||
return float4(x, yzw.x, yzw.y, yzw.z);
|
||||
}
|
||||
inline float4 tofloat4(float2 xy, float2 zw) {
|
||||
return float4(xy.x, xy.y, zw.x, zw.y);
|
||||
}
|
||||
inline float4 tofloat4(float3 xyz, float w) {
|
||||
return float4(xyz.x, xyz.y, xyz.z, w);
|
||||
}
|
||||
inline float2x2 tofloat2x2(float2 v1, float2 v2) {
|
||||
return float2x2(v1.x, v1.y, v2.x, v2.y);
|
||||
}
|
57
game/addons/mat_maker_gd/material_maker_nodes/iching.mmg
Normal file
57
game/addons/mat_maker_gd/material_maker_nodes/iching.mmg
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "iching",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"columns": 4,
|
||||
"rows": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float IChing(vec2 uv, float seed) {\n\tint value = int(32.0*rand(floor(uv)+vec2(seed)));\n\tfloat base = step(0.5, fract(fract(uv.y)*6.5))*step(0.04, fract(uv.y+0.02))*step(0.2, fract(uv.x+0.1));\n\tint bit = int(fract(uv.y)*6.5);\n\treturn base*step(0.1*step(float(bit & value), 0.5), fract(uv.x+0.55));\n}\n\n\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "This node generates a grid of random I Ching hexagrams.",
|
||||
"name": "I Ching",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "IChing(vec2($columns, $rows)*$uv, float($seed))",
|
||||
"longdesc": "A greyscale image showing random I Ching hexagrams.",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Size X",
|
||||
"longdesc": "The number of columns of the grid",
|
||||
"max": 32,
|
||||
"min": 2,
|
||||
"name": "columns",
|
||||
"shortdesc": "Size.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Size Y",
|
||||
"longdesc": "The number of rows of the grid",
|
||||
"max": 32,
|
||||
"min": 2,
|
||||
"name": "rows",
|
||||
"shortdesc": "Size.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "I Ching hexagrams generator"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
40
game/addons/mat_maker_gd/material_maker_nodes/invert.mmg
Normal file
40
game/addons/mat_maker_gd/material_maker_nodes/invert.mmg
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "invert",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0, 1.0, 1.0, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "A filter that inverts the R, G, and B channels of its input while keeping the A channel unchanged",
|
||||
"name": "Invert",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the inverted image",
|
||||
"rgba": "vec4(vec3(1.0)-$in($uv).rgb, $in($uv).a)",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Invert filter"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
112
game/addons/mat_maker_gd/material_maker_nodes/io_types.mmt
Normal file
112
game/addons/mat_maker_gd/material_maker_nodes/io_types.mmt
Normal file
@ -0,0 +1,112 @@
|
||||
[
|
||||
{
|
||||
"name":"f",
|
||||
"label":"Greyscale",
|
||||
"type":"float",
|
||||
"paramdefs":"vec2 uv",
|
||||
"params":"uv",
|
||||
"slot_type":0,
|
||||
"convert":[
|
||||
{ "type":"rgb", "expr":"vec3($(value))" },
|
||||
{ "type":"rgba", "expr":"vec4(vec3($(value)), 1.0)" }
|
||||
],
|
||||
"color":{ "r":0.5, "g":0.5, "b":0.5, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"rgb",
|
||||
"label":"Color",
|
||||
"type":"vec3",
|
||||
"paramdefs":"vec2 uv",
|
||||
"params":"uv",
|
||||
"slot_type":0,
|
||||
"convert":[
|
||||
{ "type":"f", "expr":"(dot($(value), vec3(1.0))/3.0)" },
|
||||
{ "type":"rgba", "expr":"vec4($(value), 1.0)" }
|
||||
],
|
||||
"color":{ "r":0.5, "g":0.5, "b":1.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"rgba",
|
||||
"label":"RGBA",
|
||||
"type":"vec4",
|
||||
"paramdefs":"vec2 uv",
|
||||
"params":"uv",
|
||||
"slot_type":0,
|
||||
"convert":[
|
||||
{ "type":"f", "expr":"(dot(($(value)).rgb, vec3(1.0))/3.0)" },
|
||||
{ "type":"rgb", "expr":"(($(value)).rgb)" }
|
||||
],
|
||||
"color":{ "r":0.0, "g":0.5, "b":0.0, "a":0.5 }
|
||||
},
|
||||
{
|
||||
"name":"sdf2d",
|
||||
"label":"SDF2D",
|
||||
"type":"float",
|
||||
"paramdefs":"vec2 uv",
|
||||
"params":"uv",
|
||||
"slot_type":1,
|
||||
"color":{ "r":1.0, "g":0.5, "b":0.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"sdf3d",
|
||||
"label":"SDF3D",
|
||||
"type":"float",
|
||||
"paramdefs":"vec3 p",
|
||||
"params":"p",
|
||||
"slot_type":2,
|
||||
"convert":[
|
||||
{ "type":"sdf3dc", "expr":"vec2($(value), 0.0)" }
|
||||
],
|
||||
"color":{ "r":0.5, "g":0.0, "b":0.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"sdf3dc",
|
||||
"label":"SDF3D-C",
|
||||
"type":"vec2",
|
||||
"paramdefs":"vec3 p",
|
||||
"params":"p",
|
||||
"slot_type":2,
|
||||
"convert":[
|
||||
{ "type":"sdf3d", "expr":"($(value)).x" }
|
||||
],
|
||||
"color":{ "r":1.0, "g":0.0, "b":0.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"tex3d_gs",
|
||||
"label":"Greyscale TEX3D",
|
||||
"type":"float",
|
||||
"paramdefs":"vec4 p",
|
||||
"params":"p",
|
||||
"slot_type":3,
|
||||
"convert":[
|
||||
{ "type":"tex3d", "expr":"vec3($(value))" }
|
||||
],
|
||||
"color":{ "r":0.8, "g":0.0, "b":1.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"tex3d",
|
||||
"label":"TEX3D",
|
||||
"type":"vec3",
|
||||
"paramdefs":"vec4 p",
|
||||
"params":"p",
|
||||
"slot_type":3,
|
||||
"convert":[
|
||||
{ "type":"tex3d_gs", "expr":"(dot($(value), vec3(1.0))/3.0)" }
|
||||
],
|
||||
"color":{ "r":1.0, "g":0.0, "b":1.0, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"v4v4",
|
||||
"label":"V4->V4",
|
||||
"type":"vec4",
|
||||
"paramdefs":"vec4 p",
|
||||
"params":"p",
|
||||
"slot_type":4,
|
||||
"color":{ "r":0.6, "g":0.4, "b":0.1, "a":1.0 }
|
||||
},
|
||||
{
|
||||
"name":"any",
|
||||
"slot_type":42,
|
||||
"color":{ "r":1.0, "g":1.0, "b":1.0, "a":1.0 }
|
||||
}
|
||||
]
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "kaleidoscope",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 5,
|
||||
"offset": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec2 kal_rotate(vec2 uv, float count, float offset) {\n\tfloat pi = 3.14159265359;\n\toffset *= pi/180.0;\n\toffset += pi*(1.0/count+0.5);\n\tuv -= vec2(0.5);\n\tfloat l = length(uv);\n\tfloat a = mod(atan(uv.y, uv.x)+offset, 2.0*pi/count)-offset;\n\treturn vec2(0.5)+l*vec2(cos(a), sin(a));\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv, 0, 1)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "i",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Replicated an angle of the input image several times around the center.",
|
||||
"name": "Kaleidoscope",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the transformed image",
|
||||
"rgba": "$i(kal_rotate($uv, $count, $offset))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The number of replications of an angle of the input",
|
||||
"max": 10,
|
||||
"min": 2,
|
||||
"name": "count",
|
||||
"shortdesc": "Count",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The angular offset of the replicated angle of the input",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "offset",
|
||||
"shortdesc": "Offset",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Kaleidoscope"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
85
game/addons/mat_maker_gd/material_maker_nodes/magnify.mmg
Normal file
85
game/addons/mat_maker_gd/material_maker_nodes/magnify.mmg
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "magnify",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"cx": 0,
|
||||
"cy": 0,
|
||||
"scale": 1.98
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv, 0.0, 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The input image to be transformed",
|
||||
"name": "i",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "max(1.0-2.0*length($uv-vec2(0.5)), 0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The magnifying glass shape",
|
||||
"name": "s",
|
||||
"shortdesc": "Shape",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Magnifying glass effect",
|
||||
"name": "Magnify",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the transformed image",
|
||||
"rgba": "$i(vec2($cx+0.5, $cy+0.5)+($uv-vec2($cx+0.5, $cy+0.5))/mix(1.0, $scale, $s($uv-vec2($cx, $cy))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "P1.x",
|
||||
"default": 0,
|
||||
"label": "Center X:",
|
||||
"longdesc": "X coordinate of the magnifying glass center",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "cx",
|
||||
"shortdesc": "center.x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "P1.y",
|
||||
"default": 0,
|
||||
"label": "Center Y:",
|
||||
"longdesc": "Y coordinate of the magnifying glass center",
|
||||
"max": 0.5,
|
||||
"min": -0.5,
|
||||
"name": "cy",
|
||||
"shortdesc": "center.y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Scale:",
|
||||
"longdesc": "The maximum scaling factor for the magnifying glass",
|
||||
"max": 10,
|
||||
"min": 0,
|
||||
"name": "scale",
|
||||
"shortdesc": "Scale",
|
||||
"step": 0.005,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Magnify"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "make_tileable",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"w": 0.1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"longdesc": "Creates a tileable version of its input image by moving different parts around to hide seams.",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "The image to be made tileable",
|
||||
"name": "in",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 make_tileable_$(name)(vec2 uv, float w) {\n\tvec4 a = $in(uv);\n\tvec4 b = $in(fract(uv+vec2(0.5)));\n\tfloat coef_ab = sin(1.57079632679*clamp((length(uv-vec2(0.5))-0.5+w)/w, 0.0, 1.0));\n\tvec4 c = $in(fract(uv+vec2(0.25)));\n\tfloat coef_abc = sin(1.57079632679*clamp((min(min(length(uv-vec2(0.0, 0.5)), length(uv-vec2(0.5, 0.0))), min(length(uv-vec2(1.0, 0.5)), length(uv-vec2(0.5, 1.0))))-w)/w, 0.0, 1.0));\n\treturn mix(c, mix(a, b, coef_ab), coef_abc);\n}\n",
|
||||
"name": "Make Tileable",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "A tileable version of the input image",
|
||||
"rgba": "make_tileable_$(name)($uv, 0.5*$w)",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "",
|
||||
"longdesc": "Width of the transition areas between parts of the input image",
|
||||
"max": 0.25,
|
||||
"min": 0,
|
||||
"name": "w",
|
||||
"shortdesc": "Width",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
544
game/addons/mat_maker_gd/material_maker_nodes/material.mmg
Normal file
544
game/addons/mat_maker_gd/material_maker_nodes/material.mmg
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,233 @@
|
||||
{
|
||||
"export": {
|
||||
|
||||
},
|
||||
"name": "material_dynamic",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"albedo_color": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1,
|
||||
"type": "Color"
|
||||
},
|
||||
"ao": 1,
|
||||
"depth_scale": 0.5,
|
||||
"emission_energy": 1,
|
||||
"flags_transparent": false,
|
||||
"metallic": 0,
|
||||
"normal": 1,
|
||||
"roughness": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"custom": "",
|
||||
"exports": {
|
||||
"Godot": {
|
||||
"export_extension": "tres",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).tres",
|
||||
"template": "[gd_resource type=\"ShaderMaterial\" load_steps=2 format=2]\n[ext_resource path=\"$(file_prefix).shader\" type=\"Shader\" id=1]\n$begin_buffers\n[ext_resource path=\"res://$(file_prefix)_texture_$(buffer_index).png\" type=\"Texture\" id=$(expr:$(buffer_index)+1)]\n$end_buffers\n[resource]\nshader = ExtResource( 1 )\n$begin_buffers\nshader_param/texture_$(buffer_index) = ExtResource( $(expr:$(buffer_index)+1) )\n$end_buffers\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "shader_type spatial;\nuniform vec3 uv1_scale = vec3(1.0, 1.0, 1.0);\nuniform int depth_min_layers = 8;\nuniform int depth_max_layers = 16;\nuniform vec2 depth_flip = vec2(1.0);\nuniform float variation = 0.0;\nvarying float elapsed_time;\nvoid vertex() {\n\telapsed_time = TIME;\n}\n$definitions float_uniform_to_const,rename_buffers\nvoid fragment() {\n\tfloat _seed_variation_ = variation;\n\tvec2 uv = fract(UV*uv1_scale.xy);\n$if $(connected:depth_tex)\n$begin_generate rename_buffers\n\t{\n\t\tfloat depth_scale = 0.2*$depth_scale;\n\t\tvec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*depth_flip.x,-BINORMAL*depth_flip.y,NORMAL));\n\t\tfloat num_layers = mix(float(depth_max_layers),float(depth_min_layers), abs(dot(vec3(0.0, 0.0, 1.0), view_dir)));\n\t\tfloat layer_depth = 1.0 / num_layers;\n\t\tfloat current_layer_depth = 0.0;\n\t\tvec2 P = view_dir.xy * depth_scale;\n\t\tvec2 delta = P / num_layers;\n\t\tvec2 ofs = uv;\n\t\tfloat depth = $depth_tex(ofs);\n\t\tfloat current_depth = 0.0;\n\t\twhile(current_depth < depth) {\n\t\t\tofs -= delta;\n\t\t\tdepth = $depth_tex(ofs);\n\t\t\tcurrent_depth += layer_depth;\n\t\t}\n\t\tvec2 prev_ofs = ofs + delta;\n\t\tfloat after_depth = depth - current_depth;\n\t\tfloat before_depth = $depth_tex(prev_ofs) - current_depth + layer_depth;\n\t\tfloat weight = after_depth / (after_depth - before_depth);\n\t\tofs = mix(ofs,prev_ofs,weight);\n\t\tuv = ofs;\n\t}\n$end_generate\n$fi\n$begin_generate rename_buffers\n\tvec3 albedo_tex = $albedo_tex(uv).rgb;\n\talbedo_tex = mix(pow((albedo_tex + vec3(0.055)) * (1.0 / (1.0 + 0.055)),vec3(2.4)),albedo_tex * (1.0 / 12.92),lessThan(albedo_tex,vec3(0.04045)));\n\tALBEDO = albedo_tex*$albedo_color.rgb;\n\tMETALLIC = $metallic_tex(uv)*$metallic;\n\tROUGHNESS = $roughness_tex(uv)*$roughness;\n\tNORMALMAP = $normal_tex(uv);\n\tEMISSION = $emission_tex(uv)*$emission_energy;\n\tALPHA = $opacity_tex(uv);\n$end_generate\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unity": {
|
||||
"export_extension": "mat",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "Shader \"Custom/NewSurfaceShader\"\n{\n Properties {\n$begin_buffers\n\t texture_$(buffer_index) (\"Texture $(buffer_index)\", 2D) = \"white\" {}\n$end_buffers\n\t _MainTex (\"Foo\", 2D) = \"white\" {}\n }\n SubShader {\n Tags { \"RenderType\"=\"Opaque\" }\n LOD 200\n CGPROGRAM\n #pragma surface surf Standard fullforwardshadows\n #pragma target 3.0\n\t\t\n sampler2D _MainTex;\n struct Input {\n float2 uv_MainTex;\n };\n UNITY_INSTANCING_BUFFER_START(Props)\n UNITY_INSTANCING_BUFFER_END(Props)\n\t\t\n$definitions hlsl,rename_buffers,unity\n\t\t\n void surf (Input IN, inout SurfaceOutputStandard o) {\n\t\t\tfloat2 uv = IN.uv_MainTex;\n$begin_generate hlsl,rename_buffers,unity\n\t\t\to.Albedo = $albedo_tex(uv).rgb*$albedo_color.rgb;\n o.Metallic = $metallic_tex(uv)*$metallic;\n o.Smoothness = 1.0-$roughness_tex(uv)*$roughness;\n o.Alpha = 1.0;\n\t\t\to.Normal = $normal_tex(uv)*vec3(-1.0, 1.0, -1.0)+vec3(1.0, 0.0, 1.0);\n$end_generate\n }\n ENDCG\n }\n FallBack \"Diffuse\"\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(tex_$(buffer_index))\nTextureImporter:\n internalIDToNameTable: []\n externalObjects: {}\n serializedVersion: 11\n mipmaps:\n mipMapMode: 0\n enableMipMap: 1\n sRGBTexture: 1\n linearTexture: 0\n fadeOut: 0\n borderMipMap: 0\n mipMapsPreserveCoverage: 0\n alphaTestReferenceValue: 0.5\n mipMapFadeDistanceStart: 1\n mipMapFadeDistanceEnd: 3\n bumpmap:\n convertToNormalMap: 0\n externalNormalMap: 0\n heightScale: 0.25\n normalMapFilter: 0\n isReadable: 0\n streamingMipmaps: 0\n streamingMipmapsPriority: 0\n vTOnly: 0\n grayScaleToAlpha: 0\n generateCubemap: 6\n cubemapConvolution: 0\n seamlessCubemap: 0\n textureFormat: 1\n maxTextureSize: 2048\n textureSettings:\n serializedVersion: 2\n filterMode: -1\n aniso: -1\n mipBias: -100\n wrapU: -1\n wrapV: -1\n wrapW: -1\n nPOTScale: 1\n lightmap: 0\n compressionQuality: 50\n spriteMode: 0\n spriteExtrude: 1\n spriteMeshType: 1\n alignment: 0\n spritePivot: {x: 0.5, y: 0.5}\n spritePixelsToUnits: 100\n spriteBorder: {x: 0, y: 0, z: 0, w: 0}\n spriteGenerateFallbackPhysicsShape: 1\n alphaUsage: 1\n alphaIsTransparency: 0\n spriteTessellationDetail: -1\n textureType: 0\n textureShape: 1\n singleChannelComponent: 0\n flipbookRows: 1\n flipbookColumns: 1\n maxTextureSizeSet: 0\n compressionQualitySet: 0\n textureFormatSet: 0\n ignorePngGamma: 0\n applyGammaDecoding: 0\n platformSettings:\n - serializedVersion: 3\n buildTarget: DefaultTexturePlatform\n maxTextureSize: 2048\n resizeAlgorithm: 0\n textureFormat: -1\n textureCompression: 1\n compressionQuality: 50\n crunchedCompression: 0\n allowsAlphaSplitting: 0\n overridden: 0\n androidETC2FallbackOverride: 0\n forceMaximumCompressionQuality_BC6H_BC7: 0\n spriteSheet:\n serializedVersion: 2\n sprites: []\n outline: []\n physicsShape: []\n bones: []\n spriteID: \n internalID: 0\n vertices: []\n indices: \n edges: []\n weights: []\n secondaryTextures: []\n spritePackingTag: \n pSDRemoveMatte: 0\n pSDShowRemoveMatteOption: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "buffer_templates"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).mat",
|
||||
"template": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!21 &2100000\nMaterial:\n serializedVersion: 6\n m_ObjectHideFlags: 0\n m_CorrespondingSourceObject: {fileID: 0}\n m_PrefabInstance: {fileID: 0}\n m_PrefabAsset: {fileID: 0}\n m_Name: test2\n m_Shader: {fileID: 4800000, guid: $uid(shader), type: 3}\n m_ShaderKeywords: \n m_LightmapFlags: 4\n m_EnableInstancingVariants: 0\n m_DoubleSidedGI: 0\n m_CustomRenderQueue: -1\n stringTagMap: {}\n disabledShaderPasses: []\n m_SavedProperties:\n serializedVersion: 3\n m_TexEnvs:\n - _MainTex:\n m_Texture: {fileID: 2800000, guid: 6c5d2d4e94384751a0ce7d6619e0d49a, type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$begin_buffers\n - texture_$(buffer_index):\n m_Texture: {fileID: 2800000, guid: $uid(tex_$(buffer_index)), type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$end_buffers\n m_BuildTextureStacks: []\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(shader)\nShaderImporter:\n externalObjects: {}\n defaultTextures: []\n nonModifiableTextures: []\n preprocessorOverride: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "template"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unreal": {
|
||||
"export_extension": "mm2ue",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).mm2ue",
|
||||
"template": "/*\nInstructions to setup this material:\n- copy material_dynamic.uasset and open the copy\n$begin_buffers\n- create a TextureObject for $(file_prefix)_texture_$(buffer_index).png in the graph\n and a new input for texture_$(buffer_index) in the custom node, and connect them\n$end_buffers\n- copy the shader code below and paste it into the Custom node\n*/\nstruct Functions {\n$definitions hlsl,rename_buffers,unreal\n\tfixed4 generated_shader(float2 uv, out float metallic, out float roughness, out float3 normal) {\n$begin_generate hlsl,rename_buffers,unreal\n // sample the generated texture\n\t\tfixed4 rv = tofloat4($albedo_tex(uv), 1.0)*$albedo_color;\n\t\tmetallic = $metallic_tex(uv)*$metallic;\n\t\troughness = $roughness_tex(uv)*$roughness;\n\t\tnormal = $normal_tex(uv)*float3(-1.0, -1.0, -1.0)+float3(1.0, 1.0, 1.0);\n return rv;\n$end_generate\n }\n};\nFunctions f;\nfixed4 albedo = f.generated_shader(TexCoords, metallic, roughness, normal);\nreturn albedo;\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"group_size": 7,
|
||||
"label": "",
|
||||
"name": "albedo_tex",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "metallic_tex",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "roughness_tex",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"name": "emission_tex",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.5)",
|
||||
"label": "",
|
||||
"name": "normal_tex",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "ao_tex",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "depth_tex",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "opacity_tex",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Dynamic PBR Material",
|
||||
"outputs": [
|
||||
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"r": 1
|
||||
},
|
||||
"label": "Albedo",
|
||||
"name": "albedo_color",
|
||||
"type": "color"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Metallic",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "metallic",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Roughness",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "roughness",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Emission",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "emission_energy",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Normal",
|
||||
"max": 10,
|
||||
"min": 0,
|
||||
"name": "normal",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Ambient occlusion",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "ao",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Depth",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "depth_scale",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "Transparency",
|
||||
"name": "flags_transparent",
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"preview_shader": "shader_type spatial;\nrender_mode blend_mix,depth_draw_alpha_prepass,cull_back,diffuse_burley,specular_schlick_ggx;\n\nuniform vec3 uv1_offset = vec3(1.0, 1.0, 1.0);\nuniform vec3 uv1_scale = vec3(1.0, 1.0, 1.0);\nuniform int depth_min_layers = 8;\nuniform int depth_max_layers = 32;\nuniform vec2 depth_flip = vec2(1.0);\nuniform float variation = 0.0;\n\nvarying float elapsed_time;\n\nvoid vertex() {\n\telapsed_time = TIME;\n\tUV = UV*uv1_scale.xy+uv1_offset.xy;\n}\n\n//---\n\n\n$definitions\n\nvoid fragment() {\n\tfloat _seed_variation_ = variation;\n\tvec2 uv = fract(UV);\n$begin_generate\n\t{\n\t\tfloat depth_scale = 0.2*$depth_scale;\n\t\tvec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*depth_flip.x,-BINORMAL*depth_flip.y,NORMAL));\n\t\tfloat num_layers = mix(float(depth_max_layers),float(depth_min_layers), abs(dot(vec3(0.0, 0.0, 1.0), view_dir)));\n\t\tfloat layer_depth = 1.0 / num_layers;\n\t\tfloat current_layer_depth = 0.0;\n\t\tvec2 P = view_dir.xy * depth_scale;\n\t\tvec2 delta = P / num_layers;\n\t\tvec2 ofs = uv;\n\t\tfloat depth = $depth_tex(ofs);\n\t\tfloat current_depth = 0.0;\n\t\twhile(current_depth < depth) {\n\t\t\tofs -= delta;\n\t\t\tdepth = $depth_tex(ofs);\n\t\t\tcurrent_depth += layer_depth;\n\t\t}\n\t\tvec2 prev_ofs = ofs + delta;\n\t\tfloat after_depth = depth - current_depth;\n\t\tfloat before_depth = $depth_tex(prev_ofs) - current_depth + layer_depth;\n\t\tfloat weight = after_depth / (after_depth - before_depth);\n\t\tofs = mix(ofs,prev_ofs,weight);\n\t\tuv = ofs;\n\t}\n$end_generate\n$begin_generate\n\tvec3 albedo_tex = $albedo_tex(uv);\n\talbedo_tex = mix(pow((albedo_tex + vec3(0.055)) * (1.0 / (1.0 + 0.055)),vec3(2.4)),albedo_tex * (1.0 / 12.92),lessThan(albedo_tex,vec3(0.04045)));\n\tALBEDO = albedo_tex.rgb*$albedo_color.rgb;\n\tMETALLIC = $metallic_tex(uv)*$metallic;\n\tROUGHNESS = $roughness_tex(uv)*$roughness;\n\tNORMALMAP = $normal_tex(uv);\n\tNORMALMAP_DEPTH = $normal;\n\tEMISSION = $emission_tex(uv)*$emission_energy;\n\tAO = $ao*$ao_tex(uv);\n\tif ($flags_transparent) {\n\t\tALPHA = $opacity_tex(uv);\n\t}\n$end_generate\n}\n"
|
||||
},
|
||||
"type": "material_export"
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
{
|
||||
"export": {
|
||||
|
||||
},
|
||||
"name": "material_raymarching",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"seed": 12723,
|
||||
"seed_locked": false,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"custom": "",
|
||||
"exports": {
|
||||
"Godot": {
|
||||
"export_extension": "tres",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).tres",
|
||||
"template": "[gd_resource type=\"ShaderMaterial\" load_steps=2 format=2]\n[ext_resource path=\"$(file_prefix).shader\" type=\"Shader\" id=1]\n$begin_buffers\n[ext_resource path=\"res://$(file_prefix)_texture_$(buffer_index).png\" type=\"Texture\" id=$(expr:$(buffer_index)+1)]\n$end_buffers\n[resource]\nshader = ExtResource( 1 )\n$begin_buffers\nshader_param/texture_$(buffer_index) = ExtResource( $(expr:$(buffer_index)+1) )\n$end_buffers\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "shader_type spatial;\nvarying float elapsed_time;\nvarying vec3 world_camera;\nvarying vec3 world_position;\nconst int MAX_STEPS = 100;\nconst float MAX_DIST = 100.0;\nconst float SURF_DIST = 1e-3;\n$definitions float_uniform_to_const,rename_buffers\nvec2 GetDist(vec3 p) {\n\tfloat _seed_variation_ = 0.0;\n\t\n$begin_generate rename_buffers\n\tvec2 d = $distance(p);\n$end_generate\n\treturn d;\n}\nvec2 RayMarch(vec3 ro, vec3 rd) {\n\tfloat dO = 0.0;\n\tfloat color = 0.0;\n\tvec2 dS;\n\t\n\tfor (int i = 0; i < MAX_STEPS; i++) {\n\t\tvec3 p = ro + dO * rd;\n\t\tdS = GetDist(p);\n\t\tdO += dS.x;\n\t\t\n\t\tif (dS.x < SURF_DIST || dO > MAX_DIST) {\n\t\t\tcolor = dS.y;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn vec2(dO, color);\n}\nvec3 GetNormal(vec3 p) {\n\tvec2 e = vec2(1e-2, 0);\n\t\n\tvec3 n = GetDist(p).x - vec3(\n\t\tGetDist(p - e.xyy).x,\n\t\tGetDist(p - e.yxy).x,\n\t\tGetDist(p - e.yyx).x\n\t);\n\t\n\treturn normalize(n);\n}\nvoid vertex() {\n\telapsed_time = TIME;\n\tworld_position = VERTEX;\n\tworld_camera = (inverse(MODELVIEW_MATRIX) * vec4(0, 0, 0, 1)).xyz; //object space\n\t//world_camera = ( CAMERA_MATRIX * vec4(0, 0, 0, 1)).xyz; //uncomment this to raymarch in world space\n}\nvoid fragment() {\n\tfloat _seed_variation_ = 0.0;\n\t\n\tvec3 ro = world_camera;\n\tvec3 rd = normalize(world_position - ro);\n\t\n\tvec2 rm = RayMarch(ro, rd);\n\tfloat d = rm.x;\n\tif (d >= MAX_DIST) {\n\t\tdiscard;\n\t} else {\n\t\tvec3 p = ro + rd * d;\n$begin_generate rename_buffers\n\t\tALBEDO = $albedo(vec4(p, rm.y));\n\t\tROUGHNESS = $roughness(vec4(p, rm.y)).x;\n\t\tMETALLIC = $metallic(vec4(p, rm.y)).x;\n$end_generate\n\t\tNORMAL = (INV_CAMERA_MATRIX*WORLD_MATRIX*vec4(GetNormal(p), 0.0)).xyz;\n\t}\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unity": {
|
||||
"export_extension": "mat",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "Shader \"Custom/NewSurfaceShader\"\n{\n Properties {\n$begin_buffers\n\t texture_$(buffer_index) (\"Texture $(buffer_index)\", 2D) = \"white\" {}\n$end_buffers\n }\n SubShader\n {\n Tags { \"RenderType\"=\"Opaque\" }\n LOD 200\n CGPROGRAM\n // Physically based Standard lighting model, and enable shadows on all light types\n #pragma surface surf Standard fullforwardshadows\n // Use shader model 3.0 target, to get nicer looking lighting\n #pragma target 3.0\n struct Input\n {\n float3 worldPos;\n float3 viewDir;\n };\n UNITY_INSTANCING_BUFFER_START(Props)\n // put more per-instance properties here\n UNITY_INSTANCING_BUFFER_END(Props)\n$definitions hlsl,rename_buffers,unity\n float2 sceneSDF(float3 p) {\n$begin_generate hlsl,rename_buffers,unity\n return $distance(p);\n$end_generate\n }\n#define MAX_STEPS 128\n#define SURF_DIST 0.001\n#define MAX_DIST 1000.0\n float2 RayMarch(float3 ro, float3 rd) {\n float dO = 0.0;\n float color = 0.0;\n float2 dS;\n \n for (int i = 0; i < MAX_STEPS; i++) {\n float3 p = ro + dO * rd;\n dS = sceneSDF(p);\n dO += dS.x;\n \n if (dS.x < SURF_DIST || dO > MAX_DIST) {\n color = dS.y;\n break;\n }\n }\n return float2(dO, color);\n }\n float3 GetNormal(float3 p) {\n float2 e = float2(1e-2, 0);\n \n float3 n = sceneSDF(p).x - float3(\n sceneSDF(p - e.xyy).x,\n sceneSDF(p - e.yxy).x,\n sceneSDF(p - e.yyx).x\n );\n \n return normalize(n);\n }\n void surf (Input IN, inout SurfaceOutputStandard o) {\n float3 ro = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1.0));\n float3 rd = normalize(mul(unity_WorldToObject, float4(IN.worldPos, 1.0))-ro);\n float2 dist = RayMarch(ro, rd);\n if (dist.x > 99.0) {\n discard;\n }\n float3 p = ro+rd*dist.x;\n$begin_generate hlsl,rename_buffers,unity\n o.Albedo = $albedo(vec4(p, dist.y));\n o.Metallic = $metallic(vec4(p, dist.y)).x;\n o.Smoothness = 1.0-$roughness(vec4(p, dist.y)).x;\n o.Normal = GetNormal(p);\n$end_generate\n }\n ENDCG\n }\n FallBack \"Diffuse\"\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(tex_$(buffer_index))\nTextureImporter:\n internalIDToNameTable: []\n externalObjects: {}\n serializedVersion: 11\n mipmaps:\n mipMapMode: 0\n enableMipMap: 1\n sRGBTexture: 1\n linearTexture: 0\n fadeOut: 0\n borderMipMap: 0\n mipMapsPreserveCoverage: 0\n alphaTestReferenceValue: 0.5\n mipMapFadeDistanceStart: 1\n mipMapFadeDistanceEnd: 3\n bumpmap:\n convertToNormalMap: 0\n externalNormalMap: 0\n heightScale: 0.25\n normalMapFilter: 0\n isReadable: 0\n streamingMipmaps: 0\n streamingMipmapsPriority: 0\n vTOnly: 0\n grayScaleToAlpha: 0\n generateCubemap: 6\n cubemapConvolution: 0\n seamlessCubemap: 0\n textureFormat: 1\n maxTextureSize: 2048\n textureSettings:\n serializedVersion: 2\n filterMode: -1\n aniso: -1\n mipBias: -100\n wrapU: -1\n wrapV: -1\n wrapW: -1\n nPOTScale: 1\n lightmap: 0\n compressionQuality: 50\n spriteMode: 0\n spriteExtrude: 1\n spriteMeshType: 1\n alignment: 0\n spritePivot: {x: 0.5, y: 0.5}\n spritePixelsToUnits: 100\n spriteBorder: {x: 0, y: 0, z: 0, w: 0}\n spriteGenerateFallbackPhysicsShape: 1\n alphaUsage: 1\n alphaIsTransparency: 0\n spriteTessellationDetail: -1\n textureType: 0\n textureShape: 1\n singleChannelComponent: 0\n flipbookRows: 1\n flipbookColumns: 1\n maxTextureSizeSet: 0\n compressionQualitySet: 0\n textureFormatSet: 0\n ignorePngGamma: 0\n applyGammaDecoding: 0\n platformSettings:\n - serializedVersion: 3\n buildTarget: DefaultTexturePlatform\n maxTextureSize: 2048\n resizeAlgorithm: 0\n textureFormat: -1\n textureCompression: 1\n compressionQuality: 50\n crunchedCompression: 0\n allowsAlphaSplitting: 0\n overridden: 0\n androidETC2FallbackOverride: 0\n forceMaximumCompressionQuality_BC6H_BC7: 0\n spriteSheet:\n serializedVersion: 2\n sprites: []\n outline: []\n physicsShape: []\n bones: []\n spriteID: \n internalID: 0\n vertices: []\n indices: \n edges: []\n weights: []\n secondaryTextures: []\n spritePackingTag: \n pSDRemoveMatte: 0\n pSDShowRemoveMatteOption: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "buffer_templates"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).mat",
|
||||
"template": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!21 &2100000\nMaterial:\n serializedVersion: 6\n m_ObjectHideFlags: 0\n m_CorrespondingSourceObject: {fileID: 0}\n m_PrefabInstance: {fileID: 0}\n m_PrefabAsset: {fileID: 0}\n m_Name: test2\n m_Shader: {fileID: 4800000, guid: $uid(shader), type: 3}\n m_ShaderKeywords: \n m_LightmapFlags: 4\n m_EnableInstancingVariants: 0\n m_DoubleSidedGI: 0\n m_CustomRenderQueue: -1\n stringTagMap: {}\n disabledShaderPasses: []\n m_SavedProperties:\n serializedVersion: 3\n m_TexEnvs:\n - _MainTex:\n m_Texture: {fileID: 2800000, guid: 6c5d2d4e94384751a0ce7d6619e0d49a, type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$begin_buffers\n - texture_$(buffer_index):\n m_Texture: {fileID: 2800000, guid: $uid(tex_$(buffer_index)), type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$end_buffers\n m_BuildTextureStacks: []\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(shader)\nShaderImporter:\n externalObjects: {}\n defaultTextures: []\n nonModifiableTextures: []\n preprocessorOverride: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "template"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unreal": {
|
||||
"export_extension": "mm2ue",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).mm2ue",
|
||||
"template": "/*\nInstructions to setup this material:\n- copy material_raymarching.uasset and open the copy\n- copy the shader code below and paste it into the Custom node\n$begin_buffers\n- create a TextureObject for $(file_prefix)_texture_$(buffer_index).png in the graph\n and a new input for texture_$(buffer_index) in the custom node, and connect them\n$end_buffers\n*/\nstruct Functions {\n$definitions hlsl,rename_buffers,unreal\n float2 sceneSDF(float3 p) {\n\t\tp = p.xzy/Scale;\n$begin_generate hlsl,rename_buffers,unreal\n\t\tfloat2 d = $distance(p);\n$end_generate\n return float2(d.x*Scale, d.y);\n }\n#define MAX_STEPS 128\n#define SURF_DIST 0.1\n#define MAX_DIST 1000.0\n float2 RayMarch(float3 ro, float3 rd) {\n float dO = 0.0;\n float color = 0.0;\n float2 dS;\n \n for (int i = 0; i < MAX_STEPS; i++) {\n float3 p = ro + dO * rd;\n dS = sceneSDF(p);\n dO += dS.x;\n \n if (dS.x < SURF_DIST || dO > MAX_DIST) {\n color = dS.y;\n break;\n }\n }\n return float2(dO, color);\n }\n float3 GetNormal(float3 p) {\n float2 e = float2(1e-2, 0);\n \n float3 n = sceneSDF(p).x - float3(\n sceneSDF(p - e.xyy).x,\n sceneSDF(p - e.yxy).x,\n sceneSDF(p - e.yyx).x\n );\n \n return normalize(n);\n }\n float4 generated_shader(float3 CameraPosition, float3 RayDirection, out float metallic, out float roughness, out float3 normal) {\n float3 ro = CameraPosition;\n float3 rd = RayDirection;\n float2 dist = RayMarch(ro, rd);\n\t\tfloat3 p = ro+dist.x*rd;\n\t\tfloat4 pc = tofloat4(p.xzy/Scale, dist.y);\n\t\tfloat alpha = (dist < MAX_DIST) ? 1.0 : 0.0;\n$begin_generate hlsl,rename_buffers,unreal\n float4 albedo = tofloat4($albedo(pc), alpha);\n metallic = $metallic(pc).x;\n roughness = $roughness(pc).x;\n$end_generate\n normal = GetNormal(p.xzy);\n return albedo;\n }\n};\nFunctions f;\nfloat4 albedo = f.generated_shader(CameraPosition, RayDirection, metallic, roughness, normal);\nreturn albedo;\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(file_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec2(0.0)",
|
||||
"function": true,
|
||||
"label": "Distance",
|
||||
"name": "distance",
|
||||
"type": "sdf3dc"
|
||||
},
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"function": true,
|
||||
"label": "Albedo",
|
||||
"name": "albedo",
|
||||
"type": "tex3d"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"function": true,
|
||||
"label": "Metallic",
|
||||
"name": "metallic",
|
||||
"type": "tex3d"
|
||||
},
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"function": true,
|
||||
"label": "Roughness",
|
||||
"name": "roughness",
|
||||
"type": "tex3d"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Raymarching Material",
|
||||
"outputs": [
|
||||
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"preview_shader": "shader_type spatial;\n\nvarying float elapsed_time;\n\nvarying vec3 world_camera;\nvarying vec3 world_position;\n\nconst int MAX_STEPS = 100;\nconst float MAX_DIST = 100.0;\nconst float SURF_DIST = 1e-3;\n\n$definitions\n\nvec2 GetDist(vec3 p) {\n\tfloat _seed_variation_ = 0.0;\n\t\n$begin_generate\n\tvec2 d = $distance(p);\n$end_generate\n\n\treturn d;\n}\n\nvec2 RayMarch(vec3 ro, vec3 rd) {\n\tfloat dO = 0.0;\n\tfloat color = 0.0;\n\tvec2 dS;\n\t\n\tfor (int i = 0; i < MAX_STEPS; i++)\n\t{\n\t\tvec3 p = ro + dO * rd;\n\t\tdS = GetDist(p);\n\t\tdO += dS.x;\n\t\t\n\t\tif (dS.x < SURF_DIST || dO > MAX_DIST) {\n\t\t\tcolor = dS.y;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn vec2(dO, color);\n}\n\nvec3 GetNormal(vec3 p) {\n\tvec2 e = vec2(1e-2, 0);\n\t\n\tvec3 n = GetDist(p).x - vec3(\n\t\tGetDist(p - e.xyy).x,\n\t\tGetDist(p - e.yxy).x,\n\t\tGetDist(p - e.yyx).x\n\t);\n\t\n\treturn normalize(n);\n}\n\nvoid vertex() {\n\telapsed_time = TIME;\n\tworld_position = VERTEX;\n\tworld_camera = (inverse(MODELVIEW_MATRIX) * vec4(0, 0, 0, 1)).xyz; //object space\n\t//world_camera = ( CAMERA_MATRIX * vec4(0, 0, 0, 1)).xyz; //uncomment this to raymarch in world space\n}\n\nvoid fragment() {\n\tfloat _seed_variation_ = 0.0;\n\t\n\tvec3 ro = world_camera;\n\tvec3 rd = normalize(world_position - ro);\n\t\n\tvec2 rm = RayMarch(ro, rd);\n\tfloat d = rm.x;\n\n\tif (d >= MAX_DIST)\n\t\tdiscard;\n\telse\n\t{\n\t\tvec3 p = ro + rd * d;\n$begin_generate\n\t\tALBEDO = $albedo(vec4(p, rm.y));\n\t\tROUGHNESS = $roughness(vec4(p, rm.y)).x;\n\t\tMETALLIC = $metallic(vec4(p, rm.y)).x;\n$end_generate\n\t\tNORMAL = (INV_CAMERA_MATRIX*WORLD_MATRIX*vec4(GetNormal(p), 0.0)).xyz;\n\t}\n}\n"
|
||||
},
|
||||
"type": "material_export"
|
||||
}
|
119
game/addons/mat_maker_gd/material_maker_nodes/material_unlit.mmg
Normal file
119
game/addons/mat_maker_gd/material_maker_nodes/material_unlit.mmg
Normal file
@ -0,0 +1,119 @@
|
||||
{
|
||||
"export": {
|
||||
|
||||
},
|
||||
"name": "material_unlit",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"blend": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"custom": "",
|
||||
"exports": {
|
||||
"Godot": {
|
||||
"export_extension": "tres",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).tres",
|
||||
"template": "[gd_resource type=\"ShaderMaterial\" load_steps=2 format=2]\n[ext_resource path=\"$(file_prefix).shader\" type=\"Shader\" id=1]\n$begin_buffers\n[ext_resource path=\"res://$(file_prefix)_texture_$(buffer_index).png\" type=\"Texture\" id=$(expr:$(buffer_index)+1)]\n$end_buffers\n[resource]\nshader = ExtResource( 1 )\n$begin_buffers\nshader_param/texture_$(buffer_index) = ExtResource( $(expr:$(buffer_index)+1) )\n$end_buffers\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "shader_type spatial;\n$begin_generate\nrender_mode unshaded, blend_$blend;\n$end_generate\n\nuniform vec3 uv1_scale = vec3(1.0, 1.0, 1.0);\nuniform vec3 uv1_offset = vec3(0.0, 0.0, 0.0);\nuniform float variation = 0.0;\n\nvarying float elapsed_time;\nvoid vertex() {\n\telapsed_time = TIME;\n\tUV = UV*uv1_scale.xy+uv1_offset.xy;\n}\n\n$definitions float_uniform_to_const,rename_buffers\n\nvoid fragment() {\n\tfloat _seed_variation_ = variation;\n\tvec2 uv = fract(UV);\n$begin_generate rename_buffers\n\tvec4 color_tex = $color_tex(uv);\n\tcolor_tex = mix(pow((color_tex + vec4(0.055)) * (1.0 / (1.0 + 0.055)),vec4(2.4)),color_tex * (1.0 / 12.92),lessThan(color_tex,vec4(0.04045)));\n\tALBEDO = color_tex.rgb;\n\tALPHA = color_tex.a;\n$end_generate\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unity": {
|
||||
"export_extension": "mat",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).shader",
|
||||
"template": "Shader \"Unlit/NewUnlitShader\"\n{\n Properties\n {\n }\n SubShader\n {\n Tags { \"RenderType\"=\"Opaque\" }\n LOD 100\n Pass\n {\n \tBlend One One\n CGPROGRAM\n #pragma vertex vert\n #pragma fragment frag\n // make fog work\n #pragma multi_compile_fog\n #include \"UnityCG.cginc\"\n struct appdata\n {\n float4 vertex : POSITION;\n float2 uv : TEXCOORD0;\n };\n struct v2f\n {\n float2 uv : TEXCOORD0;\n UNITY_FOG_COORDS(1)\n float4 vertex : SV_POSITION;\n };\n$definitions hlsl,rename_buffers,unity\n\t\t\n\t\t\tv2f vert (appdata v) {\n\t\t\t\tv2f o;\n\t\t\t\to.vertex = UnityObjectToClipPos(v.vertex);\n\t\t\t\to.uv = v.uv;\n\t\t\t\tUNITY_TRANSFER_FOG(o,o.vertex);\n\t\t\t\treturn o;\n\t\t\t}\n\t\t\tfixed4 frag (v2f i) : SV_Target {\n\t\t\t\tfloat2 uv = i.uv;\n$begin_generate hlsl,rename_buffers,unity\n // sample the generated texture\n fixed4 col = $color_tex(uv);\n$end_generate\n // apply fog\n UNITY_APPLY_FOG(i.fogCoord, col);\n return col;\n }\n ENDCG\n }\n }\n}\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png",
|
||||
"type": "buffers"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix)_texture_$(buffer_index).png.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(tex_$(buffer_index))\nTextureImporter:\n internalIDToNameTable: []\n externalObjects: {}\n serializedVersion: 11\n mipmaps:\n mipMapMode: 0\n enableMipMap: 1\n sRGBTexture: 1\n linearTexture: 0\n fadeOut: 0\n borderMipMap: 0\n mipMapsPreserveCoverage: 0\n alphaTestReferenceValue: 0.5\n mipMapFadeDistanceStart: 1\n mipMapFadeDistanceEnd: 3\n bumpmap:\n convertToNormalMap: 0\n externalNormalMap: 0\n heightScale: 0.25\n normalMapFilter: 0\n isReadable: 0\n streamingMipmaps: 0\n streamingMipmapsPriority: 0\n vTOnly: 0\n grayScaleToAlpha: 0\n generateCubemap: 6\n cubemapConvolution: 0\n seamlessCubemap: 0\n textureFormat: 1\n maxTextureSize: 2048\n textureSettings:\n serializedVersion: 2\n filterMode: -1\n aniso: -1\n mipBias: -100\n wrapU: -1\n wrapV: -1\n wrapW: -1\n nPOTScale: 1\n lightmap: 0\n compressionQuality: 50\n spriteMode: 0\n spriteExtrude: 1\n spriteMeshType: 1\n alignment: 0\n spritePivot: {x: 0.5, y: 0.5}\n spritePixelsToUnits: 100\n spriteBorder: {x: 0, y: 0, z: 0, w: 0}\n spriteGenerateFallbackPhysicsShape: 1\n alphaUsage: 1\n alphaIsTransparency: 0\n spriteTessellationDetail: -1\n textureType: 0\n textureShape: 1\n singleChannelComponent: 0\n flipbookRows: 1\n flipbookColumns: 1\n maxTextureSizeSet: 0\n compressionQualitySet: 0\n textureFormatSet: 0\n ignorePngGamma: 0\n applyGammaDecoding: 0\n platformSettings:\n - serializedVersion: 3\n buildTarget: DefaultTexturePlatform\n maxTextureSize: 2048\n resizeAlgorithm: 0\n textureFormat: -1\n textureCompression: 1\n compressionQuality: 50\n crunchedCompression: 0\n allowsAlphaSplitting: 0\n overridden: 0\n androidETC2FallbackOverride: 0\n forceMaximumCompressionQuality_BC6H_BC7: 0\n spriteSheet:\n serializedVersion: 2\n sprites: []\n outline: []\n physicsShape: []\n bones: []\n spriteID: \n internalID: 0\n vertices: []\n indices: \n edges: []\n weights: []\n secondaryTextures: []\n spritePackingTag: \n pSDRemoveMatte: 0\n pSDShowRemoveMatteOption: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "buffer_templates"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).mat",
|
||||
"template": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!21 &2100000\nMaterial:\n serializedVersion: 6\n m_ObjectHideFlags: 0\n m_CorrespondingSourceObject: {fileID: 0}\n m_PrefabInstance: {fileID: 0}\n m_PrefabAsset: {fileID: 0}\n m_Name: test2\n m_Shader: {fileID: 4800000, guid: $uid(shader), type: 3}\n m_ShaderKeywords: \n m_LightmapFlags: 4\n m_EnableInstancingVariants: 0\n m_DoubleSidedGI: 0\n m_CustomRenderQueue: -1\n stringTagMap: {}\n disabledShaderPasses: []\n m_SavedProperties:\n serializedVersion: 3\n m_TexEnvs:\n - _MainTex:\n m_Texture: {fileID: 2800000, guid: 6c5d2d4e94384751a0ce7d6619e0d49a, type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$begin_buffers\n - texture_$(buffer_index):\n m_Texture: {fileID: 2800000, guid: $uid(tex_$(buffer_index)), type: 3}\n m_Scale: {x: 1, y: 1}\n m_Offset: {x: 0, y: 0}\n$end_buffers\n m_BuildTextureStacks: []\n",
|
||||
"type": "template"
|
||||
},
|
||||
{
|
||||
"file_name": "$(path_prefix).shader.meta",
|
||||
"template": "fileFormatVersion: 2\nguid: $uid(shader)\nShaderImporter:\n externalObjects: {}\n defaultTextures: []\n nonModifiableTextures: []\n preprocessorOverride: 0\n userData: \n assetBundleName: \n assetBundleVariant: \n",
|
||||
"type": "template"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Unreal": {
|
||||
"export_extension": "mm2ue",
|
||||
"files": [
|
||||
{
|
||||
"file_name": "$(path_prefix).mm2ue",
|
||||
"template": "/*\nInstructions to setup this material:\n- copy material_unlit.uasset and open the copy\n$begin_buffers\n- create a TextureObject for $(file_prefix)_texture_$(buffer_index).png in the graph\n and a new input for texture_$(buffer_index) in the custom node, and connect them\n$end_buffers\n- copy the shader code below and paste it into the Custom node\n*/\nstruct Functions {\n$definitions hlsl,rename_buffers,unreal\n\tfixed4 generated_shader(float2 uv) {\n$begin_generate hlsl,rename_buffers,unreal\n // sample the generated texture\n return $color_tex(uv);\n$end_generate\n }\n};\nFunctions f;\nreturn f.generated_shader(TexCoords);\n",
|
||||
"type": "template"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"label": "",
|
||||
"name": "color_tex",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Dynamic Unlit Material",
|
||||
"outputs": [
|
||||
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Blend",
|
||||
"name": "blend",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Add",
|
||||
"value": "add"
|
||||
},
|
||||
{
|
||||
"name": "Mix",
|
||||
"value": "mix"
|
||||
},
|
||||
{
|
||||
"name": "Mul",
|
||||
"value": "mul"
|
||||
},
|
||||
{
|
||||
"name": "Sub",
|
||||
"value": "sub"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"preview_shader": "shader_type spatial;\n$begin_generate\nrender_mode unshaded, blend_$blend;\n$end_generate\n\nuniform vec3 uv1_scale = vec3(1.0, 1.0, 1.0);\nuniform vec3 uv1_offset = vec3(0.0, 0.0, 0.0);\nuniform float variation = 0.0;\n\nvarying float elapsed_time;\n\nvoid vertex() {\n\telapsed_time = TIME;\n\tUV = UV*uv1_scale.xy+uv1_offset.xy;\n}\n\n$definitions\n\nvoid fragment() {\n\tfloat _seed_variation_ = variation;\n\tvec2 uv = fract(UV);\n$begin_generate\n\tvec4 color_tex = $color_tex(uv);\n\tcolor_tex = mix(pow((color_tex + vec4(0.055)) * (1.0 / (1.0 + 0.055)),vec4(2.4)),color_tex * (1.0 / 12.92),lessThan(color_tex,vec4(0.04045)));\n\tALBEDO = color_tex.rgb;\n\tALPHA = color_tex.a;\n$end_generate\n\n}\n"
|
||||
},
|
||||
"type": "material_export"
|
||||
}
|
172
game/addons/mat_maker_gd/material_maker_nodes/math.mmg
Normal file
172
game/addons/mat_maker_gd/material_maker_nodes/math.mmg
Normal file
@ -0,0 +1,172 @@
|
||||
{
|
||||
"name": "math",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"clamp": false,
|
||||
"default_in1": 0,
|
||||
"default_in2": 0,
|
||||
"op": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "float $(name_uv)_clamp_false = $op;\nfloat $(name_uv)_clamp_true = clamp($(name_uv)_clamp_false, 0.0, 1.0);\n",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "$default_in1",
|
||||
"label": "2:A",
|
||||
"longdesc": "The A operand",
|
||||
"name": "in1",
|
||||
"shortdesc": "A",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "$default_in2",
|
||||
"label": "B",
|
||||
"longdesc": "The B operand",
|
||||
"name": "in2",
|
||||
"shortdesc": "B",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Performs a math operation using its inputs or parameter values",
|
||||
"name": "Math",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name_uv)_clamp_$clamp",
|
||||
"longdesc": "Shows a greyscale image of the result",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 19,
|
||||
"label": "",
|
||||
"longdesc": "The operation to be performed",
|
||||
"name": "op",
|
||||
"shortdesc": "Operation",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "A+B",
|
||||
"value": "$in1($uv)+$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A-B",
|
||||
"value": "$in1($uv)-$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A*B",
|
||||
"value": "$in1($uv)*$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A/B",
|
||||
"value": "$in1($uv)/$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "log(A)",
|
||||
"value": "log($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "log2(A)",
|
||||
"value": "log2($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "pow(A, B)",
|
||||
"value": "pow($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "abs(A)",
|
||||
"value": "abs($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "round(A)",
|
||||
"value": "round($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "floor(A)",
|
||||
"value": "floor($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "ceil(A)",
|
||||
"value": "ceil($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "trunc(A)",
|
||||
"value": "trunc($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "fract(A)",
|
||||
"value": "fract($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "min(A, B)",
|
||||
"value": "min($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "max(A, B)",
|
||||
"value": "max($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "A<B",
|
||||
"value": "step($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "cos(A*B)",
|
||||
"value": "cos($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "sin(A*B)",
|
||||
"value": "sin($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "tan(A*B)",
|
||||
"value": "tan($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "sqrt(1-A²)",
|
||||
"value": "sqrt(1.0-$in1($uv)*$in1($uv))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The default value for A, used if the corresponding input is not connected",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "default_in1",
|
||||
"shortdesc": "Default A",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The default value for B, used if the corresponding input is not connected",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "default_in2",
|
||||
"shortdesc": "Default B",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "Clamp result",
|
||||
"longdesc": "The result is clamped to [0, 1] if this option is checked",
|
||||
"name": "clamp",
|
||||
"shortdesc": "Clamp",
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Math"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
216
game/addons/mat_maker_gd/material_maker_nodes/math_v3.mmg
Normal file
216
game/addons/mat_maker_gd/material_maker_nodes/math_v3.mmg
Normal file
@ -0,0 +1,216 @@
|
||||
{
|
||||
"name": "math_v3",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"clamp": false,
|
||||
"d_in1_x": 0,
|
||||
"d_in1_y": 0,
|
||||
"d_in1_z": 0,
|
||||
"d_in2_x": 0,
|
||||
"d_in2_y": 0,
|
||||
"d_in2_z": 0,
|
||||
"op": 19
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec3 $(name_uv)_clamp_false = $op;\nvec3 $(name_uv)_clamp_true = clamp($(name_uv)_clamp_false, vec3(0.0), vec3(1.0));\n",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3($d_in1_x, $d_in1_y, $d_in1_z)",
|
||||
"label": "2:A",
|
||||
"longdesc": "The A operand",
|
||||
"name": "in1",
|
||||
"shortdesc": "A",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3($d_in2_x, $d_in2_y, $d_in2_z)",
|
||||
"label": "B",
|
||||
"longdesc": "The B operand",
|
||||
"name": "in2",
|
||||
"shortdesc": "B",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Performs a math operation using its inputs or parameter values",
|
||||
"name": "Vec3 Math",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows a greyscale image of the result",
|
||||
"rgb": "$(name_uv)_clamp_$clamp",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 19,
|
||||
"label": "",
|
||||
"longdesc": "The operation to be performed",
|
||||
"name": "op",
|
||||
"shortdesc": "Operation",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "A+B",
|
||||
"value": "$in1($uv)+$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A-B",
|
||||
"value": "$in1($uv)-$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A*B",
|
||||
"value": "$in1($uv)*$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "A/B",
|
||||
"value": "$in1($uv)/$in2($uv)"
|
||||
},
|
||||
{
|
||||
"name": "log(A)",
|
||||
"value": "log($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "log2(A)",
|
||||
"value": "log2($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "pow(A, B)",
|
||||
"value": "pow($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "abs(A)",
|
||||
"value": "abs($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "round(A)",
|
||||
"value": "round($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "floor(A)",
|
||||
"value": "floor($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "ceil(A)",
|
||||
"value": "ceil($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "trunc(A)",
|
||||
"value": "trunc($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "fract(A)",
|
||||
"value": "fract($in1($uv))"
|
||||
},
|
||||
{
|
||||
"name": "min(A, B)",
|
||||
"value": "min($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "max(A, B)",
|
||||
"value": "max($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "A<B",
|
||||
"value": "step($in1($uv),$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "cos(A*B)",
|
||||
"value": "cos($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "sin(A*B)",
|
||||
"value": "sin($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "tan(A*B)",
|
||||
"value": "tan($in1($uv)*$in2($uv))"
|
||||
},
|
||||
{
|
||||
"name": "sqrt(1-A²)",
|
||||
"value": "sqrt(vec3(1.0)-$in1($uv)*$in1($uv))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The default value for A, used if the corresponding input is not connected",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in1_x",
|
||||
"shortdesc": "Default A",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "2:",
|
||||
"longdesc": "The default value for B, used if the corresponding input is not connected",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in1_y",
|
||||
"shortdesc": "Default B",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "2:",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in1_z",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in2_x",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "3:",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in2_y",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "3:",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d_in2_z",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "Clamp result",
|
||||
"longdesc": "The result is clamped to [0, 1] if this option is checked",
|
||||
"name": "clamp",
|
||||
"shortdesc": "Clamp",
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Math"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
70
game/addons/mat_maker_gd/material_maker_nodes/mirror.mmg
Normal file
70
game/addons/mat_maker_gd/material_maker_nodes/mirror.mmg
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "mirror",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"direction": 0,
|
||||
"offset": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec2 uvmirror_h(vec2 uv, float offset) {\n\treturn vec2(max(0, abs(uv.x-0.5)-0.5*offset)+0.5, uv.y);\n}\nvec2 uvmirror_v(vec2 uv, float offset) {\n\treturn vec2(uv.x, max(0, abs(uv.y-0.5)-0.5*offset)+0.5);\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4($uv, 0, 1)",
|
||||
"label": "",
|
||||
"longdesc": "The input image",
|
||||
"name": "i",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Mirrors its input while applying an offset from the center",
|
||||
"name": "Mirror",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the mirrored image",
|
||||
"rgba": "$i(uvmirror_$direction($uv, $offset))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The mirror direction (horizontal or vertical)",
|
||||
"name": "direction",
|
||||
"shortdesc": "Direction",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Horizontal",
|
||||
"value": "h"
|
||||
},
|
||||
{
|
||||
"name": "Vertical",
|
||||
"value": "v"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"longdesc": "The offset from the center",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "offset",
|
||||
"shortdesc": "Offset",
|
||||
"step": 0.005,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Mirror"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
53
game/addons/mat_maker_gd/material_maker_nodes/morphology.mmg
Normal file
53
game/addons/mat_maker_gd/material_maker_nodes/morphology.mmg
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "morphology",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"d": 0.15,
|
||||
"s": 9
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "float $(name)_dilate(vec2 uv) {\n\tfloat e = 1.0/$s;\n\tfloat dx = min(25.0, floor($d/e))*e;\n\tfloat v = 0.0;\n\tfor (float x = -dx; x <= dx; x += e) {\n\t\tfloat dy = min(25.0*e, sqrt(dx*dx-x*x));\n\t\tfor (float y = -dy; y <= dy; y += e) {\n\t\t\tv = max(v, $in(uv+vec2(x, y)));\n\t\t}\n\t}\n\treturn v;\n}",
|
||||
"name": "Morphology Dilation",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_dilate($uv)",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 9,
|
||||
"first": 6,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "s",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "",
|
||||
"max": 0.3,
|
||||
"min": 0,
|
||||
"name": "d",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
60
game/addons/mat_maker_gd/material_maker_nodes/mul_detect.mmg
Normal file
60
game/addons/mat_maker_gd/material_maker_nodes/mul_detect.mmg
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "mul_detect",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"t": 0.01,
|
||||
"v": 0.5
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "float $(name_uv)_d = ($in($uv)-$v)/$t;",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"name": "mul",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "MulDetect",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$mul($uv)*clamp(1.0-$(name_uv)_d*$(name_uv)_d, 0.0, 1.0)",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Value",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "v",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Tolerance",
|
||||
"max": 1,
|
||||
"min": 0.01,
|
||||
"name": "t",
|
||||
"step": 0.001,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "multigradient",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"count": 10
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float multigradient(vec2 uv, int count, float seed) {\n\tfloat rv = 1.0;\n\tfloat angle = 0.0;\n\tfor (int i = 0; i < count; ++i) {\n\t\tangle = rand(vec2(seed, angle))*6.28;\n\t\tfloat v = 0.5+(cos(angle)*(uv.x-0.5)+sin(angle)*(uv.y-0.5))/(cos(abs(mod(angle, 0.5*3.141592)-0.25*3.141592))*1.41421356237);\n\t\trv = min(rv, v);\n\t}\n\treturn rv;\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3($uv, 0.0)",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "MultiGradient",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "multigradient($in($uv).xy, int($count), float($seed)+$in($uv).z)",
|
||||
"longdesc": "An image showing the gradient",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"longdesc": "Number of repetitions of the gradient",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "count",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "mwf_create_map",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"angle": 0,
|
||||
"height": 0.5
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "1.0",
|
||||
"label": "",
|
||||
"longdesc": "The input height map",
|
||||
"name": "h",
|
||||
"shortdesc": "Height",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"longdesc": "The input offset seed map",
|
||||
"name": "o",
|
||||
"shortdesc": "Offset",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Creates a workflow map using a heightmap and an optional seed map. The workflow map contains height information as well as orientation and a seed for random offset for the material it will be applied to.",
|
||||
"name": "Create Map",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "The generated workflow map, to be connected to a MixMap or an ApplyMap node",
|
||||
"rgb": "vec3($height*$h($uv), $angle*0.00277777777+0.5, rand(vec2(float($seed)+$o($uv))))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Height",
|
||||
"longdesc": "The maximum height of the workflow map, used as multiplier for the input height map",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "height",
|
||||
"shortdesc": "Height",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0,
|
||||
"label": "Angle",
|
||||
"longdesc": "The angle stored in the workflow map",
|
||||
"max": 180,
|
||||
"min": -180,
|
||||
"name": "angle",
|
||||
"shortdesc": "Angle",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Create map"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
98
game/addons/mat_maker_gd/material_maker_nodes/mwf_map.mmg
Normal file
98
game/addons/mat_maker_gd/material_maker_nodes/mwf_map.mmg
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"name": "mwf_map",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "float $(name_uv)_angle = 6.28318530718*($map($uv).y-0.5);\nvec2 $(name_uv)_uv = matmap_uv($uv, $(name_uv)_angle, $map($uv).z);\n",
|
||||
"global": "vec2 matmap_uv(vec2 uv, float angle, float seed) {\n\tuv -= vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn fract(rv + rand2(vec2(seed)));\n}\n\nvec3 matmap_rotate_nm(vec3 input, float angle) {\n\tvec2 uv = input.xy - vec2(0.5);\n\tvec2 rv;\n\trv.x = uv.x*cos(angle)+uv.y*sin(angle);\n\trv.y = -uv.x*sin(angle)+uv.y*cos(angle);\n\treturn vec3(rv + vec2(0.5), input.z);\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(1.0, 0.5, 0.0)",
|
||||
"label": "Map",
|
||||
"longdesc": "The input workflow map",
|
||||
"name": "map",
|
||||
"shortdesc": "Map",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"group_size": 4,
|
||||
"label": "Albedo",
|
||||
"longdesc": "The Albedo channel of the input base material",
|
||||
"name": "mat1",
|
||||
"shortdesc": "Albedo",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "ORM",
|
||||
"longdesc": "The ambient occlusion, roughness and metallic channels of the input material",
|
||||
"name": "mat2",
|
||||
"shortdesc": "ORM",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "Emission",
|
||||
"longdesc": "The emission channel of the input material",
|
||||
"name": "mat3",
|
||||
"shortdesc": "Emission",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.5, 0.5, 1.0)",
|
||||
"label": "Normal",
|
||||
"longdesc": "The normal map of the input material",
|
||||
"name": "mat4",
|
||||
"shortdesc": "Normal",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Applies a workflow map to a base material, and generates height information as well as PBR channels for the result.\nThe height input must be connected to a Create Map or Mix Maps node. The other inputs must be connected to a base material.\nThe outputs must be connected to the Mix or the Output node, or a workflow filter node.",
|
||||
"name": "Apply Map",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$map($uv).x",
|
||||
"group_size": 5,
|
||||
"longdesc": "The height map of the result",
|
||||
"shortdesc": "Height",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "The albedo channel of the result",
|
||||
"rgb": "$mat1($(name_uv)_uv)",
|
||||
"shortdesc": "Albedo",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "The ambient occlusion, roughness and metallic channels of the result",
|
||||
"rgb": "$mat2($(name_uv)_uv)",
|
||||
"shortdesc": "ORM",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "The emission channel of the result",
|
||||
"rgb": "$mat3($(name_uv)_uv)",
|
||||
"shortdesc": "Emission",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "The normal map of the result",
|
||||
"rgb": "matmap_rotate_nm($mat4($(name_uv)_uv), -$(name_uv)_angle)",
|
||||
"shortdesc": "Normal",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Apply Map"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
139
game/addons/mat_maker_gd/material_maker_nodes/mwf_mix.mmg
Normal file
139
game/addons/mat_maker_gd/material_maker_nodes/mwf_mix.mmg
Normal file
@ -0,0 +1,139 @@
|
||||
{
|
||||
"name": "mwf_mix",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "float $(name_uv)_a1 = step($h1($uv), $h2($uv));",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"group_size": 5,
|
||||
"label": "Height 1",
|
||||
"longdesc": "The height map of the first input",
|
||||
"name": "h1",
|
||||
"shortdesc": "Height1",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "Albedo 1",
|
||||
"longdesc": "The albedo channel of the first input",
|
||||
"name": "c1",
|
||||
"shortdesc": "Albedo1",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "ORM 1",
|
||||
"longdesc": "The ambient occlusion, roughness and metallic channels of the first input",
|
||||
"name": "orm1",
|
||||
"shortdesc": "ORM1",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "Emission 1",
|
||||
"longdesc": "The emission channel of the first input",
|
||||
"name": "em1",
|
||||
"shortdesc": "Emission1",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.5, 0.5, 1.0)",
|
||||
"label": "Normal 1",
|
||||
"longdesc": "The normal map of the first input",
|
||||
"name": "nm1",
|
||||
"shortdesc": "Normal1",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "0.0",
|
||||
"group_size": 5,
|
||||
"label": "Height 2",
|
||||
"longdesc": "The height map of the second input",
|
||||
"name": "h2",
|
||||
"shortdesc": "Height2",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "Albedo 2",
|
||||
"longdesc": "The albedo channel of the second input",
|
||||
"name": "c2",
|
||||
"shortdesc": "Albedo2",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "ORM 2",
|
||||
"longdesc": "The ambient occlusion, roughness and metallic channels of the second input",
|
||||
"name": "orm2",
|
||||
"shortdesc": "ORM2",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "Emission 2",
|
||||
"longdesc": "The emission channel of the second input",
|
||||
"name": "em2",
|
||||
"shortdesc": "Emission2",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.5, 0.5, 1.0)",
|
||||
"label": "Normal 2",
|
||||
"longdesc": "The normal map of the second input",
|
||||
"name": "nm2",
|
||||
"shortdesc": "Normal2",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Combines the outputs of 2 mapped base materials (keeping the \"highest\" material).",
|
||||
"name": "Mix",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "max($h1($uv), $h2($uv))",
|
||||
"group_size": 5,
|
||||
"longdesc": "Generates the height of the result",
|
||||
"shortdesc": "Height",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows the output albedo channel",
|
||||
"rgb": "mix($c1($uv), $c2($uv), $(name_uv)_a1)",
|
||||
"shortdesc": "Albedo",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows the output ambient occlusion, roughness and metallic channels",
|
||||
"rgb": "mix($orm1($uv), $orm2($uv), $(name_uv)_a1)",
|
||||
"shortdesc": "ORM",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows the output emission channel",
|
||||
"rgb": "mix($em1($uv), $em2($uv), $(name_uv)_a1)",
|
||||
"shortdesc": "Emission",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"longdesc": "Shows the output normal map",
|
||||
"rgb": "mix($nm1($uv), $nm2($uv), $(name_uv)_a1)",
|
||||
"shortdesc": "Normal",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Mix"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "mwf_mix_maps",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec3 matmap_mix(vec3 in1, vec3 in2) {\n\tfloat is_in1 = step(in2.x, in1.x);\n\t//return vec3(max(in1.x, in2.x), in1.yz*is_in1+in2.yz*(1.0-is_in1));\n\treturn vec3(max(in1.x, in2.x), mix(in2.yz, in1.yz, is_in1));\n}",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The first workflow map",
|
||||
"name": "in1",
|
||||
"shortdesc": "Input1",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The second workflow map",
|
||||
"name": "in2",
|
||||
"shortdesc": "Input2",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The third input map",
|
||||
"name": "in3",
|
||||
"shortdesc": "Input3",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"default": "vec3(0.0)",
|
||||
"label": "",
|
||||
"longdesc": "The fourth input map",
|
||||
"name": "in4",
|
||||
"shortdesc": "Input4",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Mixes up to 4 workflow maps, to be used with the same base material",
|
||||
"name": "Mix maps",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Generates a merged workflow map",
|
||||
"rgb": "matmap_mix(matmap_mix($in1($uv), $in2($uv)), matmap_mix($in3($uv), $in4($uv)))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"shortdesc": "Mix maps"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
334
game/addons/mat_maker_gd/material_maker_nodes/mwf_output.mmg
Normal file
334
game/addons/mat_maker_gd/material_maker_nodes/mwf_output.mmg
Normal file
@ -0,0 +1,334 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "colorize_3",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 6
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "colorize_3",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "occlusion",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "occlusion",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 5
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 2,
|
||||
"to": "decompose",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "decompose",
|
||||
"from_port": 1,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 2
|
||||
},
|
||||
{
|
||||
"from": "decompose",
|
||||
"from_port": 2,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "blend_2",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 4
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 1,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 3,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 3
|
||||
},
|
||||
{
|
||||
"from": "brightness_contrast",
|
||||
"from_port": 0,
|
||||
"to": "blend_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 4,
|
||||
"to": "brightness_contrast",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "normal_map_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "normal_map_2",
|
||||
"from_port": 0,
|
||||
"to": "blend_2",
|
||||
"to_port": 1
|
||||
}
|
||||
],
|
||||
"label": "Output",
|
||||
"longdesc": "Converts a workflow mapped material (from an Apply Map or a Mix node) for a Material node",
|
||||
"name": "mwf_output",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "colorize_3",
|
||||
"node_position": {
|
||||
"x": -939.637451,
|
||||
"y": 871.842407
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 0,
|
||||
"r": 1
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 1,
|
||||
"r": 0
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
}
|
||||
},
|
||||
"type": "colorize"
|
||||
},
|
||||
{
|
||||
"name": "occlusion",
|
||||
"node_position": {
|
||||
"x": -994.845825,
|
||||
"y": 786.968262
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 10,
|
||||
"param2": 1
|
||||
},
|
||||
"type": "occlusion"
|
||||
},
|
||||
{
|
||||
"name": "decompose",
|
||||
"node_position": {
|
||||
"x": -924.371338,
|
||||
"y": 570.25
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"type": "decompose"
|
||||
},
|
||||
{
|
||||
"name": "blend_2",
|
||||
"node_position": {
|
||||
"x": -931.305542,
|
||||
"y": 677.328491
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 1,
|
||||
"blend_type": 4
|
||||
},
|
||||
"type": "blend"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -1626.805542,
|
||||
"y": 608.758606
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 5,
|
||||
"name": "Height",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "Albedo",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "ORM",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "Emission",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "Normal",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": -635.305542,
|
||||
"y": 597.758606
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 7,
|
||||
"longdesc": "",
|
||||
"name": "Albedo",
|
||||
"shortdesc": "Albedo",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Metallic",
|
||||
"shortdesc": "Metallic",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Roughness",
|
||||
"shortdesc": "Roughness",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Emission",
|
||||
"shortdesc": "Emission",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Normal",
|
||||
"shortdesc": "Normal",
|
||||
"type": "rgb"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Occlusion",
|
||||
"shortdesc": "Occlusion",
|
||||
"type": "f"
|
||||
},
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "",
|
||||
"name": "Depth",
|
||||
"shortdesc": "Depth",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -1104.881836,
|
||||
"y": 425.25
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 1,
|
||||
"param2": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Occlusion",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "occlusion",
|
||||
"widget": "param2"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the calculated occlusion effect",
|
||||
"name": "param2",
|
||||
"shortdesc": "Occlusion",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Mat Normal",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "blend_2",
|
||||
"widget": "amount"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of normals from the base materials (compared to the normal generated from height information))",
|
||||
"name": "param0",
|
||||
"shortdesc": "MatNormal",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "brightness_contrast",
|
||||
"node_position": {
|
||||
"x": -1177.223877,
|
||||
"y": 677.062317
|
||||
},
|
||||
"parameters": {
|
||||
"brightness": 0,
|
||||
"contrast": 1
|
||||
},
|
||||
"type": "brightness_contrast"
|
||||
},
|
||||
{
|
||||
"name": "normal_map_2",
|
||||
"node_position": {
|
||||
"x": -1152.5,
|
||||
"y": 544.75
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 10,
|
||||
"param1": 1.02,
|
||||
"param2": 0,
|
||||
"param4": 1
|
||||
},
|
||||
"type": "normal_map"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 1,
|
||||
"param2": 1
|
||||
},
|
||||
"shortdesc": "Output",
|
||||
"type": "graph"
|
||||
}
|
55
game/addons/mat_maker_gd/material_maker_nodes/noise.mmg
Normal file
55
game/addons/mat_maker_gd/material_maker_nodes/noise.mmg
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "noise",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"density": 0.5,
|
||||
"size": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float dots(vec2 uv, float size, float density, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\tfloat color = step(rand(seed2+point_pos), density);\n return color;\n}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "\n\t\tfloat $(name)_f(vec2 uv) {\n\t\t\treturn dots(uv, 1.0/$(size), $(density), $(seed));\n\t\t}",
|
||||
"longdesc": "Generates a grid made of black and white squares",
|
||||
"name": "Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_f($(uv))",
|
||||
"longdesc": "Shows the noise pattern",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 8,
|
||||
"first": 2,
|
||||
"label": "Grid Size:",
|
||||
"last": 12,
|
||||
"longdesc": "The grid size",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Density:",
|
||||
"longdesc": "The density of white squares",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "density",
|
||||
"shortdesc": "Density",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Noise pattern"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "noise_anisotropic",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"interpolation": 1,
|
||||
"scale_x": 4,
|
||||
"scale_y": 256,
|
||||
"smoothness": 1
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float anisotropic(vec2 uv, vec2 size, float seed, float smoothness, float interpolation) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\t\n\tvec2 xy = floor(uv*size);\n\tvec2 offset = vec2(rand(seed2 + xy.y), 0.0);\n\tvec2 xy_offset = floor(uv * size + offset );\n float f0 = rand(seed2+mod(xy_offset, size));\n float f1 = rand(seed2+mod(xy_offset+vec2(1.0, 0.0), size));\n\tfloat mixer = clamp( (fract(uv.x*size.x+offset.x) -.5) / smoothness + 0.5, 0.0, 1.0 );\n float smooth_mix = smoothstep(0.0, 1.0, mixer);\n\tfloat linear = mix(f0, f1, mixer);\n\tfloat smoothed = mix(f0, f1, smooth_mix);\n\t\n return mix(linear, smoothed, interpolation);\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates x-axis interpolated value noise",
|
||||
"name": "Anisotropic Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "anisotropic($(uv), vec2($(scale_x), $(scale_y)), $(seed), $(smoothness), $(interpolation))",
|
||||
"longdesc": "Shows a greyscale value noise",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale along the X axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 256,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale along the Y axis",
|
||||
"max": 1024,
|
||||
"min": 1,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Smoothness",
|
||||
"longdesc": "Controls how much the noise is blurred along the x-axis",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "smoothness",
|
||||
"shortdesc": "Smoothness",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Interpolation",
|
||||
"longdesc": "Controls the type of interpolation used for the smoothing. 0 is linear interpolation, 1 is smooth interpolation",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "interpolation",
|
||||
"shortdesc": "Interpolation",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Anisotropic Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "noise_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"size": 9
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec3 color_dots(vec2 uv, float size, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n\tuv /= size;\n\tvec2 point_pos = floor(uv)+vec2(0.5);\n\treturn rand3(seed2+point_pos);\n}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates a grid made of random color squares",
|
||||
"name": "Color Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows the noise pattern",
|
||||
"rgb": "color_dots($(uv), 1.0/$(size), $(seed))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 8,
|
||||
"first": 2,
|
||||
"label": "Grid Size:",
|
||||
"last": 12,
|
||||
"longdesc": "The grid size",
|
||||
"name": "size",
|
||||
"shortdesc": "Size",
|
||||
"type": "size"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Color Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
279
game/addons/mat_maker_gd/material_maker_nodes/normal_map.mmg
Normal file
279
game/addons/mat_maker_gd/material_maker_nodes/normal_map.mmg
Normal file
@ -0,0 +1,279 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "switch",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "switch",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "edge_detect_1",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "switch",
|
||||
"from_port": 0,
|
||||
"to": "edge_detect_1",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Normal Map",
|
||||
"longdesc": "Generates a normal map from a height map",
|
||||
"name": "normal_map",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -695.663818,
|
||||
"y": 34.60614
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 10
|
||||
},
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -731.910156,
|
||||
"y": -131.916687
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 10,
|
||||
"param1": 1,
|
||||
"param2": 0,
|
||||
"param4": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "edge_detect_1",
|
||||
"widget": "format"
|
||||
}
|
||||
],
|
||||
"longdesc": "The format of the generated normal map\nIn most cases this should be set to default",
|
||||
"name": "param2",
|
||||
"shortdesc": "Format",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "edge_detect_1",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the generated normal map",
|
||||
"name": "param0",
|
||||
"shortdesc": "Resolution",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "edge_detect_1",
|
||||
"widget": "amount"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the normal map filter",
|
||||
"name": "param1",
|
||||
"shortdesc": "Strength",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"configurations": {
|
||||
"False": [
|
||||
{
|
||||
"node": "switch",
|
||||
"value": 0,
|
||||
"widget": "source"
|
||||
}
|
||||
],
|
||||
"True": [
|
||||
{
|
||||
"node": "switch",
|
||||
"value": 1,
|
||||
"widget": "source"
|
||||
}
|
||||
]
|
||||
},
|
||||
"label": "Buffer",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "switch",
|
||||
"widget": "source"
|
||||
}
|
||||
],
|
||||
"longdesc": "When set, a buffer is used to sample the input before the normal map filter",
|
||||
"name": "param4",
|
||||
"shortdesc": "Buffer",
|
||||
"type": "config_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": -445.663818,
|
||||
"y": 75.047363
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "Shows the generated normal map",
|
||||
"name": "Normal",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -1094.910156,
|
||||
"y": 74.047363
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input height map",
|
||||
"name": "Bump",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"seed_value": 12483,
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "switch",
|
||||
"node_position": {
|
||||
"x": -673.5,
|
||||
"y": 113.297363
|
||||
},
|
||||
"parameters": {
|
||||
"choices": 2,
|
||||
"outputs": 1,
|
||||
"source": 1
|
||||
},
|
||||
"type": "switch"
|
||||
},
|
||||
{
|
||||
"name": "edge_detect_1",
|
||||
"node_position": {
|
||||
"x": -676.092529,
|
||||
"y": 193.868774
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 1,
|
||||
"format": 0,
|
||||
"size": 10
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec3 process_normal_default(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*multiplier+vec3(0.0, 0.0, -1.0))+vec3(0.5);\n}\n\nvec3 process_normal_opengl(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*multiplier+vec3(0.0, 0.0, 1.0))+vec3(0.5);\n}\n\nvec3 process_normal_directx(vec3 v, float multiplier) {\n\treturn 0.5*normalize(v.xyz*vec3(1.0, -1.0, 1.0)*multiplier+vec3(0.0, 0.0, 1.0))+vec3(0.5);\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec3 $(name)_fct(vec2 uv) {\n\tvec3 e = vec3(1.0/$size, -1.0/$size, 0);\n\tvec2 rv = vec2(1.0, -1.0)*$in(uv+e.xy);\n\trv += vec2(-1.0, 1.0)*$in(uv-e.xy);\n\trv += vec2(1.0, 1.0)*$in(uv+e.xx);\n\trv += vec2(-1.0, -1.0)*$in(uv-e.xx);\n\trv += vec2(2.0, 0.0)*$in(uv+e.xz);\n\trv += vec2(-2.0, 0.0)*$in(uv-e.xz);\n\trv += vec2(0.0, 2.0)*$in(uv+e.zx);\n\trv += vec2(0.0, -2.0)*$in(uv-e.zx);\n\treturn vec3(rv, 0.0);\n}",
|
||||
"name": "Normal map",
|
||||
"outputs": [
|
||||
{
|
||||
"rgb": "process_normal_$format($(name)_fct($uv), $amount*$size/128.0)",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "",
|
||||
"name": "format",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Default",
|
||||
"value": "default"
|
||||
},
|
||||
{
|
||||
"name": "OpenGL",
|
||||
"value": "opengl"
|
||||
},
|
||||
{
|
||||
"name": "DirectX",
|
||||
"value": "directx"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": 9,
|
||||
"first": 4,
|
||||
"label": "",
|
||||
"last": 12,
|
||||
"name": "size",
|
||||
"type": "size"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "amount",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 10,
|
||||
"param1": 1,
|
||||
"param2": 0,
|
||||
"param4": 1
|
||||
},
|
||||
"shortdesc": "Normal map",
|
||||
"type": "graph"
|
||||
}
|
300
game/addons/mat_maker_gd/material_maker_nodes/occlusion.mmg
Normal file
300
game/addons/mat_maker_gd/material_maker_nodes/occlusion.mmg
Normal file
@ -0,0 +1,300 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "blend",
|
||||
"from_port": 0,
|
||||
"to": "colorize",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "blend",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "colorize",
|
||||
"from_port": 0,
|
||||
"to": "_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "_2",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer",
|
||||
"from_port": 0,
|
||||
"to": "gaussian_blur_x",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gaussian_blur_x",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "buffer_2",
|
||||
"from_port": 0,
|
||||
"to": "gaussian_blur_y",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gaussian_blur_y",
|
||||
"from_port": 0,
|
||||
"to": "blend",
|
||||
"to_port": 1
|
||||
}
|
||||
],
|
||||
"label": "Occlusion",
|
||||
"longdesc": "Generates an ambient occlusion map from a height map",
|
||||
"name": "occlusion",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "buffer_2",
|
||||
"node_position": {
|
||||
"x": -409.875,
|
||||
"y": -112.625
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 8
|
||||
},
|
||||
"seed_value": 61344,
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "buffer",
|
||||
"node_position": {
|
||||
"x": -408.25,
|
||||
"y": -265.75
|
||||
},
|
||||
"parameters": {
|
||||
"lod": 0,
|
||||
"size": 8
|
||||
},
|
||||
"seed_value": 53030,
|
||||
"type": "buffer"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -463.666626,
|
||||
"y": -384.666656
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 8,
|
||||
"param2": 1.5
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Grid size:",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "buffer_2",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "gaussian_blur_x",
|
||||
"widget": "size"
|
||||
},
|
||||
{
|
||||
"node": "gaussian_blur_y",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input height map",
|
||||
"name": "param0",
|
||||
"shortdesc": "Size",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Strength",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "_2",
|
||||
"widget": "g"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the occlusion map effect",
|
||||
"name": "param2",
|
||||
"shortdesc": "Strength",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -824.666626,
|
||||
"y": -116.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input heightmap",
|
||||
"name": "port0",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 33.547607,
|
||||
"y": -132.392853
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The generated occlusion map",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "blend",
|
||||
"node_position": {
|
||||
"x": -422.79895,
|
||||
"y": 63.16272
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 1,
|
||||
"blend_type": 11
|
||||
},
|
||||
"type": "blend"
|
||||
},
|
||||
{
|
||||
"name": "colorize",
|
||||
"node_position": {
|
||||
"x": -167.79895,
|
||||
"y": -178.83728
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 0,
|
||||
"r": 1
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 1,
|
||||
"r": 0
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
}
|
||||
},
|
||||
"seed_value": 33856,
|
||||
"type": "colorize"
|
||||
},
|
||||
{
|
||||
"name": "_2",
|
||||
"node_position": {
|
||||
"x": -145.403687,
|
||||
"y": -112.29187
|
||||
},
|
||||
"parameters": {
|
||||
"g": 1.5
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "pow($in($uv), $g)",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "g",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"name": "gaussian_blur_x",
|
||||
"node_position": {
|
||||
"x": -413.053711,
|
||||
"y": -189.016876
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 50,
|
||||
"size": 8
|
||||
},
|
||||
"type": "gaussian_blur_x"
|
||||
},
|
||||
{
|
||||
"name": "gaussian_blur_y",
|
||||
"node_position": {
|
||||
"x": -405.053711,
|
||||
"y": -21.016876
|
||||
},
|
||||
"parameters": {
|
||||
"sigma": 50,
|
||||
"size": 8
|
||||
},
|
||||
"type": "gaussian_blur_y"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 8,
|
||||
"param2": 1.5
|
||||
},
|
||||
"shortdesc": "Occlusion",
|
||||
"type": "graph"
|
||||
}
|
440
game/addons/mat_maker_gd/material_maker_nodes/occlusion2.mmg
Normal file
440
game/addons/mat_maker_gd/material_maker_nodes/occlusion2.mmg
Normal file
@ -0,0 +1,440 @@
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "colorize",
|
||||
"from_port": 0,
|
||||
"to": "_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "_2",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "fast_blur",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "fast_blur",
|
||||
"from_port": 0,
|
||||
"to": "blend",
|
||||
"to_port": 1
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "blend",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "blend",
|
||||
"from_port": 0,
|
||||
"to": "colorize",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Occlusion",
|
||||
"longdesc": "Generates an ambient occlusion map from a height map",
|
||||
"name": "occlusion2",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -522.866638,
|
||||
"y": -383.867035
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 20,
|
||||
"param2": 1.5,
|
||||
"param3": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Resolution",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur",
|
||||
"widget": "param0"
|
||||
}
|
||||
],
|
||||
"longdesc": "The resolution of the input height map",
|
||||
"name": "param0",
|
||||
"shortdesc": "Resolution",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Strength",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "_2",
|
||||
"widget": "g"
|
||||
}
|
||||
],
|
||||
"longdesc": "The strength of the occlusion map effect",
|
||||
"name": "param2",
|
||||
"shortdesc": "Strength",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Radius",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur",
|
||||
"widget": "param1"
|
||||
}
|
||||
],
|
||||
"longdesc": "The radius of the blur used for the occlusion effect",
|
||||
"name": "param1",
|
||||
"shortdesc": "Radius",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Quality",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur",
|
||||
"widget": "param2"
|
||||
}
|
||||
],
|
||||
"longdesc": "The quality of the blur operation used for the occlusion effect",
|
||||
"name": "param3",
|
||||
"shortdesc": "Quality",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -842.266602,
|
||||
"y": -108.396729
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The input heightmap",
|
||||
"name": "port0",
|
||||
"shortdesc": "Input",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 77.5476,
|
||||
"y": -86.015305
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"longdesc": "The generated occlusion map",
|
||||
"name": "port0",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "blend",
|
||||
"node_position": {
|
||||
"x": -422.79895,
|
||||
"y": 11.18788
|
||||
},
|
||||
"parameters": {
|
||||
"amount": 1,
|
||||
"blend_type": 11
|
||||
},
|
||||
"type": "blend"
|
||||
},
|
||||
{
|
||||
"name": "colorize",
|
||||
"node_position": {
|
||||
"x": -124.598953,
|
||||
"y": -131.660126
|
||||
},
|
||||
"parameters": {
|
||||
"gradient": {
|
||||
"interpolation": 1,
|
||||
"points": [
|
||||
{
|
||||
"a": 1,
|
||||
"b": 1,
|
||||
"g": 1,
|
||||
"pos": 0,
|
||||
"r": 1
|
||||
},
|
||||
{
|
||||
"a": 1,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"pos": 1,
|
||||
"r": 0
|
||||
}
|
||||
],
|
||||
"type": "Gradient"
|
||||
}
|
||||
},
|
||||
"seed_value": 33856,
|
||||
"type": "colorize"
|
||||
},
|
||||
{
|
||||
"name": "_2",
|
||||
"node_position": {
|
||||
"x": -104.603699,
|
||||
"y": -57.918201
|
||||
},
|
||||
"parameters": {
|
||||
"g": 1.5
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "0.0",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "pow($in(fract($uv)), $g)",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"name": "g",
|
||||
"step": 0.1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"connections": [
|
||||
{
|
||||
"from": "buffer_2",
|
||||
"from_port": 0,
|
||||
"to": "fast_blur_shader",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "gen_inputs",
|
||||
"from_port": 0,
|
||||
"to": "buffer_2",
|
||||
"to_port": 0
|
||||
},
|
||||
{
|
||||
"from": "fast_blur_shader",
|
||||
"from_port": 0,
|
||||
"to": "gen_outputs",
|
||||
"to_port": 0
|
||||
}
|
||||
],
|
||||
"label": "Fast Blur",
|
||||
"longdesc": "",
|
||||
"name": "fast_blur",
|
||||
"node_position": {
|
||||
"x": -435.552002,
|
||||
"y": -135.436234
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"name": "fast_blur_shader",
|
||||
"node_position": {
|
||||
"x": -161.600006,
|
||||
"y": 143.188766
|
||||
},
|
||||
"parameters": {
|
||||
"quality": 1,
|
||||
"sigma": 20
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(1.0)",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "vec4 $(name)_blur(vec2 uv, vec2 scale, float sigma, int quality) {\n vec4 O = vec4(0.0);\n\tfloat samples = sigma * 4.0; \n\tint LOD = max(0, int(log2(float(samples)))-quality-2);\n\tint sLOD = 1 << LOD;\n int s = max(1, int(samples/float(sLOD)));\n\tfloat sum = 0.0;\n for (int i = 0; i < s*s; i++) {\n vec2 d = vec2(float(i%s), float(i/s))*float(sLOD) - 0.5*float(samples);\n\t\tvec2 dd = d / sigma;\n\t\tfloat g = exp(-.5*dot(dd,dd))/(6.28*sigma*sigma);\n O += g * textureLod($in.texture, uv + scale * d, float(LOD));\n\t\tsum += g;\n }\n \n return O / sum;\n}\n",
|
||||
"name": "Fast Blur",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$(name)_blur($uv, vec2(1.0)/$in.size, max(1.0, floor($sigma*$in.size/2048.0)), int($quality))",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "sigma",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "",
|
||||
"max": 3,
|
||||
"min": 0,
|
||||
"name": "quality",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
},
|
||||
{
|
||||
"name": "buffer_2",
|
||||
"node_position": {
|
||||
"x": -187,
|
||||
"y": 61.5
|
||||
},
|
||||
"parameters": {
|
||||
"size": 11
|
||||
},
|
||||
"type": "buffer",
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"name": "gen_inputs",
|
||||
"node_position": {
|
||||
"x": -602,
|
||||
"y": 91.75
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "port0",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_outputs",
|
||||
"node_position": {
|
||||
"x": 88,
|
||||
"y": 61.75
|
||||
},
|
||||
"parameters": {
|
||||
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"group_size": 0,
|
||||
"name": "port0",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"type": "ios"
|
||||
},
|
||||
{
|
||||
"name": "gen_parameters",
|
||||
"node_position": {
|
||||
"x": -254.5,
|
||||
"y": -122.5
|
||||
},
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 20,
|
||||
"param2": 1
|
||||
},
|
||||
"type": "remote",
|
||||
"widgets": [
|
||||
{
|
||||
"label": "Resolution",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "buffer_2",
|
||||
"widget": "size"
|
||||
}
|
||||
],
|
||||
"name": "param0",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Sigma",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur_shader",
|
||||
"widget": "sigma"
|
||||
}
|
||||
],
|
||||
"name": "param1",
|
||||
"type": "linked_control"
|
||||
},
|
||||
{
|
||||
"label": "Quality",
|
||||
"linked_widgets": [
|
||||
{
|
||||
"node": "fast_blur_shader",
|
||||
"widget": "quality"
|
||||
}
|
||||
],
|
||||
"name": "param2",
|
||||
"type": "linked_control"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 20,
|
||||
"param2": 1
|
||||
},
|
||||
"shortdesc": "",
|
||||
"type": "graph"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"param0": 11,
|
||||
"param1": 20,
|
||||
"param2": 1.5,
|
||||
"param3": 1
|
||||
},
|
||||
"shortdesc": "Occlusion",
|
||||
"type": "graph"
|
||||
}
|
50
game/addons/mat_maker_gd/material_maker_nodes/optional.mmg
Normal file
50
game/addons/mat_maker_gd/material_maker_nodes/optional.mmg
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "optional",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"d": {
|
||||
"a": 0,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"r": 0,
|
||||
"type": "Color"
|
||||
}
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "$d",
|
||||
"label": "",
|
||||
"name": "in",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"name": "Optional",
|
||||
"outputs": [
|
||||
{
|
||||
"rgba": "$in($uv)",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"a": 0,
|
||||
"b": 0,
|
||||
"g": 0,
|
||||
"r": 0
|
||||
},
|
||||
"label": "",
|
||||
"name": "d",
|
||||
"type": "color"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
160
game/addons/mat_maker_gd/material_maker_nodes/pattern.mmg
Normal file
160
game/addons/mat_maker_gd/material_maker_nodes/pattern.mmg
Normal file
@ -0,0 +1,160 @@
|
||||
{
|
||||
"name": "pattern",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"mix": 0,
|
||||
"x_scale": 4,
|
||||
"x_wave": 0,
|
||||
"y_scale": 4,
|
||||
"y_wave": 0
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float wave_constant(float x) {\n\treturn 1.0;\n}\n\nfloat wave_sine(float x) {\n\treturn 0.5-0.5*cos(3.14159265359*2.0*x);\n}\n\nfloat wave_triangle(float x) {\n\tx = fract(x);\n\treturn min(2.0*x, 2.0-2.0*x);\n}\n\nfloat wave_sawtooth(float x) {\n\treturn fract(x);\n}\n\nfloat wave_square(float x) {\n\treturn (fract(x) < 0.5) ? 0.0 : 1.0;\n}\n\nfloat wave_bounce(float x) {\n\tx = 2.0*(fract(x)-0.5);\n\treturn sqrt(1.0-x*x);\n}\n\nfloat mix_mul(float x, float y) {\n\treturn x*y;\n}\n\nfloat mix_add(float x, float y) {\n\treturn min(x+y, 1.0);\n}\n\nfloat mix_max(float x, float y) {\n\treturn max(x, y);\n}\n\nfloat mix_min(float x, float y) {\n\treturn min(x, y);\n}\n\nfloat mix_xor(float x, float y) {\n\treturn min(x+y, 2.0-x-y);\n}\n\nfloat mix_pow(float x, float y) {\n\treturn pow(x, y);\n}",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "float $(name)_fct(vec2 uv) {\n\treturn mix_$(mix)(wave_$(x_wave)($(x_scale)*uv.x), wave_$(y_wave)($(y_scale)*uv.y));\n}",
|
||||
"name": "Pattern",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "$(name)_fct($(uv))",
|
||||
"longdesc": "A greyscale image that combines the horizontal and vertical patterns",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": 0,
|
||||
"label": "Combiner",
|
||||
"longdesc": "The operation used to combine the horizontal and the vertical patterns",
|
||||
"name": "mix",
|
||||
"shortdesc": "Combine",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Multiply",
|
||||
"value": "mul"
|
||||
},
|
||||
{
|
||||
"name": "Add",
|
||||
"value": "add"
|
||||
},
|
||||
{
|
||||
"name": "Max",
|
||||
"value": "max"
|
||||
},
|
||||
{
|
||||
"name": "Min",
|
||||
"value": "min"
|
||||
},
|
||||
{
|
||||
"name": "Xor",
|
||||
"value": "xor"
|
||||
},
|
||||
{
|
||||
"name": "Pow",
|
||||
"value": "pow"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": 5,
|
||||
"label": "X",
|
||||
"longdesc": "Pattern generated along the X axis",
|
||||
"name": "x_wave",
|
||||
"shortdesc": "X Pattern",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Sine",
|
||||
"value": "sine"
|
||||
},
|
||||
{
|
||||
"name": "Triangle",
|
||||
"value": "triangle"
|
||||
},
|
||||
{
|
||||
"name": "Square",
|
||||
"value": "square"
|
||||
},
|
||||
{
|
||||
"name": "Sawtooth",
|
||||
"value": "sawtooth"
|
||||
},
|
||||
{
|
||||
"name": "Constant",
|
||||
"value": "constant"
|
||||
},
|
||||
{
|
||||
"name": "Bounce",
|
||||
"value": "bounce"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "2:",
|
||||
"longdesc": "Repetitions of the pattern along X axis",
|
||||
"max": 32,
|
||||
"min": 0,
|
||||
"name": "x_scale",
|
||||
"shortdesc": "X Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": 5,
|
||||
"label": "Y",
|
||||
"longdesc": "Pattern generated along the Y axis",
|
||||
"name": "y_wave",
|
||||
"shortdesc": "Y Pattern",
|
||||
"type": "enum",
|
||||
"values": [
|
||||
{
|
||||
"name": "Sine",
|
||||
"value": "sine"
|
||||
},
|
||||
{
|
||||
"name": "Triangle",
|
||||
"value": "triangle"
|
||||
},
|
||||
{
|
||||
"name": "Square",
|
||||
"value": "square"
|
||||
},
|
||||
{
|
||||
"name": "Sawtooth",
|
||||
"value": "sawtooth"
|
||||
},
|
||||
{
|
||||
"name": "Constant",
|
||||
"value": "constant"
|
||||
},
|
||||
{
|
||||
"name": "Bounce",
|
||||
"value": "bounce"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "3:",
|
||||
"longdesc": "Repetitions of the pattern along Y axis",
|
||||
"max": 32,
|
||||
"min": 0,
|
||||
"name": "y_scale",
|
||||
"shortdesc": "Y Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
83
game/addons/mat_maker_gd/material_maker_nodes/perlin.mmg
Normal file
83
game/addons/mat_maker_gd/material_maker_nodes/perlin.mmg
Normal file
@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "perlin",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"iterations": 3,
|
||||
"persistence": 0.5,
|
||||
"scale_x": 4,
|
||||
"scale_y": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "float perlin(vec2 uv, vec2 size, int iterations, float persistence, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n float rv = 0.0;\n float coef = 1.0;\n float acc = 0.0;\n for (int i = 0; i < iterations; ++i) {\n \tvec2 step = vec2(1.0)/size;\n\t\tvec2 xy = floor(uv*size);\n float f0 = rand(seed2+mod(xy, size));\n float f1 = rand(seed2+mod(xy+vec2(1.0, 0.0), size));\n float f2 = rand(seed2+mod(xy+vec2(0.0, 1.0), size));\n float f3 = rand(seed2+mod(xy+vec2(1.0, 1.0), size));\n vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));\n rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);\n acc += coef;\n size *= 2.0;\n coef *= persistence;\n }\n \n return rv / acc;\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates several octaves of greyscale value noise",
|
||||
"name": "Value Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"f": "perlin($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))",
|
||||
"longdesc": "Shows a greyscale value noise",
|
||||
"shortdesc": "Output",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale along the X axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale along the Y axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "Iterations",
|
||||
"longdesc": "The number of octaves (higher values might affect performance)",
|
||||
"max": 10,
|
||||
"min": 1,
|
||||
"name": "iterations",
|
||||
"shortdesc": "Octaves",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Persistence",
|
||||
"longdesc": "The persistence between two consecutive octaves",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "persistence",
|
||||
"shortdesc": "Persistence",
|
||||
"step": 0.05,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Value Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
{
|
||||
"name": "perlin_color",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"iterations": 3,
|
||||
"persistence": 0.5,
|
||||
"scale_x": 4,
|
||||
"scale_y": 4
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec3 perlin_color(vec2 uv, vec2 size, int iterations, float persistence, float seed) {\n\tvec2 seed2 = rand2(vec2(seed, 1.0-seed));\n vec3 rv = vec3(0.0);\n float coef = 1.0;\n float acc = 0.0;\n for (int i = 0; i < iterations; ++i) {\n \tvec2 step = vec2(1.0)/size;\n\t\tvec2 xy = floor(uv*size);\n vec3 f0 = rand3(seed2+mod(xy, size));\n vec3 f1 = rand3(seed2+mod(xy+vec2(1.0, 0.0), size));\n vec3 f2 = rand3(seed2+mod(xy+vec2(0.0, 1.0), size));\n vec3 f3 = rand3(seed2+mod(xy+vec2(1.0, 1.0), size));\n vec2 mixval = smoothstep(0.0, 1.0, fract(uv*size));\n rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);\n acc += coef;\n size *= 2.0;\n coef *= persistence;\n }\n \n return rv / acc;\n}\n",
|
||||
"inputs": [
|
||||
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Generates several octaves of color value noise",
|
||||
"name": "Color Value Noise",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "Shows a color value noise",
|
||||
"rgb": "perlin_color($(uv), vec2($(scale_x), $(scale_y)), int($(iterations)), $(persistence), $(seed))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale X",
|
||||
"longdesc": "The scale along the X axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_x",
|
||||
"shortdesc": "Scale.x",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Scale Y",
|
||||
"longdesc": "The scale along the Y axis",
|
||||
"max": 32,
|
||||
"min": 1,
|
||||
"name": "scale_y",
|
||||
"shortdesc": "Scale.y",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 3,
|
||||
"label": "Iterations",
|
||||
"longdesc": "The number of octaves (higher values might affect performance)",
|
||||
"max": 10,
|
||||
"min": 1,
|
||||
"name": "iterations",
|
||||
"shortdesc": "Octaves",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Persistence",
|
||||
"longdesc": "The persistence between two consecutive octaves",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "persistence",
|
||||
"shortdesc": "Persistence",
|
||||
"step": 0.05,
|
||||
"type": "float"
|
||||
}
|
||||
],
|
||||
"shortdesc": "Color Value Noise"
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
89
game/addons/mat_maker_gd/material_maker_nodes/pixelize.mmg
Normal file
89
game/addons/mat_maker_gd/material_maker_nodes/pixelize.mmg
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"name": "pixelize",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"c": 8,
|
||||
"d": 0.5,
|
||||
"x": 16,
|
||||
"y": 16
|
||||
},
|
||||
"shader_model": {
|
||||
"code": "vec2 $(name_uv)_uv = floor(($uv*vec2($x, $y)))+vec2(0.5);\nvec3 $(name_uv)_dither = fract(vec3(dot(vec2(171.0, 231.0), $(name_uv)_uv))/vec3(103.0, 71.0, 97.0));\n",
|
||||
"global": "",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec3(1.0)",
|
||||
"label": "",
|
||||
"longdesc": "The image to be pixelated",
|
||||
"name": "i",
|
||||
"shortdesc": "Input",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"instance": "",
|
||||
"longdesc": "Creates a pixelated image from its input, and also quantifies the colors with optional dithering.",
|
||||
"name": "Pixelize",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "A pixelated version of the input image",
|
||||
"rgb": "floor($i($(name_uv)_uv/vec2($x, $y))*$c+$d*($(name_uv)_dither-vec3(0.5)))/$c",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgb"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Columns:",
|
||||
"longdesc": "Number of pixel columns of the output",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "x",
|
||||
"shortdesc": "Columns",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Rows:",
|
||||
"longdesc": "Number of pixel rows of the output",
|
||||
"max": 256,
|
||||
"min": 1,
|
||||
"name": "y",
|
||||
"shortdesc": "Rows",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 4,
|
||||
"label": "Levels:",
|
||||
"longdesc": "Number of color levels for each channel",
|
||||
"max": 32,
|
||||
"min": 2,
|
||||
"name": "c",
|
||||
"shortdesc": "Levels",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.5,
|
||||
"label": "Dither:",
|
||||
"longdesc": "Amount of dithering in the output image",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"name": "d",
|
||||
"shortdesc": "Dithering",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
137
game/addons/mat_maker_gd/material_maker_nodes/polycurve.mmg
Normal file
137
game/addons/mat_maker_gd/material_maker_nodes/polycurve.mmg
Normal file
@ -0,0 +1,137 @@
|
||||
{
|
||||
"name": "polycurve",
|
||||
"node_position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"parameters": {
|
||||
"curve": {
|
||||
"points": [
|
||||
{
|
||||
"x": 0.771812,
|
||||
"y": 0.319911
|
||||
},
|
||||
{
|
||||
"x": 0.838926,
|
||||
"y": 0.550335
|
||||
},
|
||||
{
|
||||
"x": 0.624161,
|
||||
"y": 0.888143
|
||||
},
|
||||
{
|
||||
"x": 0.288591,
|
||||
"y": 0.856823
|
||||
},
|
||||
{
|
||||
"x": 0.0783,
|
||||
"y": 0.615213
|
||||
},
|
||||
{
|
||||
"x": 0.114094,
|
||||
"y": 0.346757
|
||||
},
|
||||
{
|
||||
"x": 0.362416,
|
||||
"y": 0.185682
|
||||
}
|
||||
],
|
||||
"type": "Polygon"
|
||||
},
|
||||
"ends": true,
|
||||
"repeat": 3,
|
||||
"width": 0.2
|
||||
},
|
||||
"seed": 0,
|
||||
"seed_locked": false,
|
||||
"shader_model": {
|
||||
"code": "",
|
||||
"global": "vec2 curve(float t, vec2 a, vec2 b, vec2 c, vec2 d) {\n vec2 bc = c-b;\n vec2 da = a-d;\n return (b+0.5*t*(bc+b-a+t*(a-b+bc+t*3.0*(bc*3.0+da+t*5.0/3.0*(-bc*3.0-da+t*0.4*(bc*3.0+da))))));\n}\n\nvec2 dcurve(float t, vec2 a, vec2 b, vec2 c, vec2 d) {\n\treturn (curve(t+0.0001, a, b, c, d)-curve(t, a, b, c, d))/0.0001;\n}\nvec2 solve_cubic(vec2 uv, vec2 a, vec2 b, vec2 c, vec2 d) {\n\tfloat t = 0.5;\n\tvec2 pos, dv;\n\tfloat current_sign = 0.0;\n\tfloat dt = 1.0;\n\tfor (int i = 0; i < 20; ++i) {\n\t\tpos = curve(t, a, b, c, d);\n\t\tdv = dcurve(t, a, b, c, d);\n\t\tfloat new_sign = sign(dot(normalize(uv - pos), dv));\n\t\tif (new_sign != current_sign) {\n\t\t\tcurrent_sign = new_sign;\n\t\t\tdt *= 0.5;\n\t\t}\n t += dt*current_sign;\n\t}\n t = clamp(t, 0.0, 1.0);\n\treturn vec2(t, length(uv-curve(t, a, b, c, d)));\n}\n",
|
||||
"inputs": [
|
||||
{
|
||||
"default": "vec4(vec3(step(abs($uv.y-0.5), 0.4999)), 1.0)",
|
||||
"label": "",
|
||||
"longdesc": "Input pattern to be drawn along the curve",
|
||||
"name": "in",
|
||||
"shortdesc": "Pattern",
|
||||
"type": "rgba"
|
||||
},
|
||||
{
|
||||
"default": "1.0",
|
||||
"function": true,
|
||||
"label": "",
|
||||
"longdesc": "A map that describes the width along the curve (use a Tonality node)",
|
||||
"name": "width_map",
|
||||
"shortdesc": "Width map",
|
||||
"type": "f"
|
||||
}
|
||||
],
|
||||
"instance": "vec2 bezier_uv_$name(vec2 uv, bool ends) {\t\n\tvec2 v[] = $curve;\n\tint l = v.length();\n\tvec2 best_bezier;\n\tif (ends) {\n\t\tbest_bezier = solve_cubic(uv, v[0], v[0], v[1], v[2]);\n\t} else {\n\t\tbest_bezier = vec2(0.0, 10000.0);\n\t}\n\tfloat offset = 0.0;\n\tint i;\n\tfor (i = 0; i < l-3; i++) {\n\t\tvec2 bezier = solve_cubic(uv, v[i], v[i+1], v[i+2], v[i+3]);\n\t\tif (abs(bezier.y) < abs(best_bezier).y) {\n\t\t\tbest_bezier = bezier;\n\t\t\toffset = float(i)+1.0;\n\t\t}\n\t}\n\tfloat width;\n\tif (ends) {\n\t\tvec2 bezier = solve_cubic(uv, v[i], v[i+1], v[i+2], v[i+2]);\n\t\tif (abs(bezier.y) < abs(best_bezier).y) {\n\t\t\tbest_bezier = bezier;\n\t\t\toffset = float(i)+1.0;\n\t\t}\n\t\twidth = $width*$width_map(vec2((best_bezier.x+offset)/float(l-1), 0.0));\n\t} else {\n\t\twidth = $width*$width_map(vec2((best_bezier.x+offset-1.0)/float(l-3), 0.0));\n\t}\n\tvec2 local_uv = vec2(best_bezier.x, best_bezier.y/width+0.5);\n\tvec2 uvtest = step(vec2(0.5), abs(local_uv-vec2(0.5)));\n\treturn mix(vec2(fract($repeat*local_uv.x), local_uv.y), vec2(0.0), max(uvtest.x, uvtest.y));\n}",
|
||||
"name": "PolyCurve",
|
||||
"outputs": [
|
||||
{
|
||||
"longdesc": "An image showing the specified curve",
|
||||
"rgba": "$in(bezier_uv_$name($uv, $ends))",
|
||||
"shortdesc": "Output",
|
||||
"type": "rgba"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"default": {
|
||||
"points": [
|
||||
{
|
||||
"x": 0.2,
|
||||
"y": 0.2
|
||||
},
|
||||
{
|
||||
"x": 0.7,
|
||||
"y": 0.4
|
||||
},
|
||||
{
|
||||
"x": 0.4,
|
||||
"y": 0.7
|
||||
}
|
||||
],
|
||||
"type": "Polygon"
|
||||
},
|
||||
"label": "",
|
||||
"name": "curve",
|
||||
"type": "polyline"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 0.1,
|
||||
"label": "Width",
|
||||
"longdesc": "Width of the curve pattern",
|
||||
"max": 0.5,
|
||||
"min": 0,
|
||||
"name": "width",
|
||||
"shortdesc": "Width",
|
||||
"step": 0.01,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"control": "None",
|
||||
"default": 1,
|
||||
"label": "Repeat",
|
||||
"longdesc": "Number of repetitions of the input pattern",
|
||||
"max": 16,
|
||||
"min": 1,
|
||||
"name": "repeat",
|
||||
"shortdesc": "Repeat",
|
||||
"step": 1,
|
||||
"type": "float"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"label": "Ends",
|
||||
"longdesc": "If unset, end vertices of the curve are used only for orientation",
|
||||
"name": "ends",
|
||||
"shortdesc": "Ends",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "shader"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
uniform float variation = 0.0;
|
||||
|
||||
vec4 preview_2d(vec2 uv) {
|
||||
float _seed_variation_ = variation;
|
||||
$(code)
|
||||
return vec4(vec3($(value)), 1.0);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
uniform float variation = 0.0;
|
||||
|
||||
vec4 preview_2d(vec2 uv) {
|
||||
float _seed_variation_ = variation;
|
||||
$(code)
|
||||
return vec4($(value), 1.0);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user