4 Star 0 Fork 0

cyb/Computer Graphics Second Experiment

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rain.fs 865 Bytes
一键复制 编辑 原始数据 按行查看 历史
cyb 提交于 2024-05-21 19:45 . 增加了雨滴效果
#version 330 core
out vec4 FragColor;
uniform vec3 rainColor;
uniform float alpha;
// Simple noise function
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
void main()
{
// Simulate the light effect on the raindrop by modifying the color and alpha
vec3 finalColor = rainColor;
float gradient = gl_FragCoord.y / 600.0; // Assuming the screen height is 600
float transparency = alpha * gradient;
// Add a slight blue tint to the raindrop
finalColor = mix(finalColor, vec3(0.0, 0.4, 1.0), 0.5 * gradient);
// Add some noise to make the raindrop more realistic
float noise = rand(gl_FragCoord.xy) * 0.2;
transparency = transparency * (0.6 + noise); // Increase transparency variation
// Adjust the final color and transparency
FragColor = vec4(finalColor, transparency);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cyb_c/computer-graphics-second-experiment.git
git@gitee.com:cyb_c/computer-graphics-second-experiment.git
cyb_c
computer-graphics-second-experiment
Computer Graphics Second Experiment
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385