This is Mewa's official logo, shaped like an M.

Mewa Web Store

Become a publisher

Circle

by Mewatools

Draws a circle with gradient. This script is part of the material used in the video tutorial "Video compositing with GPU shaders"

Script
// "Circle" by Mewatools <hugo@mewatools.com> is licensed under CC BY 4.0 // draw a gradient circle shaderSource = " vec4 circle(vec2 uv, vec2 pos, vec2 rad, vec3 color) { float d = length(pos - uv) - length(rad); float t = smoothstep( -uGradient, uGradient, d); return vec4(color, 1.0-t ); } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = fragCoord.xy; vec2 center = uCenter / iResolution.xy; vec2 radius = center - (uRadius.xy / iResolution.xy); // Background layer vec4 background = vec4(0.77, 0.77, 0.77, 0.0); //const vec3 uColor = vec3(0.8, 0.3, 0.2); vec4 circlePixel = circle(uv, center, radius, uColor); // Blend the two fragColor = mix(background, circlePixel, circlePixel.a ); }"; node = ShaderNode( shaderSource, "Circle" ); node.addShaderInput("iResolution"); uiControl = node.addMouseControl( "uRadius", outputResolution() * [0.33, 0.33] // get pixel coordinates from percentages ); uiControl.setName("Radius"); uiControl.setStep( 1 ); uiControl = node.addMouseControl( "uCenter", outputResolution() * [0.5, 0.5] // get pixel coordinates from percentages ); uiControl.setName("Center"); uiControl.setStep( 1 ); uiControl = node.addFloatControl("uGradient", 0.001); uiControl.setName("Gradient"); uiControl.setStep(0.0001); uiControl.setRange(0.0, 1.0); colorControl = node.addColorControl( "uColor", 0.8, 0.33, 0.33 ); colorControl.setName("Color"); node.finishAdding();
File Details
  • File Name: Circle.mw
  • Last Update: May 22nd, 2021
  • Category: Other
CC BY