Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2022-05-20 19:01:26 +0300
committerPatrick Mours <pmours@nvidia.com>2022-05-23 20:08:01 +0300
commita8c81ffa83122661b80e842ddd641e366b3d5c04 (patch)
treea366980386a9369edd4fda51d9d566fdf2d8743c /source/blender
parent14a5a91e0e033d712134c112a4778b495bd73ba1 (diff)
Cycles: Add half precision float support for volumes with NanoVDB
This patch makes it possible to change the precision with which to store volume data in the NanoVDB data structure (as float, half, or using variable bit quantization) via the previously unused precision field in the volume data block. It makes it possible to further reduce memory usage during rendering, at a slight cost to the visual detail of a volume. Differential Revision: https://developer.blender.org/D10023
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesdna/DNA_volume_defaults.h1
-rw-r--r--source/blender/makesdna/DNA_volume_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_volume.c15
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_volume_defaults.h b/source/blender/makesdna/DNA_volume_defaults.h
index ee98f0ea4fd..1057fc75d34 100644
--- a/source/blender/makesdna/DNA_volume_defaults.h
+++ b/source/blender/makesdna/DNA_volume_defaults.h
@@ -23,6 +23,7 @@
#define _DNA_DEFAULT_VolumeRender \
{ \
+ .precision = VOLUME_PRECISION_HALF, \
.space = VOLUME_SPACE_OBJECT, \
.step_size = 0.0f, \
.clipping = 0.001f, \
diff --git a/source/blender/makesdna/DNA_volume_types.h b/source/blender/makesdna/DNA_volume_types.h
index a2e558aa790..a25bfe0ebec 100644
--- a/source/blender/makesdna/DNA_volume_types.h
+++ b/source/blender/makesdna/DNA_volume_types.h
@@ -126,6 +126,13 @@ typedef enum VolumeWireframeDetail {
VOLUME_WIREFRAME_FINE = 1,
} VolumeWireframeDetail;
+/** #VolumeRender.precision */
+typedef enum VolumeRenderPrecision {
+ VOLUME_PRECISION_HALF = 0,
+ VOLUME_PRECISION_FULL = 1,
+ VOLUME_PRECISION_VARIABLE = 2,
+} VolumeRenderPrecision;
+
/** #VolumeRender.space */
typedef enum VolumeRenderSpace {
VOLUME_SPACE_OBJECT = 0,
diff --git a/source/blender/makesrna/intern/rna_volume.c b/source/blender/makesrna/intern/rna_volume.c
index 12cb35b239d..0c32ed45dce 100644
--- a/source/blender/makesrna/intern/rna_volume.c
+++ b/source/blender/makesrna/intern/rna_volume.c
@@ -485,6 +485,21 @@ static void rna_def_volume_render(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "VolumeRender");
RNA_def_struct_path_func(srna, "rna_VolumeRender_path");
+ static const EnumPropertyItem precision_items[] = {
+ {VOLUME_PRECISION_FULL, "FULL", 0, "Full", "Full float (Use 32 bit for all data)"},
+ {VOLUME_PRECISION_HALF, "HALF", 0, "Half", "Half float (Use 16 bit for all data)"},
+ {VOLUME_PRECISION_VARIABLE, "VARIABLE", 0, "Variable", "Use variable bit quantization"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "precision", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, precision_items);
+ RNA_def_property_ui_text(prop,
+ "Precision",
+ "Specify volume data precision. Lower values reduce memory consumption "
+ "at the cost of detail");
+ RNA_def_property_update(prop, 0, "rna_Volume_update_display");
+
static const EnumPropertyItem space_items[] = {
{VOLUME_SPACE_OBJECT,
"OBJECT",