mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
Added custom node example (mandelbrot)
This commit is contained in:
parent
bf4a125386
commit
41fdc5783e
1
addons/material_maker/examples/mandelbrot.ptex
Normal file
1
addons/material_maker/examples/mandelbrot.ptex
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"connections":[{"from":"colorize_0","from_port":0,"to":"Material","to_port":0},{"from":"custom_0","from_port":0,"to":"colorize_0","to_port":0}],"nodes":[{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"name":"Material","node_position":{"x":200,"y":0},"normal_scale":1,"resolution":1,"roughness":1,"type":"material"},{"contrast":1000,"model_data":{"global":"float mandelbrot(vec2 uv) {\n float di = 1.0;\n vec2 z = vec2(0.0);\n float m2 = 0.0;\n vec2 dz = vec2(0.0);\n for( int i=0; i<200; i++ )\n {\n if (m2>1024.0 ) {\n\t\t\tdi=0.0;\n\t\t\tbreak;\n\t\t}\n\n\t\t// Z' -> 2·Z·Z' + 1\n dz = 2.0*vec2(z.x*dz.x-z.y*dz.y, z.x*dz.y + z.y*dz.x) + vec2(1.0,0.0);\n\t\t\t\n // Z -> Z² + c\t\t\t\n z = vec2( z.x*z.x - z.y*z.y, 2.0*z.x*z.y ) + uv;\n\t\t\t\n m2 = dot(z,z);\n }\n\n // distance\t\n\t// d(c) = |Z|·log|Z|/|Z'|\n\tfloat d = 0.5*sqrt(dot(z,z)/dot(dz,dz))*log(dot(z,z));\n if( di>0.5 ) d=0.0;\n\treturn d;\n}","instance":"float $(name)_xyz(vec2 uv) {\n\treturn mandelbrot(uv);\n}","name":"Mandelbrot","outputs":[{"f":"clamp($(name)_xyz(vec2($(x), $(y))+$(scale)*(2.0*$(uv)-1.0))*$(contrast), 0.0, 1.0)"}],"parameters":[{"label":"Scale","max":3,"min":0,"name":"scale","step":0,"type":"float"},{"label":"X","max":2,"min":-2,"name":"x","step":0,"type":"float"},{"label":"Y","max":2,"min":-2,"name":"y","step":0,"type":"float"},{"label":"Label","max":1000,"min":1,"name":"contrast","step":0,"type":"float"}]},"name":"custom_0","node_position":{"x":-241,"y":223},"scale":0.046875,"type":"custom","x":0,"y":0.6875},{"gradient":{"points":[{"b":0,"g":0,"pos":0,"r":1},{"b":0,"g":0.96875,"pos":0.2,"r":1},{"b":0.0625,"g":1,"pos":0.4,"r":0},{"b":1,"g":1,"pos":0.618182,"r":0},{"b":0.965909,"g":0,"pos":0.818182,"r":0},{"b":1,"g":0,"pos":1,"r":0.9375}],"type":"Gradient"},"name":"colorize_0","node_position":{"x":1.25,"y":77.75},"type":"colorize"}]}
|
Loading…
Reference in New Issue
Block a user