noisemap tweaks and cleanup.
This commit is contained in:
@@ -43,6 +43,7 @@ uniform float ssao_radius;
|
||||
uniform float ssao_max_radius;
|
||||
uniform float ssao_factor;
|
||||
uniform vec2 kern_scale;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec3 decode_normal (vec2 enc)
|
||||
{
|
||||
@@ -87,7 +88,7 @@ vec2 getKern(int i)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy / kern_scale / 128).xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy * noise_scale).xy;
|
||||
|
||||
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
|
||||
float points = 1.0;
|
||||
|
||||
@@ -125,7 +125,6 @@ vary_normal = n;
|
||||
#if HAS_NORMAL_MAP
|
||||
vec3 t = normalize(normal_matrix * tangent.xyz);
|
||||
vec3 b = cross(n,t)*tangent.w;
|
||||
//vec3 t = cross(b,n) * binormal.w;
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
|
||||
@@ -53,6 +53,7 @@ VARYING vec4 vary_fragcoord;
|
||||
uniform float far_z;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
@@ -98,7 +99,7 @@ void main()
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
vec3 diff = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
vec3 npos = normalize(-pos);
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ uniform float size;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
@@ -210,7 +211,7 @@ void main()
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
||||
@@ -51,6 +51,7 @@ VARYING vec3 trans_center;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec4 viewport;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
@@ -108,7 +109,7 @@ void main()
|
||||
lv = normalize(lv);
|
||||
da = dot(norm, lv);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
|
||||
vec3 col = texture2D(diffuseRect, frag.xy).rgb;
|
||||
float fa = falloff+1.0;
|
||||
|
||||
@@ -64,6 +64,7 @@ VARYING vec3 trans_center;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
@@ -219,7 +220,7 @@ void main()
|
||||
|
||||
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
if (proj_tc.z > 0.0 &&
|
||||
|
||||
@@ -42,7 +42,7 @@ uniform vec2 kern_scale;
|
||||
void main()
|
||||
{
|
||||
frag_color[0] = 1.0;
|
||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * kern_scale).r;
|
||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * kern_scale).r; // Scales to handle lower-res ssao.
|
||||
frag_color[2] = 1.0;
|
||||
frag_color[3] = 1.0;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ uniform float size;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
@@ -225,7 +226,7 @@ void main()
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
||||
@@ -65,6 +65,7 @@ VARYING vec3 trans_center;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 noise_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
@@ -228,7 +229,7 @@ void main()
|
||||
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b; // This is probably wrong
|
||||
float noise = texture2D(noiseMap, frag.xy*noise_scale).b;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
if (proj_tc.z > 0.0 &&
|
||||
|
||||
Reference in New Issue
Block a user