EEVEE-Next: Volume: Add custom integration range #120823
|
@ -463,13 +463,19 @@ class RENDER_PT_eevee_next_volumes_range(RenderButtonsPanel, Panel):
|
|||
def poll(cls, context):
|
||||
return (context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
def draw_header(self, context):
|
||||
scene = context.scene
|
||||
props = scene.eevee
|
||||
self.layout.prop(props, "use_volume_custom_range", text="")
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
props = scene.eevee
|
||||
|
||||
layout = self.layout
|
||||
layout.active = props.use_volume_custom_range
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(props, "volumetric_start")
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 18
|
||||
#define BLENDER_FILE_SUBVERSION 19
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
|
|
@ -3177,6 +3177,13 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 19)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* Keep legacy EEVEE old behavior. */
|
||||
scene->eevee.flag |= SCE_EEVEE_VOLUME_CUSTOM_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
|
|
@ -66,11 +66,11 @@ void VolumeModule::end_sync()
|
|||
|
||||
const Scene *scene_eval = inst_.scene;
|
||||
|
||||
/* Negate clip values (View matrix forward vector is -Z). */
|
||||
const float clip_start = -inst_.camera.data_get().clip_near;
|
||||
const float clip_end = -inst_.camera.data_get().clip_far;
|
||||
float integration_start = scene_eval->eevee.volumetric_start;
|
||||
float integration_end = scene_eval->eevee.volumetric_end;
|
||||
const bool custom_range = scene_eval->eevee.flag & SCE_EEVEE_VOLUME_CUSTOM_RANGE;
|
||||
const float camera_clip_start = inst_.camera.data_get().clip_near;
|
||||
const float camera_clip_end = inst_.camera.data_get().clip_far;
|
||||
float integration_start = custom_range ? scene_eval->eevee.volumetric_start : camera_clip_start;
|
||||
float integration_end = custom_range ? scene_eval->eevee.volumetric_end : camera_clip_end;
|
||||
|
||||
if (!inst_.camera.is_camera_object() && inst_.camera.is_orthographic()) {
|
||||
integration_start = -integration_end;
|
||||
|
@ -83,8 +83,9 @@ void VolumeModule::end_sync()
|
|||
integration_end = math::min(integration_end, -volume_bounds.value().min);
|
||||
}
|
||||
|
||||
float near = math::min(-integration_start, clip_start + 1e-4f);
|
||||
float far = math::max(-integration_end, clip_end - 1e-4f);
|
||||
/* Negate clip values (View matrix forward vector is -Z). */
|
||||
float near = -math::max(integration_start, camera_clip_start - 1e-4f);
|
||||
float far = -math::min(integration_end, camera_clip_end + 1e-4f);
|
||||
|
||||
if (assign_if_different(history_camera_is_perspective_, inst_.camera.is_perspective())) {
|
||||
/* Currently, the re-projection uses the same path for volume_z_to_view_z conversion for both
|
||||
|
|
|
@ -2844,6 +2844,7 @@ enum {
|
|||
SCE_EEVEE_SHADOW_ENABLED = (1 << 24),
|
||||
SCE_EEVEE_RAYTRACE_OPTIONS_SPLIT = (1 << 25),
|
||||
SCE_EEVEE_SHADOW_JITTERED_VIEWPORT = (1 << 26),
|
||||
SCE_EEVEE_VOLUME_CUSTOM_RANGE = (1 << 27),
|
||||
};
|
||||
|
||||
typedef enum RaytraceEEVEE_Flag {
|
||||
|
|
|
@ -8108,6 +8108,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, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_volume_custom_range", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_VOLUME_CUSTOM_RANGE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Volume Custom Range",
|
||||
"Enable custom start and end clip distances for volume computation");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
/* Ambient Occlusion */
|
||||
prop = RNA_def_property(srna, "use_gtao", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_GTAO_ENABLED);
|
||||
|
|
Loading…
Reference in New Issue