address reviewers comments

- get rid of "thin layer thickness" property
- make absorption a vec3
This commit is contained in:
Pixelflinger
2019-12-08 22:18:18 -08:00
committed by Mathias Agopian
parent eb767abc55
commit 57b48e0719
5 changed files with 18 additions and 10 deletions
@@ -153,7 +153,7 @@ enum MaterialDomain : uint8_t {
// can't really use std::underlying_type<AttributeIndex>::type because the driver takes a uint32_t
using AttributeBitset = utils::bitset32;
static constexpr size_t MATERIAL_PROPERTIES_COUNT = 24;
static constexpr size_t MATERIAL_PROPERTIES_COUNT = 23;
enum class Property : uint8_t {
BASE_COLOR, // float4, all shading models
ROUGHNESS, // float, lit shading models only
@@ -176,9 +176,8 @@ enum class Property : uint8_t {
POST_LIGHTING_COLOR, // float4, all shading models
CLIP_SPACE_TRANSFORM, // mat4, vertex shader only
IOR, // float, index of refraction (activate refraction)
ABSORPTION, // float, how much light is absorbed by the material
ABSORPTION, // float3, how much light is absorbed by the material
TRANSMISSION, // float, how much light is refracted through the material
THIN_LAYER_THICKNESS, // float, thin layer thickness
// when adding new Properties, make sure to update MATERIAL_PROPERTIES_COUNT
-1
View File
@@ -44,7 +44,6 @@ std::unordered_map<std::string, Property> Enums::mStringToProperty = {
{ "ior", Property::IOR },
{ "absorption", Property::ABSORPTION },
{ "transmission", Property::TRANSMISSION },
{ "thin_layer_thickness",Property::THIN_LAYER_THICKNESS },
};
template <>
@@ -550,7 +550,6 @@ char const* CodeGenerator::getConstantName(MaterialBuilder::Property property) n
case Property::IOR: return "IOR";
case Property::ABSORPTION: return "ABSORPTION";
case Property::TRANSMISSION: return "TRANSMISSION";
case Property::THIN_LAYER_THICKNESS: return "THIN_LAYER_THICKNESS";
}
}
+1 -3
View File
@@ -419,9 +419,8 @@ TEST_F(MaterialCompiler, StaticCodeAnalyzerIor) {
void material(inout MaterialInputs material) {
prepareMaterial(material);
material.ior = 1.5;
material.absorption = 0.0;
material.absorption = vec3(0.0);
material.transmission = 0.96;
material.thin_layer_thickness = 0.01;
}
)");
@@ -434,7 +433,6 @@ TEST_F(MaterialCompiler, StaticCodeAnalyzerIor) {
expected[size_t(filamat::MaterialBuilder::Property::IOR)] = true;
expected[size_t(filamat::MaterialBuilder::Property::ABSORPTION)] = true;
expected[size_t(filamat::MaterialBuilder::Property::TRANSMISSION)] = true;
expected[size_t(filamat::MaterialBuilder::Property::THIN_LAYER_THICKNESS)] = true;
EXPECT_TRUE(PropertyListsMatch(expected, properties));
}
+15 -2
View File
@@ -60,9 +60,12 @@ struct MaterialInputs {
#if defined(MATERIAL_HAS_IOR)
float ior;
float absorption;
#if defined(MATERIAL_HAS_ABSORPTION)
vec3 absorption;
#endif
#if defined(MATERIAL_HAS_TRANSMISSION)
float transmission;
float thin_layer_thickness;
#endif
#endif
};
@@ -118,4 +121,14 @@ void initMaterial(out MaterialInputs material) {
#if defined(MATERIAL_HAS_POST_LIGHTING_COLOR)
material.postLightingColor = vec4(0.0);
#endif
#if defined(MATERIAL_HAS_IOR)
material.ior = 1.5;
#if defined(MATERIAL_HAS_ABSORPTION)
material.absorption = vec3(0.0);
#endif
#if defined(MATERIAL_HAS_TRANSMISSION)
material.transmission = 0.96;
#endif
#endif
}