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:
authorL. E. Segovia <leonardo.segovia@cs.uns.edu.ar>2018-07-18 12:14:43 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-18 14:59:06 +0300
commit5078b9d2d08a34ae3786100c2301ea960165e7f2 (patch)
tree64d375c93428292fbba4f58c8ab4f097874eeefb /source/blender/makesrna/intern/rna_nodetree.c
parent566b319335563888e252b2186c93606ad41ff216 (diff)
Cycles: add Principled Hair BSDF.
This is a physically-based, easy-to-use shader for rendering hair and fur, with controls for melanin, roughness and randomization. Based on the paper "A Practical and Controllable Hair and Fur Model for Production Path Tracing". Implemented by Leonardo E. Segovia and Lukas Stockner, part of Google Summer of Code 2018.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 52fbadd0f54..b41e9b1c4e5 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -3350,6 +3350,13 @@ static const EnumPropertyItem node_hair_items[] = {
{0, NULL, 0, NULL, NULL}
};
+static const EnumPropertyItem node_principled_hair_items[] = {
+ {SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION, "ABSORPTION", 0, "Absorption coefficient", "Directly set the absorption coefficient sigma_a. This is not the most intuitive way to color hair."},
+ {SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION, "MELANIN", 0, "Melanin concentration", "Define the melanin concentrations below to get the most realistic-looking hair. You can get the concentrations for different types of hair online."},
+ {SHD_PRINCIPLED_HAIR_REFLECTANCE, "COLOR", 0, "Direct coloring", "Choose the color of your preference, and the shader will approximate the absorption coefficient to render lookalike hair."},
+ {0, NULL, 0, NULL, NULL}
+};
+
static const EnumPropertyItem node_script_mode_items[] = {
{NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
{NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
@@ -4409,6 +4416,21 @@ static void def_hair(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+/* RNA initialization for the custom property. */
+static void def_hair_principled(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Color parametrization", "Select the shader's color parametrization");
+ RNA_def_property_enum_items(prop, node_principled_hair_items);
+ RNA_def_property_enum_default(prop, SHD_PRINCIPLED_HAIR_REFLECTANCE);
+ /* Upon editing, update both the node data AND the UI representation */
+ /* (This effectively shows/hides the relevant sockets) */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
+}
+
static void def_sh_uvmap(StructRNA *srna)
{
PropertyRNA *prop;