Fix T60190 Z-fighting with (Culled) Backface
Create a separate pass for backface culled objects.
This commit is contained in:
parent
6d60207537
commit
f391362f8c
Notes:
blender-bot
2023-02-14 05:50:03 +01:00
Referenced by issue #60190, Z-fighting with (Culled) Backface
|
@ -269,6 +269,7 @@ static void eevee_draw_background(void *vedata)
|
|||
}
|
||||
EEVEE_draw_default_passes(psl);
|
||||
DRW_draw_pass(psl->material_pass);
|
||||
DRW_draw_pass(psl->material_pass_cull);
|
||||
EEVEE_subsurface_data_render(sldata, vedata);
|
||||
DRW_stats_group_end();
|
||||
|
||||
|
|
|
@ -833,7 +833,9 @@ static void lightbake_render_scene_face(int face, EEVEE_BakeRenderData *user_dat
|
|||
DRW_draw_pass(psl->depth_pass_cull);
|
||||
DRW_draw_pass(psl->probe_background);
|
||||
DRW_draw_pass(psl->material_pass);
|
||||
DRW_draw_pass(psl->material_pass_cull);
|
||||
DRW_draw_pass(psl->sss_pass); /* Only output standard pass */
|
||||
DRW_draw_pass(psl->sss_pass_cull);
|
||||
EEVEE_draw_default_passes(psl);
|
||||
}
|
||||
|
||||
|
@ -911,7 +913,9 @@ static void lightbake_render_scene_reflected(int layer, EEVEE_BakeRenderData *us
|
|||
/* Shading pass */
|
||||
EEVEE_draw_default_passes(psl);
|
||||
DRW_draw_pass(psl->material_pass);
|
||||
DRW_draw_pass(psl->material_pass_cull);
|
||||
DRW_draw_pass(psl->sss_pass); /* Only output standard pass */
|
||||
DRW_draw_pass(psl->sss_pass_cull);
|
||||
DRW_draw_pass(psl->refract_pass);
|
||||
|
||||
/* Transparent */
|
||||
|
|
|
@ -1037,7 +1037,8 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
|
||||
{
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES | DRW_STATE_WIRE;
|
||||
psl->material_pass = DRW_pass_create("Material Shader Pass", state);
|
||||
psl->material_pass = DRW_pass_create("Material Pass", state);
|
||||
psl->material_pass_cull = DRW_pass_create("Material Pass Cull", state | DRW_STATE_CULL_BACK);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1075,6 +1076,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
||||
DRW_STATE_WIRE | DRW_STATE_WRITE_STENCIL);
|
||||
psl->sss_pass = DRW_pass_create("Subsurface Pass", state);
|
||||
psl->sss_pass_cull = DRW_pass_create("Subsurface Pass Cull", state | DRW_STATE_CULL_BACK);
|
||||
e_data.sss_count = 0;
|
||||
}
|
||||
|
||||
|
@ -1230,7 +1232,8 @@ static void material_opaque(
|
|||
*shgrp = DRW_shgroup_material_create(
|
||||
*gpumat,
|
||||
(use_ssrefract) ? psl->refract_pass :
|
||||
(use_sss) ? psl->sss_pass : psl->material_pass);
|
||||
(use_sss) ? ((do_cull) ? psl->sss_pass_cull : psl->sss_pass)
|
||||
: ((do_cull) ? psl->material_pass_cull : psl->material_pass));
|
||||
|
||||
add_standard_uniforms(*shgrp, sldata, vedata, ssr_id, &ma->refract_depth,
|
||||
use_diffuse, use_glossy, use_refract, use_ssrefract, false);
|
||||
|
|
|
@ -253,7 +253,9 @@ typedef struct EEVEE_PassList {
|
|||
struct DRWPass *refract_depth_pass_clip_cull;
|
||||
struct DRWPass *default_pass[VAR_MAT_MAX];
|
||||
struct DRWPass *sss_pass;
|
||||
struct DRWPass *sss_pass_cull;
|
||||
struct DRWPass *material_pass;
|
||||
struct DRWPass *material_pass_cull;
|
||||
struct DRWPass *refract_pass;
|
||||
struct DRWPass *transparent_pass;
|
||||
struct DRWPass *background_pass;
|
||||
|
|
|
@ -555,6 +555,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
|
|||
GPU_framebuffer_bind(fbl->main_fb);
|
||||
EEVEE_draw_default_passes(psl);
|
||||
DRW_draw_pass(psl->material_pass);
|
||||
DRW_draw_pass(psl->material_pass_cull);
|
||||
EEVEE_subsurface_data_render(sldata, vedata);
|
||||
/* Effects pre-transparency */
|
||||
EEVEE_subsurface_compute(sldata, vedata);
|
||||
|
|
|
@ -285,6 +285,7 @@ void EEVEE_subsurface_data_render(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat
|
|||
|
||||
GPU_framebuffer_bind(fbl->main_fb);
|
||||
DRW_draw_pass(psl->sss_pass);
|
||||
DRW_draw_pass(psl->sss_pass_cull);
|
||||
|
||||
/* Restore */
|
||||
GPU_framebuffer_ensure_config(&fbl->main_fb, {
|
||||
|
|
Loading…
Reference in New Issue