个人博客 个人博客
首页
  • 前端
  • 后端
  • Git
  • Docker
  • 网络
  • 操作系统
工具
阅读
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

董先亮

前端react开发
首页
  • 前端
  • 后端
  • Git
  • Docker
  • 网络
  • 操作系统
工具
阅读
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 待整理
  • 相机
  • 核心
  • 几何体
  • 辅助对象
  • 灯光
  • 材质
  • 数学库
  • 物体
  • 控制
  • 常用方法
  • 三方库
  • 加载器
  • 纹理贴图
  • PBR
  • 相关网站
  • 场景
  • 全景投影方式
  • HDR
  • 渲染器
  • Geometry和BufferGeometry区别
  • WebGL
  • UV介绍
  • 数学知识
  • 着色器案例
    • 反复效果
    • 斑马线
    • 条纹相加
    • 条纹相乘
    • 条纹相减
    • 方块图形
  • blender
  • 后期处理
  • 缓冲区
  • 后期处理与分层渲染
  • 叠加渲染
  • Threejs
NeverStop1024
2022-10-01
目录

着色器案例

# 反复效果

// strength取值范围为[0,3]
float strength = mod(vUv.y * 50.0 , 3.0) ;

// strength取值范围为[0,1]
float strength = mod(vUv.y * 50.0 , 1.0) ;
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3
4
5
6

# 斑马线

//8利用step(edge, x)如果x < edge,返回0.0,否则返回1.0
// 白色,黑色占比,去改比较值就可以了
float strength =  mod(vUv.y * 10.0 , 1.0) ;
strength = step(0.5,strength);
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3
4
5

# 条纹相加

float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength += step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3

# 条纹相乘

float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength *= step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3

# 条纹相减

float strength = step(0.8, mod(vUv.x * 10.0 , 1.0)) ;
strength -= step(0.8, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3

# 方块图形

float strength = step(0.2, mod(vUv.x * 10.0 , 1.0)) ;
strength *= step(0.2, mod(vUv.y * 10.0 , 1.0)) ;
gl_FragColor =vec4(strength,strength,strength,1);
1
2
3
编辑 (opens new window)
上次更新: 2022/10/02
数学知识
blender

← 数学知识 blender→

最近更新
01
mock使用
07-12
02
websocket即时通讯
07-12
03
前端面试题
07-09
更多文章>
Theme by Vdoing | Copyright © 2022-2023 NeverStop1024 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式