Cleanup: Workbench: Remove checkerboard depth

This is not needed anymore with the new overlay xray fading.
This commit is contained in:
Clément Foucault 2020-02-24 01:23:55 +01:00
parent ed21506f26
commit 8955b8b992
4 changed files with 3 additions and 77 deletions

View File

@ -245,7 +245,6 @@ data_to_c_simple(engines/eevee/shaders/volumetric_integration_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_cavity_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_cavity_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_checkerboard_depth_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_common_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_data_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_deferred_composite_frag.glsl SRC)

View File

@ -1,38 +0,0 @@
/* 4x4 bayer matrix. */
#define P(x) ((x + 0.5) * (1.0 / 16.0))
const vec4 dither_mat[4] = vec4[4](vec4(P(0.0), P(8.0), P(2.0), P(10.0)),
vec4(P(12.0), P(4.0), P(14.0), P(6.0)),
vec4(P(3.0), P(11.0), P(1.0), P(9.0)),
vec4(P(15.0), P(7.0), P(13.0), P(5.0)));
uniform float threshold = 0.5;
uniform float offset = 0.0;
/* Noise dithering pattern
* 0 - Bayer matrix
* 1 - Interlieved gradient noise
*/
#define NOISE 1
void main()
{
#if NOISE == 0
ivec2 tx = ivec2(gl_FragCoord.xy) % 4;
float noise = dither_mat[tx.x][tx.y];
#elif NOISE == 1
/* Interlieved gradient noise by Jorge Jimenez
* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */
float noise = fract(
offset + 52.9829189 * fract(0.06711056 * gl_FragCoord.x + 0.00583715 * gl_FragCoord.y));
#else
# error
#endif
if (noise > threshold) {
discard;
}
else {
gl_FragDepth = 1.0;
}
}

View File

@ -56,7 +56,6 @@ static struct {
WORKBENCH_FORWARD_Shaders sh_data[GPU_SHADER_CFG_LEN];
struct GPUShader *composite_sh_cache[2];
struct GPUShader *checker_depth_sh;
struct GPUTexture *object_id_tx; /* ref only, not alloced */
struct GPUTexture *transparent_accum_tx; /* ref only, not alloced */
@ -72,7 +71,6 @@ extern char datatoc_workbench_forward_composite_frag_glsl[];
extern char datatoc_workbench_forward_depth_frag_glsl[];
extern char datatoc_workbench_forward_transparent_accum_frag_glsl[];
extern char datatoc_workbench_data_lib_glsl[];
extern char datatoc_workbench_checkerboard_depth_frag_glsl[];
extern char datatoc_workbench_object_outline_lib_glsl[];
extern char datatoc_workbench_curvature_lib_glsl[];
extern char datatoc_workbench_prepass_vert_glsl[];
@ -349,11 +347,6 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
WORKBENCH_PrivateData *wpd = stl->g_data;
workbench_private_data_init(wpd);
if (!e_data.checker_depth_sh) {
e_data.checker_depth_sh = DRW_shader_create_fullscreen(
datatoc_workbench_checkerboard_depth_frag_glsl, NULL);
}
workbench_forward_outline_shaders_ensure(wpd, draw_ctx->sh_cfg);
workbench_volume_engine_init();
@ -438,31 +431,9 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
workbench_aa_create_pass(vedata, &e_data.transparent_accum_tx);
}
/* Checker Depth */
{
static float noise_offset = 0.0f;
float blend_threshold = 0.0f;
if (DRW_state_is_image_render()) {
/* TODO: Should be based on the number of samples used for render. */
noise_offset = fmodf(noise_offset + 1.0f / 8.0f, 1.0f);
}
if (XRAY_ENABLED(wpd)) {
blend_threshold = 1.0f - XRAY_ALPHA(wpd) * 0.9f;
}
if (wpd->shading.type == OB_WIRE) {
wpd->shading.xray_alpha = 0.0f;
wpd->shading.xray_alpha_wire = 0.0f;
}
int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS;
psl->checker_depth_pass = DRW_pass_create("Checker Depth", state);
grp = DRW_shgroup_create(e_data.checker_depth_sh, psl->checker_depth_pass);
// DRW_shgroup_call(grp, DRW_cache_fullscreen_quad_get(), NULL);
DRW_shgroup_uniform_float_copy(grp, "threshold", blend_threshold);
DRW_shgroup_uniform_float_copy(grp, "offset", noise_offset);
if (wpd->shading.type == OB_WIRE) {
wpd->shading.xray_alpha = 0.0f;
wpd->shading.xray_alpha_wire = 0.0f;
}
}
@ -481,7 +452,6 @@ void workbench_forward_engine_free()
for (int index = 0; index < 2; index++) {
DRW_SHADER_FREE_SAFE(e_data.composite_sh_cache[index]);
}
DRW_SHADER_FREE_SAFE(e_data.checker_depth_sh);
workbench_volume_engine_free();
workbench_fxaa_engine_free();
@ -828,10 +798,6 @@ void workbench_forward_draw_scene(WORKBENCH_Data *vedata)
/* Color correct and Anti aliasing */
workbench_aa_draw_pass(vedata, e_data.composite_buffer_tx);
/* Apply checker pattern */
GPU_framebuffer_bind(dfbl->depth_only_fb);
DRW_draw_pass(psl->checker_depth_pass);
}
void workbench_forward_draw_finish(WORKBENCH_Data *vedata)

View File

@ -164,7 +164,6 @@ typedef struct WORKBENCH_PassList {
struct DRWPass *transparent_accum_pass;
struct DRWPass *object_outline_pass;
struct DRWPass *depth_pass;
struct DRWPass *checker_depth_pass;
} WORKBENCH_PassList;
typedef struct WORKBENCH_Data {