{"name":"511","type":"graph","parameters":{},"node_position":{"x":0,"y":0},"seed_int":0,"label":"Graph","shortdesc":"","longdesc":"","nodes":[{"name":"Material","type":"material","parameters":{"albedo_color":{"type":"Color","r":1,"g":1,"b":1,"a":1},"metallic":0,"roughness":1,"emission_energy":0,"normal":1,"ao":1,"depth_scale":0.7,"flags_transparent":false,"sss":0,"size":11},"node_position":{"x":2029,"y":-92},"seed_int":0,"export_paths":{}},{"name":"voronoi2","type":"voronoi2","parameters":{"scale_x":8,"scale_y":8,"stretch_x":1,"stretch_y":1,"intensity":1,"randomness":0.85},"node_position":{"x":-2174,"y":335},"seed_int":1884072448},{"name":"voronoi2_2","type":"voronoi2","parameters":{"scale_x":6,"scale_y":6,"stretch_x":1,"stretch_y":1,"intensity":1,"randomness":1},"node_position":{"x":-2185.340332,"y":576.901062},"seed_int":190614896},{"name":"math_2","type":"math","parameters":{"op":2,"default_in1":0,"default_in2":0,"clamp":false},"node_position":{"x":-1422.340332,"y":488.901062},"seed_int":0},{"name":"sharpen","type":"sharpen","parameters":{"size":5},"node_position":{"x":-292.340332,"y":358.901062},"seed_int":0},{"name":"radial_gradient","type":"radial_gradient","parameters":{"repeat":1,"gradient":{"type":"Gradient","points":[{"pos":0.400481,"r":1,"g":1,"b":1,"a":1},{"pos":0.718311,"r":0,"g":0,"b":0,"a":1}],"interpolation":1}},"node_position":{"x":-888.340332,"y":141.901062},"seed_int":0},{"name":"math_3","type":"math","parameters":{"op":2,"default_in1":0,"default_in2":3,"clamp":true},"node_position":{"x":-582.340332,"y":299.901062},"seed_int":0},{"name":"tones_step","type":"tones_step","parameters":{"value":0.15,"width":0.28,"invert":false},"node_position":{"x":141.659668,"y":136.901062},"seed_int":0},{"name":"math","type":"math","parameters":{"op":6,"default_in1":0,"default_in2":2,"clamp":false},"node_position":{"x":-133.678223,"y":139.390686},"seed_int":0},{"name":"blend2","type":"blend2","parameters":{"blend_type1":0,"amount1":0.71},"node_position":{"x":877.70166,"y":-140.297119},"seed_int":0,"generic_size":1},{"name":"uniform","type":"uniform","parameters":{"color":{"type":"Color","r":0.239216,"g":0.239216,"b":0.239216,"a":0}},"node_position":{"x":526.70166,"y":-241.297119},"seed_int":0},{"name":"uniform_2","type":"uniform","parameters":{"color":{"type":"Color","r":0.183594,"g":0.183594,"b":0.183594,"a":1}},"node_position":{"x":521.20166,"y":-148.297119},"seed_int":0},{"name":"uniform_3","type":"uniform","parameters":{"color":{"type":"Color","r":0.042969,"g":0.042969,"b":0.042969,"a":1}},"node_position":{"x":949.20166,"y":86.702881},"seed_int":0},{"name":"tones_step_2","type":"tones_step","parameters":{"value":0.15,"width":0.28,"invert":false},"node_position":{"x":481.70166,"y":-53.29715},"seed_int":0},{"name":"normal_map2","type":"normal_map2","parameters":{"param2":0,"size":11,"strength":-1,"buffer":1},"node_position":{"x":1555.70166,"y":264.702881},"seed_int":0},{"name":"blend2_2","type":"blend2","parameters":{"blend_type1":0,"amount1":1},"node_position":{"x":1227.70166,"y":97.702881},"seed_int":0,"generic_size":1},{"name":"math_4","type":"math","parameters":{"op":6,"default_in1":0,"default_in2":0.9,"clamp":false},"node_position":{"x":999.70166,"y":342.702881},"seed_int":0},{"name":"fast_blur","type":"fast_blur","parameters":{"param0":11,"param1":4,"param2":1,"param3":1},"node_position":{"x":393.70166,"y":333.702881},"seed_int":0},{"name":"graph_6","type":"graph","parameters":{"param0":10,"param1":0.1,"param2":15,"param3":0.08,"param4":4,"param5":2},"node_position":{"x":1400.70166,"y":-410.297119},"seed":6741,"label":"HBAO","shortdesc":"","longdesc":"","nodes":[{"name":"voronoi_3","type":"shader","parameters":{"radius":0.1,"angleBiasDeg":15,"intensity":2,"depth_scale":0.08,"quality":4},"node_position":{"x":-600.80072,"y":-894.601807},"seed":49449,"shader_model":{"code":"","global":"","inputs":[{"default":"0.0","function":true,"label":"","name":"in","type":"f"}],"instance":"//inspired by:\n//http://developer.download.nvidia.com/presentations/2008/SIGGRAPH/HBAO_SIG08b.pdf\n//https://gist.github.com/dotModded/981206ae1f4e760b7348\n//https://github.com/scanberg/hbao/blob/master/resources/shaders/hbao_full_frag.glsl\n//radius - radius of influence in screen space\n//angleBiasDeg - ~minimum angle for AO\n//intensity - increase strength of caclulated AO\n//noiseScale - for randomization values\nfloat $(name)_hbao(vec2 uv, float radius, float angleBiasDeg, float intensity, vec2 noiseScale) {\n int samplig_directions = 8;\n int steps = int($quality);\n\n float angleBias = 0.0174532925 * angleBiasDeg;\n\n vec3 c_point = vec3(uv*2.0 - 1.0, $in(uv)*$depth_scale);\n //fun with dfdx & dfdy - https://community.khronos.org/t/getting-the-normal-with-dfdx-and-dfdy/70177\n vec3 c_normal = normalize(cross(dFdx(c_point), dFdy(c_point)));\n\n\n float cosMaxRot = cos(6.28318530718 / float(samplig_directions));\n float sinMaxROt = sin(6.28318530718 / float(samplig_directions));\n \n // it should be faster than standard rotation in each iteartion\n mat2 deltaRotationMatrix = mat2(\n\tvec2(cosMaxRot, -sinMaxROt),\n\tvec2(sinMaxROt, cosMaxRot)\n );\n \n // calculate starting offset, as the smallest step\n vec2 offset_uv = vec2(1.0, 0.0) * (radius /float(steps));\n\n //randomize angle\n vec3 sampleNoise\t= rand3(uv * noiseScale);\n sampleNoise.xy\t = sampleNoise.xy * 2.0 - vec2(1.0);\n mat2 rotationMatrix = mat2(vec2(sampleNoise.x, -sampleNoise.y), \n\t\t\t\t\t\t\t vec2(sampleNoise.y, sampleNoise.x));\n \n // apply a random rotation to the base step vector\n offset_uv = rotationMatrix * offset_uv;\n \n float jitter = sampleNoise.z;\n float occlusion = 0.0;\n \n for (int i = 0; i < samplig_directions; ++i) {\n\t// incrementally rotate sample direction\n\toffset_uv = deltaRotationMatrix * offset_uv;\n\tfloat oldAngle = angleBias;\n\tfor (int j = 0; j < steps; ++j) {\n\t //add jitter & distance to offset UV\n\t vec2 sample_uv\t = uv + (jitter + float(j)) * offset_uv;\n\t vec3 s_point\t = vec3(sample_uv*2.0 - 1.0, $in(sample_uv)*$depth_scale);\n\t vec3 sample_tan = (s_point - c_point); //not sure if correct, but looks ok\n\t // 90 deg - (angle between normal from current point & sampled tangent)\n\t //https://math.stackexchange.com/questions/654315/how-to-convert-a-dot-product-of-two-vectors-to-the-angle-between-the-vectors\n\t float gamma = 1.57079632679 - acos(dot(c_normal, normalize(sample_tan)));\n\t \n\t if (gamma > oldAngle) {\n\t\tfloat value = sin(gamma) - sin(oldAngle);\n\t\tfloat attenuation = clamp(1.0 - pow(length(sample_tan.xy)/radius, 2.0), 0.0, 1.0);\n\t\tocclusion += attenuation * value;\n\t\t//occlusion += value;\n\t\toldAngle = gamma;\n\t }\n\t}\n }\n \n occlusion = 1.0 - occlusion / float(samplig_directions);\n return clamp(pow(occlusion, 1.0 + intensity), 0.0, 1.0);\n}","longdesc":"A node that generates several images from a tileable voronoi noise","name":"HBAO","outputs":[{"f":"$(name)_hbao($uv,$radius, $angleBiasDeg, $intensity, vec2(16.0,16.0))","longdesc":"A color pattern that assigns a random color to each cell","shortdesc":"Random color","type":"f"}],"parameters":[{"control":"None","default":0.01,"label":"Radius","longdesc":"The scale along the X axis","max":1,"min":0,"name":"radius","shortdesc":"Scale.x","step":0.01,"type":"float"},{"control":"None","default":30,"label":"Angle Bias","longdesc":"Angle bias for AO","max":90,"min":0,"name":"angleBiasDeg","shortdesc":"Angle Bias","step":1,"type":"float"},{"control":"None","default":0.2,"label":"Intensity","longdesc":"Change intensity of AO","max":5,"min":0,"name":"intensity","shortdesc":"Intensity","step":0.01,"type":"float"},{"control":"None","default":1,"label":"Depth Scale","longdesc":"Lineary scales depth values afecting cacluated normals & tangents","max":1,"min":0,"name":"depth_scale","shortdesc":"Depth Scale","step":0.01,"type":"float"},{"control":"None","default":4,"label":"Steps","longdesc":"Steps in given direction per ray","max":12,"min":1,"name":"quality","shortdesc":"Quality","step":1,"type":"float"}],"shortdesc":"Voronoi Noise"}},{"name":"gen_inputs","type":"ios","parameters":{},"node_position":{"x":-1338.030762,"y":-788.080872},"seed":43798,"ports":[{"group_size":0,"longdesc":"Greyscale heightmap","name":"input","shortdesc":"Input","type":"f"}]},{"name":"gen_outputs","type":"ios","parameters":{},"node_position":{"x":-902.684204,"y":-327.282288},"seed":42623,"ports":[{"group_size":0,"longdesc":"","name":"port0","shortdesc":"AO","type":"f"}]},{"name":"gen_parameters","type":"remote","parameters":{"param0":10,"param1":0.1,"param2":15,"param3":0.08,"param4":4,"param5":2},"node_position":{"x":-1488.979004,"y":-561.71167},"seed":58911,"widgets":[{"label":"Size","linked_widgets":[{"node":"voronoi_2","widget":"size"},{"node":"buffer_2","widget":"size"},{"node":"buffer_5","widget":"size"},{"node":"buffer_7","widget":"size"}],"name":"param0","shortdesc":"Size","type":"linked_control"},{"label":"Radius","linked_widgets":[{"node":"voronoi_3","widget":"radius"}],"longdesc":"Affected radius of point in UV size","name":"param1","shortdesc":"Radius","type":"linked_control"},{"label":"Angle Bias","linked_widgets":[{"node":"voronoi_3","widget":"angleBiasDeg"}],"longdesc":"Minimum angle on heightmap for AO to occur. Angle is calculated in UV space, where depth (grayscale input) is scaled by \"Depth Scale\" parameter","name":"param2","shortdesc":"Angle bias","type":"linked_control"},{"label":"Depth Scale","linked_widgets":[{"node":"voronoi_3","widget":"depth_scale"}],"longdesc":"Lineary scales depth values afecting cacluated normals & tangents","name":"param3","shortdesc":"Depth Scale","type":"linked_control"},{"label":"Quality","linked_widgets":[{"node":"voronoi_3","widget":"quality"}],"longdesc":"Number of steps per direction sampling","name":"param4","shortdesc":"Quality","type":"linked_control"},{"label":"Intensity","linked_widgets":[{"node":"voronoi_3","widget":"intensity"}],"longdesc":"Change intensity of calculated AO","name":"param5","shortdesc":"Intensity","type":"linked_control"}]},{"name":"voronoi_2","type":"shader","parameters":{"size":10,"sigma":3,"ksigma":4,"threshold":0.7},"node_position":{"x":-710.111145,"y":-596.459534},"seed":38722,"shader_model":{"code":"","global":"","inputs":[{"default":"0.0","function":true,"label":"","name":"in","type":"rgba"}],"instance":"//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n// Copyright (c) 2018-2019 Michele Morrone\n// All rights reserved.\n//\n// https://michelemorrone.eu - https://BrutPitt.com\n//\n// me@michelemorrone.eu - brutpitt@gmail.com\n// twitter: @BrutPitt - github: BrutPitt\n// \n// https://github.com/BrutPitt/glslSmartDeNoise/\n//\n// This software is distributed under the terms of the BSD 2-Clause license\n//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n// smartDeNoise - parameters\n//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n//\n// sampler2D tex\t - sampler image / texture\n// vec2 uv\t\t - actual fragment coord\n// float sigma > 0 - sigma Standard Deviation\n// float kSigma >= 0 - sigma coefficient \n//\t kSigma * sigma --> radius of the circular kernel\n// float threshold - edge sharpening threshold \nvec4 $(name)_smartDeNoise(vec2 uv, float sigma, float kSigma, float threshold)\n{\n\tfloat INV_SQRT_OF_2PI = 0.39894228040143267793994605993439; // 1.0/SQRT_OF_2PI\n\tfloat INV_PI = 0.31830988618379067153776752674503;\n\tfloat radius = round(kSigma*sigma);\n\tfloat radQ = radius * radius;\n\n\tfloat invSigmaQx2 = .5 / (sigma * sigma);\t // 1.0 / (sigma^2 * 2.0)\n\tfloat invSigmaQx2PI = INV_PI * invSigmaQx2;\t// 1/(2 * PI * sigma^2)\n\n\tfloat invThresholdSqx2 = .5 / (threshold * threshold);\t // 1.0 / (sigma^2 * 2.0)\n\tfloat invThresholdSqrt2PI = INV_SQRT_OF_2PI / threshold; // 1.0 / (sqrt(2*PI) * sigma^2)\n\n\tvec4 centrPx = $in(uv); \n\n\tfloat zBuff = 0.0;\n\tvec4 aBuff = vec4(0.0);\n\tvec2 size = vec2($size, $size);\n\n\tvec2 d;\n\tfor (d.x=-radius; d.x <= radius; d.x++) {\n\t\tfloat pt = sqrt(radQ-d.x*d.x);\t // pt = yRadius: have circular trend\n\t\tfor (d.y=-pt; d.y <= pt; d.y++) {\n\t\t\tfloat blurFactor = exp( -dot(d , d) * invSigmaQx2 ) * invSigmaQx2PI;\n\n\t\t\tvec4 walkPx = $in(uv+d/size);\n\t\t\tvec4 dC = walkPx-centrPx;\n\t\t\tfloat deltaFactor = exp( -dot(dC, dC) * invThresholdSqx2) * invThresholdSqrt2PI * blurFactor;\n\n\t\t\tzBuff += deltaFactor;\n\t\t\taBuff += deltaFactor*walkPx;\n\t\t}\n\t}\n\treturn aBuff/zBuff;\n}","longdesc":"A node that generates several images from a tileable voronoi noise","name":"Denoiser","outputs":[{"longdesc":"A color pattern that assigns a random color to each cell","rgba":"$(name)_smartDeNoise($uv, $sigma, $ksigma, $threshold)","shortdesc":"Random color","type":"rgba"}],"parameters":[{"default":10,"first":0,"label":"size","last":12,"longdesc":"The scale along the X axis","name":"size","shortdesc":"Scale.x","type":"size"},{"control":"None","default":0.5,"label":"Sigma","max":1,"min":0.005,"name":"sigma","step":0.1,"type":"float"},{"control":"None","default":0.5,"label":"kSigma","max":1,"min":0,"name":"ksigma","step":0.1,"type":"float"},{"control":"None","default":0.5,"label":"threshold","max":1,"min":0,"name":"threshold","step":0.1,"type":"float"}],"shortdesc":"Voronoi Noise"}},{"name":"buffer_5","type":"buffer","parameters":{"size":10},"node_position":{"x":-931.449646,"y":-724.330017},"seed":6771,"version":1},{"name":"buffer_7","type":"buffer","parameters":{"size":10},"node_position":{"x":-948.36377,"y":-449.796295},"seed":16139,"version":1},{"name":"buffer_2","type":"buffer","parameters":{"size":10},"node_position":{"x":-976.009644,"y":-975.5},"seed":42465,"version":1}],"connections":[{"from":"voronoi_3","from_port":0,"to":"buffer_5","to_port":0},{"from":"voronoi_2","from_port":0,"to":"buffer_7","to_port":0},{"from":"buffer_7","from_port":0,"to":"gen_outputs","to_port":0},{"from":"gen_inputs","from_port":0,"to":"buffer_2","to_port":0},{"from":"buffer_2","from_port":0,"to":"voronoi_3","to_port":0},{"from":"buffer_5","from_port":0,"to":"voronoi_2","to_port":0}]},{"name":"blend2_3","type":"blend2","parameters":{"blend_type1":2,"amount1":1},"node_position":{"x":1737.70166,"y":-221.297119},"seed_int":0,"generic_size":1}],"connections":[{"from":"voronoi2_2","from_port":0,"to":"math_2","to_port":1},{"from":"math_2","from_port":0,"to":"math_3","to_port":0},{"from":"radial_gradient","from_port":0,"to":"math_3","to_port":1},{"from":"math_3","from_port":0,"to":"sharpen","to_port":0},{"from":"voronoi2","from_port":0,"to":"math_2","to_port":0},{"from":"sharpen","from_port":0,"to":"math","to_port":0},{"from":"math","from_port":0,"to":"tones_step","to_port":0},{"from":"uniform","from_port":0,"to":"blend2","to_port":0},{"from":"uniform_2","from_port":0,"to":"blend2","to_port":1},{"from":"tones_step_2","from_port":0,"to":"blend2","to_port":2},{"from":"blend2","from_port":0,"to":"blend2_2","to_port":0},{"from":"uniform_3","from_port":0,"to":"blend2_2","to_port":1},{"from":"normal_map2","from_port":0,"to":"Material","to_port":4},{"from":"math_4","from_port":0,"to":"normal_map2","to_port":0},{"from":"tones_step","from_port":0,"to":"fast_blur","to_port":0},{"from":"fast_blur","from_port":0,"to":"tones_step_2","to_port":0},{"from":"fast_blur","from_port":0,"to":"math_4","to_port":0},{"from":"fast_blur","from_port":0,"to":"blend2_2","to_port":2},{"from":"fast_blur","from_port":0,"to":"graph_6","to_port":0},{"from":"blend2_2","from_port":0,"to":"blend2_3","to_port":0},{"from":"graph_6","from_port":0,"to":"blend2_3","to_port":1},{"from":"blend2_3","from_port":0,"to":"Material","to_port":0}]}