mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-27 23:17:14 +01:00
7033bf4a6e
* updated transform node (scale split into scale_x and scale_y, and added a repeat parameter) * added blend modes (burn, dodge, lighten and darken) * added a (very bad) blur node, based on generic convolution code * rewrote normal_map node using convolution code
29 lines
817 B
GDScript
29 lines
817 B
GDScript
tool
|
|
extends "res://addons/procedural_material/node_base.gd"
|
|
|
|
var amount = 0.0
|
|
|
|
const CONVOLUTION = {
|
|
kernel=[
|
|
0, 0, 0, 0, 0,
|
|
0, Vector3(-1, -1, 0), Vector3(0, -2, 0), Vector3(1, -1, 0), 0,
|
|
0, Vector3(-2, 0, 0), 0, Vector3(2, 0, 0), 0,
|
|
0, Vector3(-1, 1, 0), Vector3(0, 2, 0), Vector3(1, 1, 0), 0,
|
|
0, 0, 0, 0, 0
|
|
],
|
|
epsilon=0.005,
|
|
normalize=true,
|
|
translate_before_normalize=Vector3(0.0, 0.0, -1.0),
|
|
scale_before_normalize=0.5,
|
|
translate=Vector3(0.5, 0.5, 0.5),
|
|
scale=0.5
|
|
}
|
|
|
|
func _ready():
|
|
initialize_properties([ $amount ])
|
|
|
|
func _get_shader_code(uv):
|
|
var convolution = CONVOLUTION
|
|
convolution.scale_before_normalize = amount
|
|
return get_shader_code_convolution(convolution, uv)
|