Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volumetrics: Blend from last frame to avoid ugly banding in viewport #9

Open
wants to merge 1 commit into
base: bonemaster292
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions release/scripts/startup/bl_ui/properties_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ def draw(self, context):
layout.active = props.use_volumetric_shadows
layout.prop(props, "volumetric_shadow_samples", text="Samples")

class RENDER_PT_eevee_volumetric_blending(RenderButtonsPanel, Panel):
bl_label = "Volumetric Blending"
bl_parent_id = "RENDER_PT_eevee_volumetric"
COMPAT_ENGINES = {'BLENDER_EEVEE'}

def draw_header(self, context):
scene = context.scene
props = scene.eevee
self.layout.prop(props, "use_volumetric_blending", text="")
def draw(self, context):
pass

class RENDER_PT_eevee_subsurface_scattering(RenderButtonsPanel, Panel):
bl_label = "Subsurface Scattering"
Expand Down Expand Up @@ -703,6 +714,7 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel, GreasePencilSim
RENDER_PT_eevee_volumetric,
RENDER_PT_eevee_volumetric_lighting,
RENDER_PT_eevee_volumetric_shadows,
RENDER_PT_eevee_volumetric_blending,
RENDER_PT_eevee_performance,
RENDER_PT_eevee_hair,
RENDER_PT_eevee_shadows,
Expand Down
4 changes: 3 additions & 1 deletion source/blender/draw/engines/eevee/eevee_volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
}

if (do_taa) {
common_data->vol_history_alpha = 0.0f;
if (!(scene_eval->eevee.flag & SCE_EEVEE_VOLUMETRIC_BLENDING)) { /* BoneMaster, Force to use frostbite's paper solution (blend from last frame) to avoid ugly banding */
common_data->vol_history_alpha = 0.0f;
}
current_sample = effects->taa_current_sample - 1;
effects->volume_current_sample = -1;
}
Expand Down
1 change: 1 addition & 0 deletions source/blender/makesdna/DNA_scene_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,7 @@ enum {
SCE_EEVEE_GI_AUTOBAKE = (1 << 19),
SCE_EEVEE_SHADOW_SOFT = (1 << 20),
SCE_EEVEE_OVERSCAN = (1 << 21),
SCE_EEVEE_VOLUMETRIC_BLENDING = (1 << 22),
};

/* SceneEEVEE->shadow_method */
Expand Down
7 changes: 7 additions & 0 deletions source/blender/makesrna/intern/rna_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -7261,6 +7261,13 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);

prop = RNA_def_property(srna, "use_volumetric_blending", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_BLENDING);
RNA_def_property_ui_text(
prop, "Volumetric Blending", "Enable volumes blending with previous frame");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);

prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise");
Expand Down