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:
authorClément Foucault <foucault.clem@gmail.com>2018-07-10 16:02:25 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-07-10 16:31:34 +0300
commit1a43e081873415754950766edaddad220adf67bc (patch)
tree6a4e61b2337606daf442973d9f82e1d56b906a98 /source/blender/makesdna
parent97f90d48a02eef89949532b166f57ea178ee5a87 (diff)
Eevee: LightCache: Initial Implementation
This separate probe rendering from viewport rendering, making possible to run the baking in another thread (non blocking and faster). The baked lighting is saved in the blend file. Nothing needs to be recomputed on load. There is a few missing bits / bugs: - Cache cannot be saved to disk as a separate file, it is saved in the DNA for now making file larger and memory usage higher. - Auto update only cubemaps does update the grids (bug). - Probes cannot be updated individually (considered as dynamic). - Light Cache cannot be (re)generated during render.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_lightprobe_types.h72
-rw-r--r--source/blender/makesdna/DNA_scene_types.h9
2 files changed, 81 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h
index 86d4645ecf5..c06d75a4021 100644
--- a/source/blender/makesdna/DNA_lightprobe_types.h
+++ b/source/blender/makesdna/DNA_lightprobe_types.h
@@ -106,6 +106,78 @@ enum {
LIGHTPROBE_SHAPE_BOX = 1,
};
+/* ------- Eevee LightProbes ------- */
+/* Needs to be there because written to file
+ * with the lightcache. */
+
+typedef struct LightProbeCache {
+ float position[3], parallax_type;
+ float attenuation_fac;
+ float attenuation_type;
+ float pad3[2];
+ float attenuationmat[4][4];
+ float parallaxmat[4][4];
+} LightProbeCache;
+
+typedef struct LightGridCache {
+ float mat[4][4];
+ int resolution[3], offset; /* offset to the first irradiance sample in the pool. */
+ float corner[3], attenuation_scale;
+ float increment_x[3], attenuation_bias; /* world space vector between 2 opposite cells */
+ float increment_y[3], level_bias;
+ float increment_z[3], pad4;
+ float visibility_bias, visibility_bleed, visibility_range, pad5;
+} LightGridCache;
+
+/* ------ Eevee Lightcache ------- */
+
+typedef struct LightCacheTexture {
+ struct GPUTexture *tex;
+ /* Copy of GPU datas to create GPUTextures on file read. */
+ char *data;
+ int tex_size[3];
+ char data_type;
+ char components;
+ char pad[2];
+} LightCacheTexture;
+
+typedef struct LightCache {
+ int flag;
+ /* only a single cache for now */
+ int cube_len, grid_len; /* Number of probes to use for rendering. */
+ int mips_len; /* Number of mipmap level to use. */
+ int vis_res, ref_res; /* Size of a visibility/reflection sample. */
+ int pad[2];
+ /* In the future, we could create a bigger texture containing
+ * multiple caches (for animation) and interpolate between the
+ * caches overtime to another texture. */
+ LightCacheTexture grid_tx;
+ LightCacheTexture cube_tx; /* Contains data for mipmap level 0. */
+ LightCacheTexture *cube_mips; /* Does not contains valid GPUTexture, only data. */
+ /* All lightprobes data contained in the cache. */
+ LightProbeCache *cube_data;
+ LightGridCache *grid_data;
+} LightCache;
+
+/* LightCache->flag */
+enum {
+ LIGHTCACHE_BAKED = (1 << 0),
+ LIGHTCACHE_BAKING = (1 << 1),
+ LIGHTCACHE_CUBE_READY = (1 << 2),
+ LIGHTCACHE_GRID_READY = (1 << 3),
+ /* Update tagging */
+ LIGHTCACHE_UPDATE_CUBE = (1 << 4),
+ LIGHTCACHE_UPDATE_GRID = (1 << 5),
+ LIGHTCACHE_UPDATE_WORLD = (1 << 6),
+};
+
+/* EEVEE_LightCacheTexture->data_type */
+enum {
+ LIGHTCACHETEX_BYTE = (1 << 0),
+ LIGHTCACHETEX_FLOAT = (1 << 1),
+ LIGHTCACHETEX_UINT = (1 << 2),
+};
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index f8d7e657b76..e6ad7835b24 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1389,6 +1389,9 @@ typedef struct SceneEEVEE {
int gi_cubemap_resolution;
int gi_visibility_resolution;
+ float gi_cubemap_draw_size;
+ float gi_irradiance_draw_size;
+
int taa_samples;
int taa_render_samples;
int sss_samples;
@@ -1428,6 +1431,9 @@ typedef struct SceneEEVEE {
int shadow_method;
int shadow_cube_size;
int shadow_cascade_size;
+
+ struct LightCache *light_cache;
+ char light_cache_info[64];
} SceneEEVEE;
/* *************************************************************** */
@@ -2101,6 +2107,9 @@ enum {
SCE_EEVEE_SSR_ENABLED = (1 << 14),
SCE_EEVEE_SSR_REFRACTION = (1 << 15),
SCE_EEVEE_SSR_HALF_RESOLUTION = (1 << 16),
+ SCE_EEVEE_SHOW_IRRADIANCE = (1 << 17),
+ SCE_EEVEE_SHOW_CUBEMAPS = (1 << 18),
+ SCE_EEVEE_GI_AUTOBAKE = (1 << 19),
};
/* SceneEEVEE->shadow_method */