Reactive Material

// MadMapper Reactive Material Tutorial Code/
*{
    "CREDIT": "Do something cool",
    "DESCRIPTION": "describe your material here",
    "TAGS": "template",
    "VSN": "1.0",
    "INPUTS": [ 
		{"LABEL": "Speed", "NAME": "mat_speed", "TYPE": "float", "MIN": 0.0, "MAX": 2.0, "DEFAULT": 1.0 }, 
    
{ "LABEL": "Noise/Noise Freq", "NAME": "mat_noiseFrequency", "TYPE": "float", "MIN": 0, "MAX": 10, "DEFAULT": 10 },
{ "LABEL": "Noise/Noise Position", "NAME": "mat_noisePosition", "TYPE": "float", "MIN": 0, "MAX": 1, "DEFAULT": 0.6 }, 
  { "LABEL": "Circles/Count", "NAME": "mat_circlesCount", "TYPE": "int", "MIN": 1, "MAX": 20, "DEFAULT": 20 }, 
 ],
	"GENERATORS": [
        {"NAME": "mat_time", "TYPE": "time_base", "PARAMS": {"speed": "mat_speed"} },
    ],
}*/

#include "MadSDF.glsl"
#include "MadNoise.glsl"

vec4 materialColorForPixel( vec2 texCoord )
{
	vec3 color = vec3( 0.0, .05, 0.5); //bkg color
   
	vec2 center = vec2( 0.5);
    vec2 uv = texCoord - center;

    float circleRadius = 0.25;

for (int i = 0; i < mat_circlesCount; i++) {
	float noisePosition = smoothstep(0.3 , 0.7, -uv.y + mat_noisePosition);
	
   // float noiseCircle = noise(vec3(uv * mat_noiseFrequency, mat_time)) * 0.05 * noisePosition;
	float noiseCircle = noise(vec3(uv * mat_noiseFrequency, i * 0.1 + mat_time)) * 0.05 * noisePosition;
   float circle = circle(uv, circleRadius) + noiseCircle;
    
color = stroke( color, vec3(1), circle, 0.005);
     
}
    return vec4(color, 1) ;
}

MadMapper Reactive Materials Documentation

Interactive Shader Format - ISF

Signed Distance Function

Inspiration:

Generative Artist's Website
Article about Signed Distance Functions

Last updated