now using deferred rendering instead of forward rendering; some little problem: grid not render, shadow not impl
This commit is contained in:
@ -24,16 +24,16 @@ uniform sampler2D u_Texture;
|
||||
uniform bool u_Horizontal; // 未使用,可保留或移除
|
||||
uniform bool u_FirstPass; // 是否进行阈值处理
|
||||
uniform float u_Threshold; // 亮度阈值
|
||||
uniform int u_Quality;
|
||||
uniform float u_Directions; // 模糊方向数
|
||||
uniform float u_Size; // 模糊半径
|
||||
|
||||
void main()
|
||||
{
|
||||
float Pi = 6.28318530718; // 2*PI
|
||||
|
||||
float Directions = 32.0; // 模糊方向数
|
||||
float Quality = 6.0; // 每个方向上的采样质量(采样次数)
|
||||
float Size = 16.0; // 模糊半径
|
||||
|
||||
vec2 Radius = Size / textureSize(u_Texture, 0);
|
||||
vec2 Radius = u_Size / textureSize(u_Texture, 0);
|
||||
|
||||
// 中心像素采样
|
||||
vec3 centerColor = texture(u_Texture, v_TexCoord).rgb;
|
||||
@ -50,9 +50,9 @@ void main()
|
||||
float totalSamples = 1.0; // 有效采样计数(中心像素已计入)
|
||||
|
||||
// 周围像素采样
|
||||
for (float d = 0.0; d < Pi; d += Pi / Directions)
|
||||
for (float d = 0.0; d < Pi; d += Pi / u_Directions)
|
||||
{
|
||||
for (float i = 1.0 / Quality; i <= 1.0; i += 1.0 / Quality)
|
||||
for (float i = 1.0 / u_Quality; i <= 1.0; i += 1.0 / u_Quality)
|
||||
{
|
||||
vec2 offset = vec2(cos(d), sin(d)) * Radius * i;
|
||||
vec3 sampleColor = texture(u_Texture, v_TexCoord + offset).rgb;
|
||||
|
||||
Reference in New Issue
Block a user