Merge pull request #62 from RodZill4/dev-new-nodes

New nodes:
* workflow nodes to create complex materials by combining simple ones
* beehive, generic truchet
* 3D box and sphere (not raymarching based)
* greyscale

New node templates:
* (3) edge detect
* sharpen
* swap channels
This commit is contained in:
Rodz Labs 2020-01-16 23:01:00 +01:00 committed by GitHub
commit 652463e1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 10333 additions and 3576 deletions

View File

@ -13,4 +13,5 @@ to describe procedural materials.
nodes_noise
nodes_filter
nodes_transform
nodes_workflow
nodes_miscellaneous

View File

@ -20,11 +20,11 @@
# -- Project information -----------------------------------------------------
project = 'Material Maker'
copyright = '2018, Rodz Labs'
copyright = '2018-2020, Rodz Labs'
author = 'Rodz Labs'
# The short X.Y version
version = '0.7'
version = '0.8'
# The full version, including alpha/beta/rc tags
release = ''

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -0,0 +1,33 @@
Box node
~~~~~~~~
The **Box** node outputs a greyscale image that represents the depth of a 3D box.
.. image:: images/node_3d_box.png
:align: center
Inputs
++++++
The **Box** node do not accept any input.
Outputs
+++++++
The **Box** node provides an output that generates a greyscale image showing the
selected 3D box.
Parameters
++++++++++
The **Box** node has the following parameters:
* the *box center position* as X, Y and Z coordinates
* the *box size* along X, Y and Z axes
* the *rotation of the box* around X, Y and Z axes
Example images
++++++++++++++
.. image:: images/node_3d_box_samples.png
:align: center

View File

@ -51,6 +51,7 @@ Operators
node_3d_sdf_operators_circlerepeat
node_3d_sdf_operators_extrusion
node_3d_sdf_operators_revolution
node_3d_sdf_operators_morph
Transforms
++++++++++

View File

@ -0,0 +1,30 @@
Morph node
..........
The **Morph** node generates a 3D signed distance function obtained by mixing two input
3D signed distance functions.
.. image:: images/node_sdf3d_morph.png
:align: center
Inputs
::::::
The **Morph** node accepts 2 inputs in 3D signed distance function format.
Outputs
:::::::
The **Morph** node generates a signed distance function of the
combination of its inputs.
Parameters
::::::::::
The **Morph** node accepts *the mix factor* as parameter.
Example images
::::::::::::::
.. image:: images/node_sdf3d_morph_sample.png
:align: center

View File

@ -1,28 +1,28 @@
Capsule node
Cone node
............
The **Capsule** node generates a 3d signed distance function for a capsule.
The **Cone** node generates a 3d signed distance function for an infinite cone.
.. image:: images/node_sdf3d_capsule.png
.. image:: images/node_sdf3d_cone.png
:align: center
Inputs
::::::
The **Capsule** node does not accept any input.
The **Cone** node does not accept any input.
Outputs
:::::::
The **Capsule** node generates a signed distance function for a capsule.
The **Cone** node generates a signed distance function for a cone.
Parameters
::::::::::
The **Capsule** node accepts as parameters the length of the capsule and its radius.
The **Cone** node accepts as parameters the *angle* of the cone.
Example images
::::::::::::::
.. image:: images/node_sdf3d_capsule_sample.png
.. image:: images/node_sdf3d_cone_sample.png
:align: center

View File

@ -0,0 +1,30 @@
Sphere node
~~~~~~~~~~~
The **Sphere** node outputs a greyscale image that represents the depth of a 3D sphere.
.. image:: images/node_3d_sphere.png
:align: center
Inputs
++++++
The **Sphere** node do not accept any input.
Outputs
+++++++
The **Sphere** node provides an output that generates a greyscale image showing the
selected 3D sphere.
Parameters
++++++++++
The **Sphere** node accepts the *sphere center position* as X and Y coordinates
and its *radius* as parameters.
Example images
++++++++++++++
.. image:: images/node_3d_sphere_samples.png
:align: center

View File

@ -0,0 +1,29 @@
Greyscale node
~~~~~~~~~~~~~~
The **Greyscale** node converts a color image into greyscale.
.. image:: images/node_greyscale.png
:align: center
Inputs
++++++
The **Greyscale** node requires a color input texture.
Outputs
+++++++
The **Greyscale** node provides a single greyscale texture.
Parameters
++++++++++
The **Greyscale** node accepts the *conversion algorithm* (*lightness*, *average*,
*luminosity*, *min* or *max*) as parameter.
Example images
++++++++++++++
.. image:: images/node_greyscale_samples.png
:align: center

View File

@ -23,6 +23,12 @@ The **Bricks** node provides the following textures:
* The 3rd and 4th textures are greyscale images of the X and Y position of the center of
each brick.
* The 5th texture is an UV map texture for each brick (and can be used with the **CustomUV**
node to apply a texture on each brick)
* the 6th texture is an UV map for each corner of each brick (and can be used with the
**CustomUV** node to apply a texture on each corner)
Those images can be used together to create complex materials that show for example bricks
of different colors.
@ -47,6 +53,10 @@ The **Bricks** node accepts the following parameters:
* the *Bevel* parameter defines the relative thickness of brick bevel in patterns.
* the *Round* parameter defines the radius of each round corner.
* the *Corner* parameter defines the size of each corner (for the 6th output texture).
Notes
+++++

View File

@ -16,6 +16,11 @@ All Signed Distance Functions nodes are based on code written by Inigo Quilez th
__ sdf2dpage_
.. toctree::
:maxdepth: 1
node_simple_sdf_operators_sdshow
Shapes
++++++
@ -37,7 +42,7 @@ Operators
node_simple_sdf_operators_sdsmoothboolean
node_simple_sdf_operators_sdroundedshape
node_simple_sdf_operators_sdannularshape
node_simple_sdf_operators_sdshow
node_simple_sdf_operators_sdmorph
Example images
++++++++++++++

View File

@ -0,0 +1,30 @@
sdMorph node
............
The **sdMorph** node generates a signed distance image obtained by mixing two input
2D signed distance functions.
.. image:: images/node_sdmorph.png
:align: center
Inputs
::::::
The **sdMorph** node accepts 2 inputs in signed distance function format.
Outputs
:::::::
The **sdMorph** node generates a signed distance function of the
combination of its inputs.
Parameters
::::::::::
The **sdMorph** node accepts accepts *the mix factor* as parameter.
Example images
::::::::::::::
.. image:: images/node_sdmorph_sample.png
:align: center

View File

@ -0,0 +1,26 @@
CustomUV node
~~~~~~~~~~~~~
The **CustomUV** node deforms an input image according to a custom UV map given as input.
.. image:: images/node_customuv.png
Inputs
++++++
The **CustomUV** node accepts two inputs:
* The *Source* inputs is the image to be deformed.
* The *UV* input is a color image whose red and green channels are used as
U and V (X and Y in texture space) coordinates.
Outputs
+++++++
The **CustomUV** node outputs the deformed image.
Parameters
++++++++++
The **CustomUV** node does not have any parameter.

View File

@ -0,0 +1,24 @@
ApplyMap node
~~~~~~~~~~~~~
The **ApplyMap** node applys a map to a simple material by adjusting its orientation and offset,
and outputs the modified map and the height information.
.. image:: images/node_workflow_applymap.png
Inputs
++++++
The **ApplyMap** node accepts a map (generated by the **CreateMap** node) and
the 4 (albedo, ORM, emission and normal) components of a simple material as inputs.
Outputs
+++++++
The **ApplyMap** node outputs the height, albedo, ORM, emission and normal components
of the map.
Parameters
++++++++++
The **ApplyMap** node does not have any parameter.

View File

@ -0,0 +1,36 @@
CreateMap node
~~~~~~~~~~~~~~
The **CreateMap** node creates a map holding height, orientation and offset information
used to combine simple materials.
.. image:: images/node_workflow_createmap.png
Inputs
++++++
The **CreateMap** node accepts two inputs:
* the *height* component as a greyscale image.
* an optional offset map.
Outputs
+++++++
The **CreateMap** node outputs the map in an RGB image where:
* the red component holds the height information
* the green component holds the orientation information
* the blue component holds the offset information
Parameters
++++++++++
The **CreateMap** node has two parameters:
* *height* is the maximum height of the map
* *angle* is the orientation of the map

View File

@ -0,0 +1,23 @@
Mix node
~~~~~~~~
The **Mix** node mixes two applied maps based on the height information.
.. image:: images/node_workflow_mix.png
Inputs
++++++
The **Mix** node accepts the height, albedo, ORM, emission and normal channels of both
applied maps as inputs.
Outputs
+++++++
The **Mix** node outputs the height, albedo, ORM, emission and normal components
of the combined map.
Parameters
++++++++++
The **Mix** node does not have any parameter.

View File

@ -0,0 +1,21 @@
MixMaps node
~~~~~~~~~
The **MixMaps** node combines up to 4 maps holding height, orientation and offset information.
.. image:: images/node_workflow_mixmaps.png
Inputs
++++++
The **MixMaps** node accepts four input maps. Unconnected inputs are ignored.
Outputs
+++++++
The **MixMaps** node outputs the combined map.
Parameters
++++++++++
The **MixMaps** node does not have any parameter.

View File

@ -0,0 +1,30 @@
Output node
~~~~~~~~~~~
The **Output** node converts an applied map into a material. It uses the height to
generate the normal and occlusion maps.
.. image:: images/node_workflow_output.png
Inputs
++++++
The **Output** node accepts accepts the height, albedo, ORM, emission and normal channels
of the applied map inputs.
Outputs
+++++++
The **Output** node outputs the albedo, metallic, roughness, emission, normal, occlusion
and depth components of the material. They should be connected to the **Material** node.
Parameters
++++++++++
The **Output** node accepts the following parameters:
* the amount of occlusion extracted from the height map
* the strength of the normal maps of the base material (when mixed with the
normal map generated from the height map)

View File

@ -6,5 +6,7 @@ The simple nodes are nodes that do not accept any input and generate one or seve
.. toctree::
:maxdepth: 0
node_3d_box
node_3d_sphere
node_3d_sdf

View File

@ -9,6 +9,7 @@ The filter nodes accept one or several inputs and generate one or several images
node_filter_invert
node_filter_brightness_contrast
node_filter_adjust_hsv
node_filter_greyscale
node_filter_colorize
node_filter_combine
node_filter_decompose

View File

@ -10,3 +10,4 @@ The transform nodes are nodes that affect the geometry of their input.
node_transform_kaleidoscope
node_transform_mirror
node_transform_warp
node_transform_customuv

View File

@ -0,0 +1,53 @@
Workflow nodes
--------------
The workflow nodes can be used to organize the generation of complex materials, based
on simple homogeneous materials and maps that describe the overall geometry of the
whole material.
The **CreateMap** node is used to create a map that holds the height, orientation and
offset of the material.
.. image:: images/workflow_map.png
:align: center
The **MixMaps** node can be used to combine maps (based on their
height information) that will be applied to the same material.
.. image:: images/workflow_mixed_maps.png
:align: center
Base (flat) materials consist of albedo, ORM (ambient occlusion, roughness, metallic),
emission and normal channels. A few example materials are provided in the
**Workflow/Materials** section of the library.
.. image:: images/workflow_base_material.png
:align: center
Maps are then applied to base materials using the **ApplyMap** node to generate
new (reoriented and offset) materials (with albedo, ORM, emission and normal) associated
to height information.
.. image:: images/workflow_applied_map.png
:align: center
Different materials with height information can then be mixed based on their height
using the **Mix** node to generate more complex materials.
.. image:: images/workflow_mix.png
:align: center
The result can then be fed into the **Material** node using the **Output** node, that
generates the overall normal and ambient occlusion maps using the height map.
.. image:: images/workflow_final.png
:align: center
.. toctree::
:maxdepth: 1
node_workflow_createmap
node_workflow_mixmaps
node_workflow_applymap
node_workflow_mix
node_workflow_output

View File

@ -169,7 +169,8 @@ func _get_shader_code(uv : String, output_index : int, context : MMGenContext) -
coef_str = "vec3(%.9f, %.9f, %.9f)" % [ coef[0] * sum[0], coef[1] * sum[1], coef[2] * sum[2] ]
"rgba":
coef_str = "vec4(%.9f, %.9f, %.9f, %.9f)" % [ coef[0] * sum[0], coef[1] * sum[1], coef[2] * sum[2], coef[3] * sum[3] ]
rv.code += "%s_%d += %s*%s;\n" % [ genname, variant_index, coef_str, src_code[convolution_params.input_type] ]
if src_code.has(convolution_params.input_type):
rv.code += "%s_%d += %s*%s;\n" % [ genname, variant_index, coef_str, src_code[convolution_params.input_type] ]
for t in src_code.textures.keys():
rv.textures[t] = src_code.textures[t]
rv[convolution_params.output_type] = "%s_%d" % [ genname, variant_index ]
@ -181,4 +182,5 @@ func _serialize(data: Dictionary) -> Dictionary:
return data
func _deserialize(data : Dictionary) -> void:
set_convolution_params(data.convolution_params)
if data.has("convolution_params"):
set_convolution_params(data.convolution_params)

View File

@ -200,7 +200,7 @@ func update_spatial_material(m, file_prefix = null) -> void:
m.ao_enabled = false
# Depth
texture = get_generated_texture("depth", file_prefix)
if texture != null:
if texture != null and parameters.depth_scale > 0:
m.depth_enabled = true
m.depth_deep_parallax = true
m.depth_scale = parameters.depth_scale * 0.2

View File

@ -80,11 +80,15 @@ func get_parameter_defs() -> Array:
for w in widgets:
match w.type:
"config_control":
var p : Dictionary = { name=w.name, label=w.label, type="enum", values=[] }
var p : Dictionary = { name=w.name, label=w.label, type="enum" }
var configurations = w.configurations.keys()
configurations.sort()
for c in configurations:
p.values.push_back({ name=c, value=c })
if configurations == [ "False", "True" ]:
p.type = "boolean"
else:
p.values=[]
for c in configurations:
p.values.push_back({ name=c, value=c })
rv.append(p)
i += 1
"linked_control":
@ -119,6 +123,8 @@ func set_parameter(p : String, v) -> void:
if node != null:
node.set_parameter(w.widget, v)
"config_control":
if v is bool:
v = 1 if v else 0
if v < widget.configurations.size():
var configurations = widget.configurations.keys()
configurations.sort()

View File

@ -0,0 +1,641 @@
{
"connections": [
{
"from": "graph",
"from_port": 0,
"to": "Material",
"to_port": 4
},
{
"from": "graph",
"from_port": 2,
"to": "Material",
"to_port": 6
},
{
"from": "graph",
"from_port": 1,
"to": "Material",
"to_port": 5
},
{
"from": "transform",
"from_port": 0,
"to": "blend",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "graph",
"to_port": 0
},
{
"from": "graph",
"from_port": 0,
"to": "edge_detect_1",
"to_port": 0
},
{
"from": "edge_detect_1",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "colorize",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{
"from": "box",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"from": "sphere",
"from_port": 0,
"to": "transform",
"to_port": 0
}
],
"label": "Graph",
"name": "49",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"name": "Material",
"node_position": {
"x": -165,
"y": 7
},
"parameters": {
"albedo_color": {
"a": 1,
"b": 1,
"g": 1,
"r": 1,
"type": "Color"
},
"ao_light_affect": 1,
"depth_scale": 1,
"emission_energy": 1,
"metallic": 1,
"normal_scale": 1,
"roughness": 1,
"size": 11,
"subsurf_scatter_strength": 0
},
"type": "material"
},
{
"name": "transform",
"node_position": {
"x": -997.5,
"y": -141
},
"parameters": {
"repeat": true,
"rotate": 0,
"scale_x": 0.5,
"scale_y": 0.5,
"translate_x": 0.25,
"translate_y": 0.25
},
"type": "transform"
},
{
"connections": [
{
"from": "normal_map",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "colorize",
"from_port": 0,
"to": "gen_outputs",
"to_port": 2
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "normal_map",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "occlusion",
"to_port": 0
},
{
"from": "occlusion",
"from_port": 0,
"to": "gen_outputs",
"to_port": 1
}
],
"label": "NOD",
"name": "graph",
"node_position": {
"x": -431.27063,
"y": 70.5
},
"nodes": [
{
"connections": [
{
"from": "nm_convolution",
"from_port": 0,
"to": "nm_postprocess",
"to_port": 0
},
{
"from": "nm_postprocess",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "nm_convolution",
"to_port": 0
}
],
"label": "Normal Map",
"name": "normal_map",
"node_position": {
"x": -57.5,
"y": -41
},
"nodes": [
{
"name": "buffer",
"node_position": {
"x": -694.663818,
"y": 98.60614
},
"parameters": {
"lod": 0,
"size": 11
},
"type": "buffer"
},
{
"convolution_params": {
"input_type": "f",
"matrix": [
[
[
-1,
-1,
0
],
[
0,
-2,
0
],
[
1,
-1,
0
]
],
[
[
-2,
0,
0
],
0,
[
2,
0,
0
]
],
[
[
-1,
1,
0
],
[
0,
2,
0
],
[
1,
1,
0
]
]
],
"output_type": "rgb",
"x": 1,
"y": 1
},
"name": "nm_convolution",
"node_position": {
"x": -690.25,
"y": 174.25
},
"parameters": {
"size": 11
},
"type": "convolution"
},
{
"name": "nm_postprocess",
"node_position": {
"x": -690.25,
"y": 222.25
},
"parameters": {
"amount": 2,
"format": 0,
"size": 11,
"type": 0
},
"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": "vec3(0.0)",
"label": "",
"name": "in",
"type": "rgb"
}
],
"instance": "",
"name": "NormalMapPostProcess",
"outputs": [
{
"rgb": "process_normal_$format($in($uv).xyz, $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": 11,
"name": "size",
"type": "size"
},
{
"default": 1,
"label": "",
"max": 2,
"min": 0,
"name": "amount",
"step": 0.005,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "gen_parameters",
"node_position": {
"x": -698.910156,
"y": -42.916687
},
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 2,
"param2": 0,
"size": 4
},
"type": "remote",
"widgets": [
{
"label": "",
"linked_widgets": [
{
"node": "nm_postprocess",
"widget": "format"
}
],
"name": "param2",
"type": "linked_control"
},
{
"label": "",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "nm_convolution",
"widget": "size"
},
{
"node": "nm_postprocess",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "",
"linked_widgets": [
{
"node": "nm_postprocess",
"widget": "amount"
}
],
"name": "param1",
"type": "linked_control"
}
]
},
{
"name": "gen_outputs",
"node_position": {
"x": -407.663818,
"y": 151.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_inputs",
"node_position": {
"x": -870.910156,
"y": 157.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
}
],
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 2,
"param2": 0,
"size": 4
},
"type": "graph"
},
{
"name": "occlusion",
"node_position": {
"x": -81.811829,
"y": 56.5
},
"parameters": {
"param0": 8,
"param1": 50,
"param2": 5
},
"type": "occlusion"
},
{
"name": "colorize",
"node_position": {
"x": -58.5,
"y": 130
},
"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": "gen_inputs",
"node_position": {
"x": -381.811829,
"y": 49.5
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": 244.5,
"y": 49.5
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
},
{
"name": "port2",
"type": "rgba"
},
{
"name": "port1",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_parameters",
"node_position": {
"x": -27.270599,
"y": -117
},
"parameters": {
},
"type": "remote",
"widgets": [
]
}
],
"parameters": {
},
"type": "graph"
},
{
"name": "colorize",
"node_position": {
"x": -486.598755,
"y": -27.262512
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 1,
"g": 1,
"pos": 0,
"r": 1
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0.027273,
"r": 0
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "blend",
"node_position": {
"x": -718.608398,
"y": 67.325012
},
"parameters": {
"amount": 1,
"blend_type": 9
},
"type": "blend"
},
{
"name": "edge_detect_1",
"node_position": {
"x": -497.608398,
"y": -80.674988
},
"parameters": {
"size": 7
},
"type": "edge_detect_1"
},
{
"name": "box",
"node_position": {
"x": -988.422119,
"y": 68.460938
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"cz": 0.5,
"r": 0.5,
"rx": 40,
"ry": 40,
"rz": 90,
"sx": 0.25,
"sy": 0.25,
"sz": 0.25
},
"type": "box"
},
{
"name": "sphere",
"node_position": {
"x": -989.422119,
"y": -246.039063
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"r": 0.5
},
"type": "sphere"
}
],
"parameters": {
},
"type": "graph"
}

View File

@ -0,0 +1,340 @@
{
"connections": [
{
"from": "colorize_2",
"from_port": 0,
"to": "blend",
"to_port": 0
},
{
"from": "colorize",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"from": "normal_map",
"from_port": 0,
"to": "Material",
"to_port": 4
},
{
"from": "blend",
"from_port": 0,
"to": "normal_map",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "colorize_3",
"to_port": 0
},
{
"from": "colorize_3",
"from_port": 0,
"to": "Material",
"to_port": 6
},
{
"from": "uniform_greyscale",
"from_port": 0,
"to": "Material",
"to_port": 1
},
{
"from": "colorize_4",
"from_port": 0,
"to": "Material",
"to_port": 2
},
{
"from": "colorize_5",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "colorize_5",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "colorize_4",
"to_port": 0
},
{
"from": "beehive_2",
"from_port": 0,
"to": "colorize_2",
"to_port": 0
},
{
"from": "beehive_2",
"from_port": 1,
"to": "colorize",
"to_port": 0
}
],
"label": "Graph",
"name": "49",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"name": "Material",
"node_position": {
"x": 134,
"y": -22
},
"parameters": {
"albedo_color": {
"a": 1,
"b": 1,
"g": 1,
"r": 1,
"type": "Color"
},
"ao_light_affect": 1,
"depth_scale": 0.2,
"emission_energy": 1,
"metallic": 1,
"normal_scale": 1,
"roughness": 1,
"size": 11,
"subsurf_scatter_strength": 0
},
"type": "material"
},
{
"name": "colorize",
"node_position": {
"x": -489.5,
"y": 20
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0,
"r": 0
},
{
"a": 1,
"b": 0.225431,
"g": 0.225431,
"pos": 0.583818,
"r": 0.225431
},
{
"a": 1,
"b": 0.96875,
"g": 0.96875,
"pos": 0.672727,
"r": 0.96875
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "colorize_2",
"node_position": {
"x": -493.5,
"y": -42
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 1,
"g": 1,
"pos": 0,
"r": 1
},
{
"a": 1,
"b": 0.947917,
"g": 0.947917,
"pos": 0.049912,
"r": 0.947917
},
{
"a": 1,
"b": 0.115584,
"g": 0.115584,
"pos": 0.106977,
"r": 0.115584
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0.290909,
"r": 0
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "blend",
"node_position": {
"x": -528.009644,
"y": 89
},
"parameters": {
"amount": 1,
"blend_type": 9
},
"type": "blend"
},
{
"name": "normal_map",
"node_position": {
"x": -138.009644,
"y": 78
},
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 1.02,
"param2": 0,
"size": 4
},
"type": "normal_map"
},
{
"name": "colorize_3",
"node_position": {
"x": -132.009644,
"y": 208.5
},
"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": "uniform_greyscale",
"node_position": {
"x": -98.009644,
"y": -64.5
},
"parameters": {
"color": 0.16
},
"type": "uniform_greyscale"
},
{
"name": "colorize_4",
"node_position": {
"x": -153.009644,
"y": 10
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 0.65625,
"g": 0.65625,
"pos": 0.518182,
"r": 0.65625
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0.890909,
"r": 0
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "colorize_5",
"node_position": {
"x": -106.009644,
"y": -151
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 0,
"g": 0.068034,
"pos": 0,
"r": 0.098958
},
{
"a": 1,
"b": 0,
"g": 0.6875,
"pos": 0.881818,
"r": 1
}
],
"type": "Gradient"
}
},
"type": "colorize"
},
{
"name": "beehive_2",
"node_position": {
"x": -496.732483,
"y": -162.254547
},
"parameters": {
"sx": 20,
"sy": 12
},
"type": "beehive"
}
],
"parameters": {
},
"type": "graph"
}

View File

@ -141,11 +141,11 @@
{
"from": "blend_2",
"from_port": 0,
"to": "normal_map",
"to": "normal_map_2",
"to_port": 0
},
{
"from": "normal_map",
"from": "normal_map_2",
"from_port": 0,
"to": "Material",
"to_port": 4
@ -642,9 +642,11 @@
"parameters": {
"bevel": 0.2,
"columns": 2,
"corner": 0,
"mortar": 0.05,
"pattern": 3,
"repeat": 2,
"round": 0,
"row_offset": 0.5,
"rows": 2
},
@ -660,7 +662,9 @@
"intensity": 1,
"randomness": 1,
"scale_x": 8,
"scale_y": 8
"scale_y": 8,
"stretch_x": 1,
"stretch_y": 1
},
"type": "voronoi"
},
@ -977,252 +981,21 @@
"type": "graph"
},
{
"connections": [
{
"from": "nm_convolution",
"from_port": 0,
"to": "nm_postprocess",
"to_port": 0
},
{
"from": "nm_postprocess",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "buffer",
"from_port": 0,
"to": "nm_convolution",
"to_port": 0
}
],
"label": "Normal Map",
"name": "normal_map",
"name": "normal_map_2",
"node_position": {
"x": 960.584229,
"y": 273.420258
"x": 986.357788,
"y": 281.520294
},
"nodes": [
{
"name": "buffer",
"node_position": {
"x": -687.663818,
"y": 125.60614
},
"parameters": {
"lod": 0,
"size": 11
},
"type": "buffer"
},
{
"convolution_params": {
"input_type": "f",
"matrix": [
[
[
-1,
-1,
0
],
[
0,
-2,
0
],
[
1,
-1,
0
]
],
[
[
-2,
0,
0
],
0,
[
2,
0,
0
]
],
[
[
-1,
1,
0
],
[
0,
2,
0
],
[
1,
1,
0
]
]
],
"output_type": "rgb",
"x": 1,
"y": 1
},
"name": "nm_convolution",
"node_position": {
"x": -690.25,
"y": 174.25
},
"parameters": {
"size": 11
},
"type": "convolution"
},
{
"name": "nm_postprocess",
"node_position": {
"x": -690.25,
"y": 222.25
},
"parameters": {
"amount": 0.995,
"size": 11
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "vec3(0.0)",
"label": "",
"name": "in",
"type": "rgb"
}
],
"instance": "",
"name": "NormalMapPostProcess",
"outputs": [
{
"rgb": "0.5*normalize($in($uv)*$amount*vec3(-1.0, 1.0, 1.0)*$size/128.0-vec3(0.0, 0.0, 1.0))+vec3(0.5)",
"type": "rgb"
}
],
"parameters": [
{
"default": 9,
"first": 4,
"label": "",
"last": 11,
"name": "size",
"type": "size"
},
{
"default": 1,
"label": "",
"max": 2,
"min": 0,
"name": "amount",
"step": 0.005,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "gen_parameters",
"node_position": {
"x": -718.910156,
"y": 26.083313
},
"parameters": {
"param0": 11,
"param1": 0.995
},
"type": "remote",
"widgets": [
{
"label": "Size",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "nm_convolution",
"widget": "size"
},
{
"node": "nm_postprocess",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "Amount",
"linked_widgets": [
{
"node": "nm_postprocess",
"widget": "amount"
}
],
"name": "param1",
"type": "linked_control"
}
]
},
{
"name": "gen_outputs",
"node_position": {
"x": -407.663818,
"y": 151.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_inputs",
"node_position": {
"x": -870.910156,
"y": 157.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
}
],
"parameters": {
"amount": 0.5,
"param0": 11,
"param1": 0.995
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 0,
"size": 4
},
"type": "graph"
"type": "normal_map"
}
],
"parameters": {

View File

@ -1,17 +1,5 @@
{
"connections": [
{
"from": "bricks",
"from_port": 0,
"to": "warp",
"to_port": 0
},
{
"from": "perlin",
"from_port": 0,
"to": "warp",
"to_port": 1
},
{
"from": "graph_2",
"from_port": 0,
@ -24,18 +12,6 @@
"to": "blend_2",
"to_port": 1
},
{
"from": "bricks",
"from_port": 0,
"to": "blend",
"to_port": 0
},
{
"from": "warp",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"from": "graph_3",
"from_port": 0,
@ -43,9 +19,9 @@
"to_port": 2
},
{
"from": "graph",
"from": "sdf3d_cylinder",
"from_port": 0,
"to": "Material",
"to": "raymarching",
"to_port": 0
},
{
@ -54,12 +30,6 @@
"to": "graph",
"to_port": 0
},
{
"from": "raymarching_2",
"from_port": 1,
"to": "graph",
"to_port": 1
},
{
"from": "raymarching_2_2",
"from_port": 0,
@ -67,25 +37,61 @@
"to_port": 2
},
{
"from": "raymarching_2_2",
"from_port": 1,
"from": "uniform_greyscale",
"from_port": 0,
"to": "graph",
"to_port": 1
},
{
"from": "uniform_greyscale",
"from_port": 0,
"to": "graph",
"to_port": 3
},
{
"from": "graph_3_2",
"from": "sdf3d_sphere",
"from_port": 0,
"to": "sdf3d_morph",
"to_port": 0
},
{
"from": "sdf3d_box",
"from_port": 0,
"to": "sdf3d_morph",
"to_port": 1
},
{
"from": "sdf3d_sphere",
"from_port": 0,
"to": "raymarching_2",
"to_port": 0
},
{
"from": "graph_4",
"from": "sdf3d_box",
"from_port": 0,
"to": "sdf3d_rotate_2",
"to": "raymarching_2_2",
"to_port": 0
},
{
"from": "sdf3d_rotate_2",
"from": "graph",
"from_port": 0,
"to": "blend",
"to_port": 0
},
{
"from": "raymarching_2_2_2",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"from": "sdf3d_scale_2",
"from_port": 0,
"to": "raymarching_2_2_2",
"to_port": 0
},
{
"from": "sdf3d_morph",
"from_port": 0,
"to": "sdf3d_translate_3_2",
"to_port": 0
@ -93,7 +99,13 @@
{
"from": "sdf3d_translate_3_2",
"from_port": 0,
"to": "raymarching_2_2",
"to": "sdf3d_scale_2",
"to_port": 0
},
{
"from": "blend_2",
"from_port": 0,
"to": "Material",
"to_port": 0
}
],
@ -107,8 +119,8 @@
{
"name": "Material",
"node_position": {
"x": 576.544006,
"y": 29.080002
"x": 501.544006,
"y": 288.080017
},
"parameters": {
"albedo_color": {
@ -124,7 +136,7 @@
"metallic": 1,
"normal_scale": 1,
"roughness": 1,
"size": 8,
"size": 9,
"subsurf_scatter_strength": 0
},
"type": "material"
@ -249,8 +261,8 @@
"label": "Tile Inputs",
"name": "graph",
"node_position": {
"x": 237.541992,
"y": 78.266541
"x": -73.458008,
"y": 146.266541
},
"nodes": [
{
@ -489,12 +501,6 @@
"to": "sdboolean_3",
"to_port": 1
},
{
"from": "sdboolean_3",
"from_port": 0,
"to": "sdshow_2",
"to_port": 0
},
{
"from": "sdboolean_3_2",
"from_port": 0,
@ -513,24 +519,30 @@
"to": "sdboolean_3_2",
"to_port": 0
},
{
"from": "sdshow_2",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "colorize",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
},
{
"from": "sdboolean_3",
"from_port": 0,
"to": "sdshow",
"to_port": 0
},
{
"from": "sdshow",
"from_port": 0,
"to": "colorize",
"to_port": 0
}
],
"label": "Arrow",
"name": "graph_2",
"node_position": {
"x": 206.827515,
"y": 279.753479
"x": 196.827515,
"y": 248.753479
},
"nodes": [
{
@ -540,11 +552,11 @@
"y": 387.121552
},
"parameters": {
"cx": -0.09,
"cx": -0.07,
"cy": 0,
"h": 0.04,
"r": 0.3,
"w": 0.07
"w": 0.08
},
"type": "sdbox"
},
@ -552,10 +564,10 @@
"name": "sdrhombus_2",
"node_position": {
"x": 235.398682,
"y": 251.121552
"y": 252.121552
},
"parameters": {
"cx": -0.1,
"cx": -0.02,
"cy": 0,
"h": 0.12,
"r": 0.3,
@ -566,11 +578,11 @@
{
"name": "sdbox_3_2",
"node_position": {
"x": 238.086548,
"y": 121.972382
"x": 220.086548,
"y": 108.972382
},
"parameters": {
"cx": -0.41,
"cx": -0.23,
"cy": 0,
"h": 0.35,
"r": 0.3,
@ -612,53 +624,6 @@
},
"type": "sdboolean"
},
{
"name": "sdshow_2",
"node_position": {
"x": 602.836609,
"y": 376.603577
},
"parameters": {
"bevel": 0.01,
"cx": 0,
"cy": 0,
"h": 0.08,
"r": 0.3,
"w": 0.28
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "f"
}
],
"instance": "",
"name": "sdShow",
"outputs": [
{
"f": "clamp(-$in($uv)/max($bevel, 0.00001), 0.0, 1.0)",
"type": "f"
}
],
"parameters": [
{
"default": 0,
"label": "Bevel",
"max": 1,
"min": 0,
"name": "bevel",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
},
{
"name": "colorize",
"node_position": {
@ -733,6 +698,22 @@
"widgets": [
]
},
{
"name": "sdshow",
"node_position": {
"x": 631.060425,
"y": 365.52536
},
"parameters": {
"bevel": 0.01,
"cx": 0,
"cy": 0,
"h": 0.08,
"r": 0.3,
"w": 0.28
},
"type": "sdshow"
}
],
"parameters": {
@ -764,8 +745,8 @@
"label": "Gradient",
"name": "graph_3",
"node_position": {
"x": -228.787903,
"y": 631.143799
"x": -226.787903,
"y": 711.143799
},
"nodes": [
{
@ -954,50 +935,6 @@
},
"type": "graph"
},
{
"name": "bricks",
"node_position": {
"x": -209.473175,
"y": 327.099731
},
"parameters": {
"bevel": 0.1,
"columns": 3,
"mortar": 0.1,
"pattern": 0,
"repeat": 1,
"row_offset": 0.5,
"rows": 6
},
"type": "bricks"
},
{
"name": "warp",
"node_position": {
"x": -185.473175,
"y": 528.099731
},
"parameters": {
"amount": 0.1,
"eps": 0.1,
"epsilon": 0
},
"type": "warp"
},
{
"name": "perlin",
"node_position": {
"x": -436.473175,
"y": 324.099731
},
"parameters": {
"iterations": 3,
"persistence": 0.5,
"scale_x": 4,
"scale_y": 4
},
"type": "perlin"
},
{
"name": "blend",
"node_position": {
@ -1025,8 +962,8 @@
{
"name": "raymarching",
"node_position": {
"x": 242.468536,
"y": 27.145508
"x": 380.468536,
"y": 2.145508
},
"parameters": {
@ -1043,11 +980,11 @@
"type": "sdf3d"
}
],
"instance": "float input_$name(vec3 p) {\n\tif (p.z > 0.0) {\n\t\treturn $sdf(p);\n\t} else {\n\t\treturn p.z;\n\t}\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat dO=0.; \n for (int i=0; i < 25; i++) {\n \tvec3 p = ro + rd*dO;\n float dS = input_$name(p);\n dO += dS;\n if (dO > 1.0 || dS < 0.0001) break;\n }\n \n return dO;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = input_$name(p);\n float e = .001;\n \n vec3 n = d - vec3(input_$name(p-vec3(e, 0.0, 0.0)), input_$name(p-vec3(0.0, e, 0.0)), input_$name(p-vec3(0.0, 0.0, e)));\n return vec3(-1.0, -1.0, -1.0)*normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturnvec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Render3d",
"outputs": [
{
"rgb": "render_$name($uv-vec2(0.5));\n",
"rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb"
}
],
@ -1057,28 +994,6 @@
},
"type": "shader"
},
{
"name": "raymarching_2",
"node_position": {
"x": 24.010315,
"y": 37.457581
},
"parameters": {
},
"type": "raymarching"
},
{
"name": "raymarching_2_2",
"node_position": {
"x": 26.265625,
"y": 127.457581
},
"parameters": {
},
"type": "raymarching"
},
{
"connections": [
{
@ -2155,223 +2070,221 @@
"type": "graph"
},
{
"connections": [
{
"from": "sdf3d_box",
"from_port": 0,
"to": "sdf3d_boolean",
"to_port": 1
},
{
"from": "sdf3d_box_2",
"from_port": 0,
"to": "sdf3d_translate_3_2",
"to_port": 0
},
{
"from": "sdf3d_translate_3_2",
"from_port": 0,
"to": "sdf3d_boolean",
"to_port": 0
},
{
"from": "sdf3d_translate_3_2_2",
"from_port": 0,
"to": "sdf3d_boolean_2",
"to_port": 0
},
{
"from": "sdf3d_boolean",
"from_port": 0,
"to": "sdf3d_boolean_2",
"to_port": 1
},
{
"from": "sdf3d_box_2",
"from_port": 0,
"to": "sdf3d_translate_3_2_2",
"to_port": 0
},
{
"from": "sdf3d_boolean_2",
"from_port": 0,
"to": "gen_outputs",
"to_port": 0
}
],
"label": "Brick",
"name": "graph_4",
"name": "sdf3d_extrusion",
"node_position": {
"x": -209.947205,
"y": 122.904633
},
"nodes": [
{
"name": "sdf3d_box",
"node_position": {
"x": -564.5,
"y": -63
},
"parameters": {
"r": 0.01,
"sx": 0.26,
"sy": 0.15,
"sz": 0.1
},
"type": "sdf3d_box"
},
{
"name": "sdf3d_translate_3_2",
"node_position": {
"x": -554.5,
"y": -166
},
"parameters": {
"x": 0,
"y": 0,
"z": 0.45
},
"type": "sdf3d_translate"
},
{
"name": "sdf3d_box_2",
"node_position": {
"x": -570.5,
"y": -294.5
},
"parameters": {
"r": 0,
"sx": 0.21,
"sy": 0.1,
"sz": 0.36
},
"type": "sdf3d_box"
},
{
"name": "sdf3d_boolean",
"node_position": {
"x": -358.5,
"y": -118
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 1,
"r": 0.3,
"w": 0.28
},
"type": "sdf3d_boolean"
},
{
"name": "sdf3d_translate_3_2_2",
"node_position": {
"x": -343.333344,
"y": -224.333344
},
"parameters": {
"x": 0,
"y": 0,
"z": -0.45
},
"type": "sdf3d_translate"
},
{
"name": "sdf3d_boolean_2",
"node_position": {
"x": -147.333344,
"y": -168.333344
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 1,
"r": 0.3,
"w": 0.28
},
"type": "sdf3d_boolean"
},
{
"name": "gen_inputs",
"node_position": {
"x": -748.5,
"y": -159.361115
},
"parameters": {
},
"ports": [
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": 60.666656,
"y": -165.361115
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "sdf3d"
}
],
"type": "ios"
},
{
"name": "gen_parameters",
"node_position": {
"x": -488.111115,
"y": -466.5
},
"parameters": {
},
"type": "remote",
"widgets": [
]
}
],
"parameters": {
},
"type": "graph"
},
{
"name": "sdf3d_rotate_2",
"node_position": {
"x": -241.447205,
"y": 169.404633
"x": -69.41095,
"y": -191.970337
},
"parameters": {
"a": 0,
"ax": 25,
"ay": 23,
"az": -8,
"d": -0.53,
"s": 1,
"x": 0.35,
"y": 0,
"z": 0
},
"type": "sdf3d_rotate"
"type": "sdf3d_extrusion"
},
{
"name": "sdf3d_cylinder",
"node_position": {
"x": 115.056458,
"y": -125.498108
},
"parameters": {
"l": 0.25,
"r": 0.25,
"sx": 0.25,
"sy": 0.25,
"sz": 0.5
},
"type": "sdf3d_cylinder"
},
{
"name": "sdf3d_sphere",
"node_position": {
"x": -405.972748,
"y": 257.444763
},
"parameters": {
"r": 0.4
},
"type": "sdf3d_sphere"
},
{
"name": "sdf3d_box",
"node_position": {
"x": -446.972748,
"y": 316.444763
},
"parameters": {
"r": 0.01,
"sx": 0.3,
"sy": 0.25,
"sz": 0.25
},
"type": "sdf3d_box"
},
{
"name": "raymarching_2",
"node_position": {
"x": -233.972748,
"y": 263.944763
},
"parameters": {
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"function": true,
"label": "",
"name": "sdf",
"type": "sdf3d"
}
],
"instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Render3d",
"outputs": [
{
"rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
},
{
"name": "raymarching_2_2",
"node_position": {
"x": -233.972748,
"y": 320.944763
},
"parameters": {
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"function": true,
"label": "",
"name": "sdf",
"type": "sdf3d"
}
],
"instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Render3d",
"outputs": [
{
"rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
},
{
"name": "uniform_greyscale",
"node_position": {
"x": -343.972748,
"y": 181.944778
},
"parameters": {
"color": 0.5
},
"type": "uniform_greyscale"
},
{
"name": "sdf3d_morph",
"node_position": {
"x": -239.972748,
"y": 388.694763
},
"parameters": {
"Amount": 0.5,
"amount": 0.5,
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 0,
"r": 0.3,
"w": 0.28
},
"type": "sdf3d_morph"
},
{
"name": "raymarching_2_2_2",
"node_position": {
"x": -229.972748,
"y": 604.694763
},
"parameters": {
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"function": true,
"label": "",
"name": "sdf",
"type": "sdf3d"
}
],
"instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Render3d",
"outputs": [
{
"rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
},
{
"name": "sdf3d_scale_2",
"node_position": {
"x": -242.972748,
"y": 556.694763
},
"parameters": {
"a": 0,
"s": 0.5,
"x": 0.35,
"y": 0,
"z": 0
},
"type": "sdf3d_scale"
},
{
"name": "sdf3d_translate_3_2",
"node_position": {
"x": -233.447205,
"y": 270.404633
"x": -246.972748,
"y": 455.694763
},
"parameters": {
"x": 0,
"x": 0.5,
"y": 0,
"z": 0.25
"z": 0
},
"type": "sdf3d_translate"
}

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/doc_tools_albedo.png-7c4191d26c2e3665ccb8c2f5268f0b3d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/material_maker/examples/doc_tools_albedo.png"
dest_files=[ "res://.import/doc_tools_albedo.png-7c4191d26c2e3665ccb8c2f5268f0b3d.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,9 @@ func remove_node(node) -> void:
for c in get_connection_list():
if c.from == node_name or c.to == node_name:
disconnect_node(c.from, c.from_port, c.to, c.to_port)
if node == last_selected:
set_last_selected(null)
remove_child(node)
node.queue_free()
send_changed_signal()
@ -106,6 +109,8 @@ func clear_view() -> void:
clear_connections()
for c in get_children():
if c is GraphNode:
if c == last_selected:
set_last_selected(null)
remove_child(c)
c.free()
@ -358,14 +363,19 @@ func _on_ButtonTransmitsSeed_toggled(button_pressed) -> void:
generator.transmits_seed = button_pressed
func _on_GraphEdit_node_selected(node) -> void:
last_selected = node
set_last_selected(node)
func set_last_selected(node) -> void:
if node is GraphNode:
last_selected = node
else:
last_selected = null
func _on_GraphEdit_gui_input(event) -> void:
if event is InputEventMouseButton:
call_deferred("check_last_selected")
func check_last_selected() -> void:
if last_selected != null and !(is_instance_valid(last_selected) && last_selected.selected):
print("Unselected")
if last_selected != null and !(is_instance_valid(last_selected) and last_selected.selected):
last_selected = null
emit_signal("node_selected", null)
emit_signal("node_selected", null)

View File

@ -36,14 +36,13 @@ one_shot = true
[node name="GraphUI" type="HBoxContainer" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -592.0
margin_left = -262.0
margin_right = -16.0
margin_bottom = 24.0
alignment = 2
[node name="SubGraphUI" type="HBoxContainer" parent="GraphUI"]
margin_left = 330.0
margin_right = 544.0
margin_right = 214.0
margin_bottom = 24.0
size_flags_horizontal = 9
@ -71,8 +70,8 @@ size_flags_horizontal = 9
icon = SubResource( 3 )
[node name="ButtonShowTree" type="Button" parent="GraphUI"]
margin_left = 548.0
margin_right = 576.0
margin_left = 218.0
margin_right = 246.0
margin_bottom = 24.0
hint_tooltip = "Show hierarchy"
icon = SubResource( 4 )

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

View File

@ -513,7 +513,8 @@ func _on_Projects_tab_changed(tab) -> void:
if c.method_name == "update_preview" or c.method_name == "update_preview_2d":
c.source.disconnect(c.signal_name, self, c.method_name)
new_tab.connect("graph_changed", self, "update_preview")
new_tab.connect("node_selected", self, "on_selected_node_change")
if !new_tab.is_connected("node_selected", self, "on_selected_node_change"):
new_tab.connect("node_selected", self, "on_selected_node_change")
current_tab = new_tab
update_preview()

View File

@ -0,0 +1,55 @@
{
"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": "",
"name": "Beehive",
"outputs": [
{
"f": "1.0-2.0*beehive_dist($(name_uv)_center.xy)",
"type": "f"
},
{
"rgb": "rand3(fract($(name_uv)_center.zw/vec2($sx, $sy))+vec2($seed))",
"type": "rgb"
},
{
"rgb": "vec3(vec2(0.5)+$(name_uv)_center.xy, 0.0)",
"type": "rgb"
}
],
"parameters": [
{
"default": 2,
"label": "Size X",
"max": 64,
"min": 1,
"name": "sx",
"step": 1,
"type": "float"
},
{
"default": 2,
"label": "Size Y",
"max": 64,
"min": 1,
"name": "sy",
"step": 1,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,118 @@
{
"name": "box",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"cz": 0.5,
"r": 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))",
"type": "f"
}
],
"parameters": [
{
"default": 0.5,
"label": "Center X",
"max": 1,
"min": 0,
"name": "cx",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Center Y",
"max": 1,
"min": 0,
"name": "cy",
"step": 0.01,
"type": "float"
},
{
"default": 0,
"label": "Center Z",
"max": 0.5,
"min": -0.5,
"name": "cz",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Size X",
"max": 1,
"min": 0,
"name": "sx",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Size Y",
"max": 1,
"min": 0,
"name": "sy",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Size Z",
"max": 1,
"min": 0,
"name": "sz",
"step": 0.01,
"type": "float"
},
{
"default": 0,
"label": "Rot X",
"max": 180,
"min": -180,
"name": "rx",
"step": 0.1,
"type": "float"
},
{
"default": 0,
"label": "Rot Y",
"max": 180,
"min": -180,
"name": "ry",
"step": 0.1,
"type": "float"
},
{
"default": 0,
"label": "Rot Z",
"max": 180,
"min": -180,
"name": "rz",
"step": 0.1,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -7,19 +7,21 @@
"parameters": {
"bevel": 0.1,
"columns": 3,
"corner": 0,
"mortar": 0.1,
"pattern": 0,
"repeat": 1,
"round": 0,
"row_offset": 0.5,
"rows": 6
},
"shader_model": {
"code": "vec4 $(name_uv) = $(name)_xyzw($(uv));\n",
"global": "vec4 brick(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float bevel) {\n\tfloat color;\n\tvec2 c1 = (uv-bmin-vec2(mortar))/bevel;\n\tvec2 c2 = (bmax-uv-vec2(mortar))/bevel;\n\tvec2 c = min(c1, c2);\n\tcolor = clamp(min(c.x, c.y), 0.0, 1.0);\n\tvec2 tiled_brick_pos = mod(bmin, vec2(1.0, 1.0));\n\treturn vec4(color, 0.5*(bmin+bmax), tiled_brick_pos.x+7.0*tiled_brick_pos.y);\n}\n\nvec4 bricks_rb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\tcount *= repeat;\n\tmortar /= max(count.x, count.y);\n\tbevel /= max(count.x, count.y);\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 brick(uv, bmin, bmin+vec2(1.0)/count, mortar, bevel);\n}\n\nvec4 bricks_rb2(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\tcount *= repeat;\n\tmortar /= max(2.0*count.x, count.y);\n\tbevel /= max(2.0*count.x, count.y);\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 brick(uv, bmin, bmin+vec2(1.0)/count, mortar, bevel);\n}\n\nvec4 bricks_hb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\tfloat pc = count.x+count.y;\n\tfloat c = pc*repeat;\n\tmortar /= c;\n\tbevel /= c;\n\tvec2 corner = floor(uv*c);\n\tfloat cdiff = mod(corner.x-corner.y, pc);\n\tif (cdiff < count.x) {\n\t\treturn brick(uv, (corner-vec2(cdiff, 0.0))/c, (corner-vec2(cdiff, 0.0)+vec2(count.x, 1.0))/c, mortar, bevel);\n\t} else {\n\t\treturn brick(uv, (corner-vec2(0.0, pc-cdiff-1.0))/c, (corner-vec2(0.0, pc-cdiff-1.0)+vec2(1.0, count.y))/c, mortar, bevel);\n\t}\n}\n\nvec4 bricks_bw(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\tvec2 c = 2.0*count*repeat;\n\tfloat mc = max(c.x, c.y);\n\tmortar /= mc;\n\tbevel /= mc;\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 brick(uv, corner/c, (corner+size)/c, mortar, bevel);\n}\n\nvec4 bricks_sb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\tvec2 c = (count+vec2(1.0))*repeat;\n\tfloat mc = max(c.x, c.y);\n\tmortar /= mc;\n\tbevel /= mc;\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 brick(uv, corner/c, (corner+size)/c, mortar, bevel);\n}",
"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, $round, max(0.001, $bevel));\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_uv(vec2 uv, vec2 bmin, vec2 bmax) {\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, 0.0);\n}\n\nvec3 brick_corner_uv(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float corner) {\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)), 0.0);\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": [
],
"instance": "vec4 $(name)_xyzw(vec2 uv) {\n return bricks_$(pattern)(uv, vec2($(columns), $(rows)), $(repeat), $(row_offset), $(mortar), max(0.001, $(bevel)));\n}",
"instance": "",
"name": "Bricks",
"outputs": [
{
@ -37,6 +39,18 @@
{
"f": "$(name_uv).z",
"type": "f"
},
{
"rgb": "brick_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw)",
"type": "rgb"
},
{
"rgb": "brick_corner_uv($uv, $(name_uv)_rect.xy, $(name_uv)_rect.zw, $mortar, $corner)",
"type": "rgb"
},
{
"f": "0.5*(sign($(name_uv)_rect.z-$(name_uv)_rect.x-$(name_uv)_rect.w+$(name_uv)_rect.y)+1.0)",
"type": "f"
}
],
"parameters": [
@ -69,6 +83,7 @@
]
},
{
"control": "None",
"default": 1,
"label": "Repeat:",
"max": 8,
@ -78,6 +93,7 @@
"type": "float"
},
{
"control": "None",
"default": 6,
"label": "Rows:",
"max": 64,
@ -87,6 +103,7 @@
"type": "float"
},
{
"control": "None",
"default": 3,
"label": "Columns:",
"max": 64,
@ -96,6 +113,7 @@
"type": "float"
},
{
"control": "None",
"default": 0.5,
"label": "Offset:",
"max": 1,
@ -105,21 +123,43 @@
"type": "float"
},
{
"control": "None",
"default": 0.1,
"label": "Mortar:",
"max": 0.5,
"min": 0,
"name": "mortar",
"step": 0,
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0.1,
"label": "Bevel:",
"max": 0.5,
"min": 0,
"name": "bevel",
"step": 0,
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0,
"label": "Round:",
"max": 0.5,
"min": 0,
"name": "round",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0.1,
"label": "Corner:",
"max": 0.5,
"min": 0,
"name": "corner",
"step": 0.01,
"type": "float"
}
]

View File

@ -0,0 +1,40 @@
{
"name": "custom_uv",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "vec4(1.0)",
"label": "Input",
"name": "in",
"type": "rgba"
},
{
"default": "0.0",
"label": "UV",
"name": "map",
"type": "rgb"
}
],
"instance": "",
"name": "Custom UV",
"outputs": [
{
"rgba": "$in($map($uv).xy)",
"type": "rgba"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1 @@
{"convolution_params":{"name":"Edge detect 1","input_type":"rgb","matrix":[[-1,-1,-1],[-1,8,-1],[-1,-1,-1]],"output_type":"rgb","x":1,"y":1},"name":"edge_detect","node_position":{"x":0,"y":0},"parameters":{"size":10},"type":"convolution"}

View File

@ -0,0 +1 @@
{"convolution_params":{"name":"Edge detect 2","input_type":"rgb","matrix":[[0,-1,0],[-1,4,-1],[0,-1,0]],"output_type":"rgb","x":1,"y":1},"name":"edge_detect","node_position":{"x":0,"y":0},"parameters":{"size":10},"type":"convolution"}

View File

@ -0,0 +1 @@
{"convolution_params":{"name":"Edge detect 3","input_type":"rgb","matrix":[[1,0,-1],[0,0,0],[-1,0,1]],"output_type":"rgb","x":1,"y":1},"name":"edge_detect","node_position":{"x":0,"y":0},"parameters":{"size":10},"type":"convolution"}

View File

@ -14,13 +14,13 @@ var preview_timer : Timer = null
func set_generator(g) -> void:
.set_generator(g)
generator.connect("parameter_changed", self, "on_parameter_changed")
call_deferred("update_node")
update_node()
func on_parameter_changed(p, v) -> void:
if ignore_parameter_change == p:
return
if p == "__update_all__":
call_deferred("update_node")
update_node()
elif controls.has(p):
var o = controls[p]
if o is MMFloatEdit:
@ -158,6 +158,7 @@ func restore_preview_widget() -> void:
func update_node() -> void:
# Clean node
var custom_node_buttons = null
clear_all_slots()
save_preview_widget()
for c in get_children():
remove_child(c)
@ -327,7 +328,7 @@ func do_load_generator(file_name : String) -> void:
var parent_generator = generator.get_parent()
parent_generator.replace_generator(generator, new_generator)
generator = new_generator
call_deferred("update_node")
update_node()
func save_generator() -> void:
var dialog = FileDialog.new()

View File

@ -0,0 +1,64 @@
{
"name": "greyscale",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"brightness": 0,
"contrast": 1,
"mode": 2,
"steps": 6
},
"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": "",
"name": "in",
"type": "rgb"
}
],
"instance": "",
"name": "Greyscale",
"outputs": [
{
"f": "gs_$mode($in($uv))",
"type": "f"
}
],
"parameters": [
{
"default": 4,
"label": "",
"name": "mode",
"type": "enum",
"values": [
{
"name": "Lightness",
"value": "lightness"
},
{
"name": "Average",
"value": "average"
},
{
"name": "Luminosity",
"value": "luminosity"
},
{
"name": "Min",
"value": "min"
},
{
"name": "Max",
"value": "max"
}
]
}
]
},
"type": "shader"
}

View File

@ -12,7 +12,7 @@
"global": "",
"inputs": [
{
"default": "0.0",
"default": "vec4(1.0, 1.0, 1.0, 1.0)",
"label": "",
"name": "in",
"type": "rgba"

View File

@ -0,0 +1,60 @@
{
"name": "mwf_create_map",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"angle": 0,
"height": 1
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "1.0",
"label": "",
"name": "h",
"type": "f"
},
{
"default": "0.0",
"label": "",
"name": "o",
"type": "f"
}
],
"instance": "",
"name": "Create Map",
"outputs": [
{
"rgb": "vec3($height*$h($uv), $angle*0.00277777777+0.5, rand(vec2(float($seed)+$o($uv))))",
"type": "rgb"
}
],
"parameters": [
{
"control": "None",
"default": 1,
"label": "Height",
"max": 1,
"min": 0,
"name": "height",
"step": 0.01,
"type": "float"
},
{
"control": "None",
"default": 0,
"label": "Angle",
"max": 180,
"min": -180,
"name": "angle",
"step": 0.1,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,74 @@
{
"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",
"name": "map",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Albedo",
"name": "mat1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM",
"name": "mat2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission",
"name": "mat3",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal",
"name": "mat4",
"type": "rgb"
}
],
"instance": "",
"name": "Apply Map",
"outputs": [
{
"f": "$map($uv).x",
"type": "f"
},
{
"rgb": "$mat1($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat2($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "$mat3($(name_uv)_uv)",
"type": "rgb"
},
{
"rgb": "matmap_rotate_nm($mat4($(name_uv)_uv), -$(name_uv)_angle)",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1,104 @@
{
"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",
"label": "Height 1",
"name": "h1",
"type": "f"
},
{
"default": "vec3(0.0)",
"label": "Color 1",
"name": "c1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM 1",
"name": "orm1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission 1",
"name": "em1",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal 1",
"name": "nm1",
"type": "rgb"
},
{
"default": "0.0",
"label": "Height 2",
"name": "h2",
"type": "f"
},
{
"default": "vec3(0.0)",
"label": "Color 2",
"name": "c2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "ORM 2",
"name": "orm2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "Emission 2",
"name": "em2",
"type": "rgb"
},
{
"default": "vec3(0.5, 0.5, 1.0)",
"label": "Normal 2",
"name": "nm2",
"type": "rgb"
}
],
"instance": "",
"name": "Mix",
"outputs": [
{
"f": "max($h1($uv), $h2($uv))",
"type": "f"
},
{
"rgb": "mix($c1($uv), $c2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($orm1($uv), $orm2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($em1($uv), $em2($uv), $(name_uv)_a1)",
"type": "rgb"
},
{
"rgb": "mix($nm1($uv), $nm2($uv), $(name_uv)_a1)",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1,53 @@
{
"name": "mwf_mix_maps",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"angle": 45,
"height": 0.8
},
"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": "",
"name": "in1",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "",
"name": "in2",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "",
"name": "in3",
"type": "rgb"
},
{
"default": "vec3(0.0)",
"label": "",
"name": "in4",
"type": "rgb"
}
],
"instance": "",
"name": "Mix maps",
"outputs": [
{
"rgb": "matmap_mix(matmap_mix($in1($uv), $in2($uv)), matmap_mix($in3($uv), $in4($uv)))",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -0,0 +1,615 @@
{
"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": "gaussian_blur",
"to_port": 0
},
{
"from": "gaussian_blur",
"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",
"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"
},
{
"connections": [
{
"from": "buffer",
"from_port": 0,
"to": "blurx_convolution",
"to_port": 0
},
{
"from": "buffer_2",
"from_port": 0,
"to": "blurx_convolution_2",
"to_port": 0
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "buffer",
"to_port": 0
},
{
"from": "blend",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "blurx_convolution",
"from_port": 0,
"to": "buffer_2",
"to_port": 0
},
{
"from": "blurx_convolution_2",
"from_port": 0,
"to": "blend",
"to_port": 1
},
{
"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
}
],
"label": "Occlusion",
"name": "gaussian_blur",
"node_position": {
"x": -994.845825,
"y": 786.968262
},
"nodes": [
{
"convolution_params": {
"input_type": "rgba",
"matrix_function": "exp(-0.5*(pow(x/sigma, 2.0)))/(6.28318530718 *sigma*sigma)",
"normalized": true,
"output_type": "rgba",
"parameters": [
{
"max": 50,
"min": 0.05,
"name": "sigma",
"type": "float"
}
],
"x": 50,
"y": 0
},
"name": "blurx_convolution",
"node_position": {
"x": -407.5,
"y": -192.5
},
"parameters": {
"sigma": 50,
"size": 10
},
"type": "convolution"
},
{
"name": "buffer_2",
"node_position": {
"x": -404.875,
"y": -116.625
},
"parameters": {
"lod": 0,
"size": 10
},
"type": "buffer"
},
{
"convolution_params": {
"input_type": "rgba",
"matrix_function": "exp(-0.5*(pow(y/sigma, 2.0)))/(6.28318530718 *sigma*sigma)",
"normalized": true,
"output_type": "rgba",
"parameters": [
{
"max": 50,
"min": 0.05,
"name": "sigma",
"type": "float"
}
],
"x": 0,
"y": 50
},
"name": "blurx_convolution_2",
"node_position": {
"x": -407.125,
"y": -44.375
},
"parameters": {
"sigma": 50,
"size": 10
},
"type": "convolution"
},
{
"name": "buffer",
"node_position": {
"x": -408.25,
"y": -265.75
},
"parameters": {
"lod": 0,
"size": 10
},
"type": "buffer"
},
{
"name": "gen_parameters",
"node_position": {
"x": -447.666626,
"y": -370.666656
},
"parameters": {
"param0": 10,
"param1": 50,
"param2": 1
},
"type": "remote",
"widgets": [
{
"label": "Grid size:",
"linked_widgets": [
{
"node": "buffer",
"widget": "size"
},
{
"node": "blurx_convolution",
"widget": "size"
},
{
"node": "buffer_2",
"widget": "size"
},
{
"node": "blurx_convolution_2",
"widget": "size"
}
],
"name": "param0",
"type": "linked_control"
},
{
"label": "Strength",
"linked_widgets": [
{
"node": "_2",
"widget": "g"
}
],
"name": "param2",
"type": "linked_control"
}
]
},
{
"name": "gen_inputs",
"node_position": {
"x": -585.666626,
"y": -112.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": 55.547607,
"y": -133.392853
},
"parameters": {
},
"ports": [
{
"name": "port0",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "blend",
"node_position": {
"x": -420.79895,
"y": 27.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"
}
},
"type": "colorize"
},
{
"name": "_2",
"node_position": {
"x": -134.403687,
"y": -110.29187
},
"parameters": {
"g": 1
},
"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"
}
],
"parameters": {
"param0": 10,
"param1": 50,
"param2": 1
},
"type": "graph"
},
{
"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": 0.5,
"blend_type": 4
},
"type": "blend"
},
{
"name": "gen_inputs",
"node_position": {
"x": -1336.805542,
"y": 597.758606
},
"parameters": {
},
"ports": [
{
"name": "Height",
"type": "f"
},
{
"name": "Albedo",
"type": "rgb"
},
{
"name": "ORM",
"type": "rgb"
},
{
"name": "Emission",
"type": "rgb"
},
{
"name": "Normal",
"type": "rgb"
}
],
"type": "ios"
},
{
"name": "gen_outputs",
"node_position": {
"x": -635.305542,
"y": 597.758606
},
"parameters": {
},
"ports": [
{
"name": "Albedo",
"type": "rgb"
},
{
"name": "Metallic",
"type": "f"
},
{
"name": "Roughness",
"type": "f"
},
{
"name": "Emission",
"type": "rgb"
},
{
"name": "Normal",
"type": "rgb"
},
{
"name": "Occlusion",
"type": "f"
},
{
"name": "Depth",
"type": "f"
}
],
"type": "ios"
},
{
"name": "gen_parameters",
"node_position": {
"x": -1100.881836,
"y": 438.25
},
"parameters": {
"param0": 0.5,
"param1": 10,
"param2": 1
},
"type": "remote",
"widgets": [
{
"label": "Occlusion",
"linked_widgets": [
{
"node": "gaussian_blur",
"widget": "param2"
}
],
"name": "param2",
"type": "linked_control"
},
{
"label": "Mat Normal",
"linked_widgets": [
{
"node": "blend_2",
"widget": "amount"
}
],
"name": "param0",
"type": "linked_control"
}
]
},
{
"name": "brightness_contrast",
"node_position": {
"x": -1177.223877,
"y": 677.062317
},
"parameters": {
"brightness": 0,
"contrast": 1,
"steps": 6
},
"type": "brightness_contrast"
},
{
"name": "normal_map_2",
"node_position": {
"x": -1152.5,
"y": 544.75
},
"parameters": {
"amount": 0.5,
"param0": 10,
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 1,
"size": 4
},
"type": "normal_map"
}
],
"parameters": {
"param0": 0.5,
"param1": 10,
"param2": 1
},
"type": "graph"
}

View File

@ -21,6 +21,18 @@
{
"from": "buffer",
"from_port": 0,
"to": "switch",
"to_port": 1
},
{
"from": "gen_inputs",
"from_port": 0,
"to": "switch",
"to_port": 0
},
{
"from": "switch",
"from_port": 0,
"to": "nm_convolution",
"to_port": 0
}
@ -36,9 +48,10 @@
"name": "buffer",
"node_position": {
"x": -687.663818,
"y": 125.60614
"y": 39.60614
},
"parameters": {
"lod": 0,
"size": 10
},
"type": "buffer"
@ -101,8 +114,8 @@
},
"name": "nm_convolution",
"node_position": {
"x": -690.25,
"y": 174.25
"x": -695.25,
"y": 175.25
},
"parameters": {
"size": 10
@ -112,7 +125,7 @@
{
"name": "nm_postprocess",
"node_position": {
"x": -690.25,
"x": -693.25,
"y": 222.25
},
"parameters": {
@ -185,14 +198,16 @@
{
"name": "gen_parameters",
"node_position": {
"x": -729.910156,
"y": -5.916687
"x": -718.910156,
"y": -118.916687
},
"parameters": {
"amount": 0.5,
"param0": 10,
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 1,
"size": 4
},
"type": "remote",
@ -237,21 +252,48 @@
],
"name": "param1",
"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"
}
],
"name": "param4",
"type": "config_control"
}
]
},
{
"name": "gen_outputs",
"node_position": {
"x": -407.663818,
"y": 151.047363
"x": -416.663818,
"y": 228.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"name": "Normal",
"type": "rgba"
}
],
@ -260,19 +302,32 @@
{
"name": "gen_inputs",
"node_position": {
"x": -870.910156,
"y": 157.047363
"x": -868.910156,
"y": 71.047363
},
"parameters": {
},
"ports": [
{
"name": "port0",
"name": "Bump",
"type": "rgba"
}
],
"type": "ios"
},
{
"name": "switch",
"node_position": {
"x": -673.5,
"y": 113.297363
},
"parameters": {
"choices": 2,
"outputs": 1,
"source": 1
},
"type": "switch"
}
],
"parameters": {
@ -280,6 +335,8 @@
"param0": 10,
"param1": 1.02,
"param2": 0,
"param3": 0,
"param4": 1,
"size": 4
},
"type": "graph"

View File

@ -0,0 +1,35 @@
{
"name": "raymarching_preview",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"function": true,
"label": "",
"name": "sdf",
"type": "sdf3d"
}
],
"instance": "float calcdist_$name(vec3 p) {\n return min($sdf(p), p.z);\n}\n\nfloat raymarch_$name(vec3 ro, vec3 rd) {\n\tfloat d=0.0;\n\tfor (int i = 0; i < 50; i++) {\n\t\tvec3 p = ro + rd*d;\n\t\tfloat dstep = calcdist_$name(p);\n\t\td += dstep;\n\t\tif (dstep < 0.0001) break;\n\t}\n\treturn d;\n}\n\nvec3 normal_$name(vec3 p) {\n\tfloat d = calcdist_$name(p);\n\tfloat e = .0001;\n\tvec3 n = d - vec3(calcdist_$name(p-vec3(e, 0.0, 0.0)), calcdist_$name(p-vec3(0.0, e, 0.0)), calcdist_$name(p-vec3(0.0, 0.0, e)));\n\treturn normalize(n);\n}\n\nvec3 render_$name(vec2 uv) {\n\tvec3 p = vec3(uv, 2.0-raymarch_$name(vec3(uv, 2.0), vec3(0.0, 0.0, -1.0)));\n\tvec3 n = normal_$name(p);\n\tvec3 l = vec3(5.0, 5.0, 10.0);\n\tvec3 ld = normalize(l-p);\n\tfloat o = step(p.z, 0.001);\n\tfloat shadow = 1.0-0.75*step(raymarch_$name(l, -ld), length(l-p)-0.01);\n\tfloat light = 0.3+0.7*dot(n, ld)*shadow;\n\treturn vec3(0.8+0.2*o, 0.8+0.2*o, 1.0)*light;\n}\n",
"name": "Preview",
"outputs": [
{
"rgb": "render_$name($uv-vec2(0.5))",
"type": "rgb"
}
],
"parameters": [
]
},
"type": "shader"
}

View File

@ -40,9 +40,9 @@ func update_node() -> void:
control.name = p.name
controls[control.name] = control
add_control(generator.get_widget(p.name).label, control)
if generator.widgets[i].type == "config_control":
if generator.widgets[i].type == "config_control" and control is OptionButton:
var current = null
if control.get_item_count() > 0:
if control.get_item_count() > 0 and generator.parameters.has(p.name):
control.selected = generator.parameters[p.name]
current = control.get_item_text(control.selected)
control.add_separator()
@ -60,30 +60,31 @@ func _on_value_changed(new_value, variable : String) -> void:
if widget.type == "config_control":
var configuration_count = widget.configurations.size()
var control = controls[variable]
if new_value < configuration_count:
._on_value_changed(new_value, variable)
var current = control.get_item_text(new_value)
control.set_item_text(configuration_count+3, "<update "+current+">")
control.set_item_text(configuration_count+4, "<remove "+current+">")
else:
var current = control.get_item_text(generator.parameters[variable])
var command = new_value - widget.configurations.size()
match command:
1:
var dialog = preload("res://addons/material_maker/widgets/line_dialog.tscn").instance()
add_child(dialog)
dialog.set_texts("Configuration", "Enter a name for the new configuration")
dialog.connect("ok", self, "do_add_configuration", [ variable ])
dialog.popup_centered()
3:
generator.update_configuration(variable, current)
4:
generator.parameters[variable] = 0
generator.remove_configuration(variable, current)
_:
print(command)
else:
._on_value_changed(new_value, variable)
if control is OptionButton:
if new_value < configuration_count:
._on_value_changed(new_value, variable)
var current = control.get_item_text(new_value)
control.set_item_text(configuration_count+3, "<update "+current+">")
control.set_item_text(configuration_count+4, "<remove "+current+">")
else:
var current = control.get_item_text(generator.parameters[variable])
var command = new_value - widget.configurations.size()
match command:
1:
var dialog = preload("res://addons/material_maker/widgets/line_dialog.tscn").instance()
add_child(dialog)
dialog.set_texts("Configuration", "Enter a name for the new configuration")
dialog.connect("ok", self, "do_add_configuration", [ variable ])
dialog.popup_centered()
3:
generator.update_configuration(variable, current)
4:
generator.parameters[variable] = 0
generator.remove_configuration(variable, current)
_:
print(command)
return
._on_value_changed(new_value, variable)
func do_add_configuration(config_name : String, param_name : String) -> void:
generator.add_configuration(param_name, config_name)
@ -109,7 +110,8 @@ func _on_AddConfig_pressed() -> void:
func _on_Link_pressed(param_name) -> void:
var link = MMNodeLink.new(get_parent())
link.pick(controls[param_name], generator, param_name)
if controls.has(param_name):
link.pick(controls[param_name], generator, param_name)
func _on_Remote_resize_request(new_minsize) -> void:
rect_size = new_minsize

View File

@ -0,0 +1,62 @@
{
"name": "sdelongation",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"k": 0.15,
"op": 0,
"r": 0.08,
"w": 0.28,
"x": 0,
"y": 0
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in",
"type": "sdf2d"
}
],
"instance": "",
"name": "sdElongation",
"outputs": [
{
"sdf2d": "$in($uv-clamp($uv-vec2(0.5), -vec2($x, $y), vec2($x, $y)))",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "Rect1.x",
"default": 0,
"label": "X",
"max": 1,
"min": 0,
"name": "x",
"step": 0.01,
"type": "float"
},
{
"control": "Rect1.y",
"default": 0,
"label": "Y",
"max": 1,
"min": 0,
"name": "y",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,57 @@
{
"name": "sdf3d_morph",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"Amount": 0.5,
"amount": 0.5,
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 0,
"r": 0.3,
"w": 0.28
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in1",
"type": "sdf3d"
},
{
"default": "0.0",
"label": "",
"name": "in2",
"type": "sdf3d"
}
],
"instance": "",
"name": "Morph",
"outputs": [
{
"sdf3d": "mix($in1($uv), $in2($uv), $amount)",
"type": "sdf3d"
}
],
"parameters": [
{
"control": "None",
"default": 0.5,
"label": "",
"max": 1,
"min": 0,
"name": "amount",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,56 @@
{
"name": "sdmorph",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"amount": 0.5,
"bevel": 0,
"cx": 0,
"cy": 0,
"h": 0.08,
"op": 0,
"r": 0.3,
"w": 0.28
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"name": "in1",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"name": "in2",
"type": "sdf2d"
}
],
"instance": "",
"name": "sdMorph",
"outputs": [
{
"sdf2d": "mix($in1($uv), $in2($uv), $amount)",
"type": "sdf2d"
}
],
"parameters": [
{
"control": "None",
"default": 0.5,
"label": "",
"max": 1,
"min": 0,
"name": "amount",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1 @@
{"convolution_params":{"name":"Sharpen","input_type":"rgb","matrix":[[0,-1,0],[-1,5,-1],[0,-1,0]],"output_type":"rgb","x":1,"y":1},"name":"edge_detect","node_position":{"x":0,"y":0},"parameters":{"size":10},"type":"convolution"}

View File

@ -0,0 +1,57 @@
{
"name": "sphere",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"cx": 0.5,
"cy": 0.5,
"r": 0.5
},
"shader_model": {
"code": "",
"global": "float sphere(vec2 uv, vec2 c, float r) {\n\tuv -= c;\n\tuv /= r;\n\treturn 2.0*r*sqrt(max(0.0, 1.0-dot(uv, uv)));\n}\n",
"inputs": [
],
"instance": "",
"name": "Sphere",
"outputs": [
{
"f": "sphere($uv, vec2($cx, $cy), $r)",
"type": "f"
}
],
"parameters": [
{
"default": 0.5,
"label": "Center X",
"max": 1,
"min": 0,
"name": "cx",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Center Y",
"max": 1,
"min": 0,
"name": "cy",
"step": 0.01,
"type": "float"
},
{
"default": 0.5,
"label": "Radius",
"max": 1,
"min": 0,
"name": "r",
"step": 0.01,
"type": "float"
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,228 @@
{
"name": "swap_channels",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"out_a": 8,
"out_b": 6,
"out_g": 4,
"out_r": 2
},
"shader_model": {
"code": "",
"global": "",
"inputs": [
{
"default": "vec4(1.0)",
"label": "",
"name": "in",
"type": "rgba"
}
],
"instance": "",
"name": "Swap channels",
"outputs": [
{
"rgba": "vec4($out_r,$out_g,$out_b,$out_a)",
"type": "rgba"
}
],
"parameters": [
{
"default": 2,
"label": "R",
"name": "out_r",
"type": "enum",
"values": [
{
"name": "0",
"value": "0.0"
},
{
"name": "1",
"value": "1.0"
},
{
"name": "R",
"value": "$in($uv).r"
},
{
"name": "-R",
"value": "1.0-$in($uv).r"
},
{
"name": "G",
"value": "$in($uv).g"
},
{
"name": "-G",
"value": "1.0-$in($uv).g"
},
{
"name": "B",
"value": "$in($uv).b"
},
{
"name": "-B",
"value": "1.0-$in($uv).b"
},
{
"name": "A",
"value": "$in($uv).a"
},
{
"name": "-A",
"value": "1.0-$in($uv).a"
}
]
},
{
"default": 4,
"label": "G",
"name": "out_g",
"type": "enum",
"values": [
{
"name": "0",
"value": "0.0"
},
{
"name": "1",
"value": "1.0"
},
{
"name": "R",
"value": "$in($uv).r"
},
{
"name": "-R",
"value": "1.0-$in($uv).r"
},
{
"name": "G",
"value": "$in($uv).g"
},
{
"name": "-G",
"value": "1.0-$in($uv).g"
},
{
"name": "B",
"value": "$in($uv).b"
},
{
"name": "-B",
"value": "1.0-$in($uv).b"
},
{
"name": "A",
"value": "$in($uv).a"
},
{
"name": "-A",
"value": "1.0-$in($uv).a"
}
]
},
{
"default": 6,
"label": "B",
"name": "out_b",
"type": "enum",
"values": [
{
"name": "0",
"value": "0.0"
},
{
"name": "1",
"value": "1.0"
},
{
"name": "R",
"value": "$in($uv).r"
},
{
"name": "-R",
"value": "1.0-$in($uv).r"
},
{
"name": "G",
"value": "$in($uv).g"
},
{
"name": "-G",
"value": "1.0-$in($uv).g"
},
{
"name": "B",
"value": "$in($uv).b"
},
{
"name": "-B",
"value": "1.0-$in($uv).b"
},
{
"name": "A",
"value": "$in($uv).a"
},
{
"name": "-A",
"value": "1.0-$in($uv).a"
}
]
},
{
"default": 8,
"label": "A",
"name": "out_a",
"type": "enum",
"values": [
{
"name": "0",
"value": "0.0"
},
{
"name": "1",
"value": "1.0"
},
{
"name": "R",
"value": "$in($uv).r"
},
{
"name": "-R",
"value": "1.0-$in($uv).r"
},
{
"name": "G",
"value": "$in($uv).g"
},
{
"name": "-G",
"value": "1.0-$in($uv).g"
},
{
"name": "B",
"value": "$in($uv).b"
},
{
"name": "-B",
"value": "1.0-$in($uv).b"
},
{
"name": "A",
"value": "$in($uv).a"
},
{
"name": "-A",
"value": "1.0-$in($uv).a"
}
]
}
]
},
"type": "shader"
}

View File

@ -0,0 +1,45 @@
{
"name": "truchet_generic",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"Size": 4,
"shape": 0,
"size": 6,
"type": 1
},
"shader_model": {
"code": "",
"global": "vec2 truchet_generic_uv(vec2 uv, vec2 seed) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n\tvec2 invert = step(rand2(seed+i), vec2(0.5));\n return f*(vec2(1.0)-invert)+(vec2(1.0)-f)*invert;\n}\n",
"inputs": [
{
"default": "vec4(1.0)",
"label": "",
"name": "in",
"type": "rgba"
}
],
"instance": "",
"name": "Generic Truchet",
"outputs": [
{
"rgba": "$in(truchet_generic_uv($uv*$size, vec2($seed, $seed)))",
"type": "rgba"
}
],
"parameters": [
{
"default": 4,
"label": "Size",
"max": 64,
"min": 2,
"name": "size",
"step": 1,
"type": "float"
}
]
},
"type": "shader"
}

Some files were not shown because too many files have changed in this diff Show More