Eevee: Expose Shadow filter size.

This commit is contained in:
2017-09-02 01:42:34 +02:00
parent 32e96448b9
commit f46b908cc5
6 changed files with 15 additions and 6 deletions

View File

@@ -377,9 +377,12 @@ class DATA_PT_EEVEE_shadow(DataButtonsPanel, Panel):
split = layout.split()
split.active = lamp.use_shadow
col = split.column(align=True)
sub = split.column()
col = sub.column(align=True)
col.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
col.prop(lamp, "shadow_buffer_clip_end", text="Clip End")
col = sub.column()
col.prop(lamp, "shadow_buffer_soft", text="Soft")
col = split.column(align=True)
col.prop(lamp, "shadow_buffer_bias", text="Bias")

View File

@@ -754,6 +754,7 @@ void EEVEE_draw_shadows(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl)
srd->shadow_inv_samples_ct = 1.0f / srd->shadow_samples_ct;
srd->clip_near = la->clipsta;
srd->clip_far = la->clipend;
srd->filter_size = la->soft * 0.0005f;
copy_v3_v3(srd->position, ob->obmat[3]);
for (int j = 0; j < 6; j++) {
float tmp[4][4];

View File

@@ -231,6 +231,7 @@ typedef struct EEVEE_ShadowRender {
float clip_far;
float shadow_samples_ct;
float shadow_inv_samples_ct;
float filter_size;
} EEVEE_ShadowRender;
/* ************ VOLUME DATA ************ */

View File

@@ -25,6 +25,7 @@ layout(std140) uniform shadow_render_block {
float farClip;
float shadowSampleCount;
float shadowInvSampleCount;
float shadowFilterSize;
};
flat in int shFace; /* Shadow layer we are rendering to. */

View File

@@ -9,6 +9,7 @@ layout(std140) uniform shadow_render_block {
float farClip;
float shadowSampleCount;
float shadowInvSampleCount;
float shadowFilterSize;
};
layout(triangles) in;

View File

@@ -9,6 +9,7 @@ layout(std140) uniform shadow_render_block {
float farClip;
float shadowSampleCount;
float shadowInvSampleCount;
float shadowFilterSize;
};
#ifdef CSM
@@ -35,12 +36,13 @@ vec3 octahedral_to_cubemap_proj(vec2 co)
void make_orthonormal_basis(vec3 N, float rot, out vec3 T, out vec3 B)
{
vec3 UpVector = (abs(N.z) < max(abs(N.x), abs(N.y))) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 UpVector = (abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 nT = normalize(cross(UpVector, N));
vec3 nB = cross(N, nT);
/* Rotate tangent space */
vec2 dir = vec2(cos(rot * 3.1415 * 2.0), sin(rot * 3.1415 * 2.0));
float angle = rot * 3.1415 * 2.0;
vec2 dir = vec2(cos(angle), sin(angle));
T = dir.x * nT + dir.y * nB;
B = -dir.y * nT + dir.x * nB;
}
@@ -138,7 +140,7 @@ void main() {
uvs.xy = fract(uvs.xy);
/* get cubemap vector */
vec3 cubevec = octahedral_to_cubemap_proj(uvs.xy);
vec3 cubevec = normalize(octahedral_to_cubemap_proj(uvs.xy));
/* TODO Can be optimized by groupping fetches
* and by converting to radial distance beforehand. */
@@ -146,8 +148,8 @@ void main() {
vec3 T, B;
make_orthonormal_basis(cubevec, wang_hash_noise(0u), T, B);
T *= 0.01;
B *= 0.01;
T *= shadowFilterSize;
B *= shadowFilterSize;
#ifdef ESM
float accum = 0.0;