纹理操作: Mask 和 Blend ---- 青苔的生长与消失(GLSL源码)

请见Demo: Rendering & Art

这里模拟了青苔慢慢生长茂盛蔓延和消失的动态过程

上述效果的fragment shader代码(生成于自我的效果编辑器):


fragment shader code: 

#version 300 es
precision mediump float;
precision mediump int;
uniform sampler2D u_sampler0;
uniform sampler2D u_sampler1;
uniform sampler2D u_sampler2;
in vec2 v_uvs;
layout(location = 0) out vec4 fragOutput0;
uniform vec4 fV4U_0[1];

void main()
{
vec4 result4_1 = vec4(0.0);
vec4 color4;
color4 = texture(u_sampler0, v_uvs.xy);
result4_1 = color4;
result4_1.xyz = normalize(result4_1.xyz);
result4_1.xyz = pow(result4_1.xyz, vec3(4.0));
result4_1.xyz = result4_1.xyz * fV4U_0[0].x;
result4_1.xyz = clamp(result4_1.xyz * min(pow(result4_1.xyz + 1.5,vec3(2.0)) - 2.0, 2.0
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值