1.越接近白色,越明亮
等比例缩放颜色,值越小越暗
#define PI 3.1415926
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = (fragCoord.xy - 0.5 * iResolution.xy) / iResolution.y;
vec3 orignal = vec3(1.0,1.0,0);
orignal *= abs(sin(iTime));
fragColor = vec4(orignal,1.0);
}
效果:
2.显示R通道
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// 定义贴图坐标
vec2 uv = fragCoord / iResolution.xy;
// 采样贴图
vec3 color = texture(iChannel0, uv).rgb;
// 输出颜色
fragColor = vec4(color, 1.0);
}
显示r通道
fragColor = vec4(vec3(color.r), 1.0);