fixed texture loading
This commit is contained in:
@@ -24,6 +24,11 @@ float calcBrightness(vec3 lightPos, vec3 vertPos, vec3 normal)
|
||||
return diffuse * clamp(1.0 - distance(lightPos, vertPos) * 0.01, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float calcBrightnessDirectional(vec3 sunDir, vec3 normal)
|
||||
{
|
||||
return max(0.0, dot(sunDir, normal));
|
||||
}
|
||||
|
||||
float circles(vec2 uv, float level, float subLevel, float brightness)
|
||||
{
|
||||
vec2 offsetUv = uv + 0.5;
|
||||
@@ -57,7 +62,9 @@ void main()
|
||||
float testSpeed = 1.0;
|
||||
vec3 testOffset = vec3(0.0, 0.0, 50.0);
|
||||
float3 lightPos = vec3(sin(u_time.x * testSpeed) * testRadius, 5.0, cos(u_time.x * testSpeed) * testRadius);
|
||||
float brightness = calcBrightness(lightPos, v_wpos, v_normal);
|
||||
// float brightness = calcBrightness(lightPos, v_wpos, v_normal);
|
||||
float brightness = calcBrightnessDirectional(vec3(0.5, 0.3, 1.0), v_normal);
|
||||
// brightness = 1.0;
|
||||
// brightness = 0.1 + brightness * 0.9;
|
||||
|
||||
float baseScale = 2.0;
|
||||
@@ -80,12 +87,15 @@ void main()
|
||||
|
||||
vec2 uv = v_uv0 * exp2(patternScaleLevel);
|
||||
float dither = circles(uv, patternScaleLevel, patternFractional, brightness);
|
||||
vec3 color = desaturate(u_testColor.xyz) * 0.01 + dither * u_testColor.xyz * 0.95;
|
||||
vec3 texColor = u_testColor.x > 0.1 ? u_testColor.xyz : texture2D(s_texColor, v_uv0).xyz;
|
||||
vec3 color = desaturate(texColor) * 0.01 + dither * texColor * 0.95;
|
||||
vec3 smoothColor = brightness * u_testColor.xyz;
|
||||
vec3 mixedColor = 0.1 * smoothColor + 0.9 * color;
|
||||
gl_FragColor = vec4(mixedColor, 1.0);
|
||||
// gl_FragColor = vec4(mixedColor, 1.0);
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
// gl_FragColor = brightness;
|
||||
// gl_FragColor = dither;
|
||||
// gl_FragColor = u_testColor;
|
||||
gl_FragColor = texture2D(s_texColor, v_uv0);
|
||||
// gl_FragColor = texture2D(s_texColor, v_uv0);
|
||||
// gl_FragColor = vec4(v_normal, 1.0);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,5 @@ void main()
|
||||
v_color0 = a_color0;
|
||||
v_uv0 = a_texcoord0;
|
||||
v_wpos = mul(u_model[0], vec4(a_position, 1.0)).xyz;
|
||||
|
||||
v_normal = normalize(mul(mat3(u_model[0]), a_normal));
|
||||
v_normal = normalize(mul(u_model[0], a_normal));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user