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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-03-29 21:18:08 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-29 21:18:19 +0300
commitd6747f310f1235084e37d871212fb66aff37ba13 (patch)
treec209d23b1f57045f6806a1f3da84ffa852bd7149 /source
parentf0a20ae1c9505342721f841bcf537d465b5a54eb (diff)
Eevee: Material: Decouple transparent shadows from blend mode
This makes it easier to exclude a surface from casting shadows and can be used to manipulate the shadows even for opaque surfaces. Versionning ensure that old behavior is transfered to new rendering logic.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/intern/material.c1
-rw-r--r--source/blender/blenloader/intern/versioning_280.c9
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c50
-rw-r--r--source/blender/makesrna/intern/rna_material.c8
5 files changed, 37 insertions, 33 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 66d0c3c4cac..9ae85725488 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -24,7 +24,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 52
+#define BLENDER_SUBVERSION 53
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index f708984e51f..52e7c687694 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -142,6 +142,7 @@ void BKE_material_init(Material *ma)
ma->alpha_threshold = 0.5f;
+ ma->blend_shadow = MA_BS_SOLID;
}
Material *BKE_material_add(Main *bmain, const char *name)
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 522d036818d..960fb3b417c 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2945,6 +2945,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
} FOREACH_NODETREE_END;
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 53)) {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+ /* Eevee: Keep material appearance consistent with previous behavior. */
+ if (!mat->use_nodes || !mat->nodetree || mat->blend_method == MA_BM_SOLID) {
+ mat->blend_shadow = MA_BS_SOLID;
+ }
+ }
+ }
+
{
/* Versioning code until next subversion bump goes here. */
}
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index ad49d3f8ae7..99a3c0c06cc 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1624,34 +1624,28 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
}
/* Shadow Pass */
- if (ma->use_nodes && ma->nodetree && (ma->blend_method != MA_BM_SOLID)) {
- struct GPUMaterial *gpumat;
- switch (ma->blend_shadow) {
- case MA_BS_SOLID:
- EEVEE_lights_cache_shcaster_add(
- sldata, stl, mat_geom[i], ob);
- *cast_shadow = true;
- break;
- case MA_BS_CLIP:
- gpumat = EEVEE_material_mesh_depth_get(scene, ma, false, true);
- EEVEE_lights_cache_shcaster_material_add(
- sldata, psl, gpumat, mat_geom[i], ob, &ma->alpha_threshold);
- *cast_shadow = true;
- break;
- case MA_BS_HASHED:
- gpumat = EEVEE_material_mesh_depth_get(scene, ma, true, true);
- EEVEE_lights_cache_shcaster_material_add(
- sldata, psl, gpumat, mat_geom[i], ob, NULL);
- *cast_shadow = true;
- break;
- case MA_BS_NONE:
- default:
- break;
- }
- }
- else {
- EEVEE_lights_cache_shcaster_add(sldata, stl, mat_geom[i], ob);
- *cast_shadow = true;
+ struct GPUMaterial *gpumat;
+ switch (ma->blend_shadow) {
+ case MA_BS_SOLID:
+ EEVEE_lights_cache_shcaster_add(
+ sldata, stl, mat_geom[i], ob);
+ *cast_shadow = true;
+ break;
+ case MA_BS_CLIP:
+ gpumat = EEVEE_material_mesh_depth_get(scene, ma, false, true);
+ EEVEE_lights_cache_shcaster_material_add(
+ sldata, psl, gpumat, mat_geom[i], ob, &ma->alpha_threshold);
+ *cast_shadow = true;
+ break;
+ case MA_BS_HASHED:
+ gpumat = EEVEE_material_mesh_depth_get(scene, ma, true, true);
+ EEVEE_lights_cache_shcaster_material_add(
+ sldata, psl, gpumat, mat_geom[i], ob, NULL);
+ *cast_shadow = true;
+ break;
+ case MA_BS_NONE:
+ default:
+ break;
}
}
}
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 9e8604fb948..5445db78582 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -677,8 +677,8 @@ void RNA_def_material(BlenderRNA *brna)
static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
{MA_BS_NONE, "NONE", 0, "None", "Material will cast no shadow"},
{MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
- {MA_BS_CLIP, "CLIP", 0, "Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
- {MA_BS_HASHED, "HASHED", 0, "Hashed", "Use noise to dither the binary visibility and use filtering to reduce the noise"},
+ {MA_BS_CLIP, "CLIP", 0, "Alpha Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
+ {MA_BS_HASHED, "HASHED", 0, "Alpha Hashed", "Use noise to dither the binary visibility and use filtering to reduce the noise"},
{0, NULL, 0, NULL, NULL},
};
@@ -693,10 +693,10 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
- prop = RNA_def_property(srna, "transparent_shadow_method", PROP_ENUM, PROP_NONE);
+ prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "blend_shadow");
RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
- RNA_def_property_ui_text(prop, "Transparent Shadow", "Shadow mapping method for transparent material");
+ RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);