Switched Burley/Lambert, and restored diffuse term to 0-1 range for compatibility.
This commit is contained in:
parent
d10e5eabed
commit
c9a925c4e0
3 changed files with 10 additions and 7 deletions
|
@ -932,7 +932,8 @@ LIGHT_SHADER_CODE
|
|||
vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) );
|
||||
float B = 0.45 * sigma2 / (sigma2 + 0.09);
|
||||
|
||||
light_amount = dotNL * (A + vec3(B) * s / t) / M_PI;
|
||||
// light_amount = dotNL * (A + vec3(B) * s / t) / M_PI;
|
||||
light_amount = dotNL * (A + vec3(B) * s / t);
|
||||
}
|
||||
|
||||
#elif defined(DIFFUSE_TOON)
|
||||
|
@ -952,7 +953,8 @@ LIGHT_SHADER_CODE
|
|||
float FD90 = 0.5 + 2.0 * LoH * LoH * roughness;
|
||||
float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoV);
|
||||
float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoL);
|
||||
light_amount = ( (1.0 / M_PI) * FdV * FdL ) * NoL;
|
||||
//light_amount = ( (1.0 / M_PI) * FdV * FdL ) * NoL;
|
||||
light_amount = ( FdV * FdL ) * NoL;
|
||||
/*
|
||||
float energyBias = mix(roughness, 0.0, 0.5);
|
||||
float energyFactor = mix(roughness, 1.0, 1.0 / 1.51);
|
||||
|
@ -965,7 +967,8 @@ LIGHT_SHADER_CODE
|
|||
}
|
||||
#else
|
||||
//lambert
|
||||
light_amount = dotNL / M_PI;
|
||||
// light_amount = dotNL / M_PI;
|
||||
light_amount = dotNL;
|
||||
#endif
|
||||
|
||||
#if defined(TRANSMISSION_USED)
|
||||
|
|
|
@ -370,10 +370,10 @@ void SpatialMaterial::_update_shader() {
|
|||
case CULL_DISABLED: code += ",cull_disabled"; break;
|
||||
}
|
||||
switch (diffuse_mode) {
|
||||
case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
|
||||
case DIFFUSE_LAMBERT: code += ",diffuse_lambert"; break;
|
||||
case DIFFUSE_LAMBERT_WRAP: code += ",diffuse_lambert_wrap"; break;
|
||||
case DIFFUSE_OREN_NAYAR: code += ",diffuse_oren_nayar"; break;
|
||||
case DIFFUSE_BURLEY: code += ",diffuse_burley"; break;
|
||||
case DIFFUSE_TOON: code += ",diffuse_toon"; break;
|
||||
}
|
||||
switch (specular_mode) {
|
||||
|
@ -1809,7 +1809,7 @@ void SpatialMaterial::_bind_methods() {
|
|||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR);
|
||||
|
||||
ADD_GROUP("Parameters", "params_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Lambert,Lambert Wrap,Oren Nayar,Burley,Toon"), "set_diffuse_mode", "get_diffuse_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Burley,Lambert,Lambert Wrap,Oren Nayar,Toon"), "set_diffuse_mode", "get_diffuse_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "SchlickGGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
|
||||
|
@ -1991,10 +1991,10 @@ void SpatialMaterial::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD);
|
||||
BIND_ENUM_CONSTANT(FLAG_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT);
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT_WRAP);
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR);
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
|
||||
BIND_ENUM_CONSTANT(DIFFUSE_TOON);
|
||||
|
||||
BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX);
|
||||
|
|
|
@ -185,10 +185,10 @@ public:
|
|||
};
|
||||
|
||||
enum DiffuseMode {
|
||||
DIFFUSE_BURLEY,
|
||||
DIFFUSE_LAMBERT,
|
||||
DIFFUSE_LAMBERT_WRAP,
|
||||
DIFFUSE_OREN_NAYAR,
|
||||
DIFFUSE_BURLEY,
|
||||
DIFFUSE_TOON,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue