Rename Schlick GGX to GGX.

Schlick's approximation and GGX are orthogonal concepts.

Furthermore, it's usage so far has been inconsistent: we don't even use it with anisotropic SchlickGGX, and Burley (Disney) diffuse does use it while its name doesn't indicate it.

The use of Schlick's approximation in Burley and GGX is an implementation detail and doesn't need to be reflected to the namig.
This commit is contained in:
Ferenc Arn 2017-10-21 19:35:54 -04:00
parent 50306041e5
commit cb0bf1edea
6 changed files with 11 additions and 11 deletions

View File

@ -1085,7 +1085,7 @@
</constant> </constant>
<constant name="DIFFUSE_TOON" value="4"> <constant name="DIFFUSE_TOON" value="4">
</constant> </constant>
<constant name="SPECULAR_SCHLICK_GGX" value="0"> <constant name="SPECULAR_GGX" value="0">
</constant> </constant>
<constant name="SPECULAR_BLINN" value="1"> <constant name="SPECULAR_BLINN" value="1">
</constant> </constant>

View File

@ -838,7 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_ggx"] = "#define SPECULAR_GGX\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n"; actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";

View File

@ -1065,7 +1065,7 @@ LIGHT_SHADER_CODE
#elif defined(SPECULAR_DISABLED) #elif defined(SPECULAR_DISABLED)
//none.. //none..
#elif defined(SPECULAR_SCHLICK_GGX) #elif defined(SPECULAR_GGX)
// shlick+ggx as default // shlick+ggx as default
vec3 H = normalize(V + L); vec3 H = normalize(V + L);
@ -1102,10 +1102,10 @@ LIGHT_SHADER_CODE
#if defined(LIGHT_USE_CLEARCOAT) #if defined(LIGHT_USE_CLEARCOAT)
if (clearcoat_gloss > 0.0) { if (clearcoat_gloss > 0.0) {
# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN) # if !defined(SPECULAR_GGX) && !defined(SPECULAR_BLINN)
vec3 H = normalize(V + L); vec3 H = normalize(V + L);
# endif # endif
# if !defined(SPECULAR_SCHLICK_GGX) # if !defined(SPECULAR_GGX)
float cNdotH = max(dot(N,H), 0.0); float cNdotH = max(dot(N,H), 0.0);
float cLdotH = max(dot(L,H), 0.0); float cLdotH = max(dot(L,H), 0.0);
float cLdotH5 = SchlickFresnel(cLdotH); float cLdotH5 = SchlickFresnel(cLdotH);

View File

@ -377,7 +377,7 @@ void SpatialMaterial::_update_shader() {
case DIFFUSE_TOON: code += ",diffuse_toon"; break; case DIFFUSE_TOON: code += ",diffuse_toon"; break;
} }
switch (specular_mode) { switch (specular_mode) {
case SPECULAR_SCHLICK_GGX: code += ",specular_schlick_ggx"; break; case SPECULAR_GGX: code += ",specular_ggx"; break;
case SPECULAR_BLINN: code += ",specular_blinn"; break; case SPECULAR_BLINN: code += ",specular_blinn"; break;
case SPECULAR_PHONG: code += ",specular_phong"; break; case SPECULAR_PHONG: code += ",specular_phong"; break;
case SPECULAR_TOON: code += ",specular_toon"; break; case SPECULAR_TOON: code += ",specular_toon"; break;
@ -1819,7 +1819,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Parameters", "params_"); ADD_GROUP("Parameters", "params_");
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_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_specular_mode", PROPERTY_HINT_ENUM, "GGX,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_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"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "params_depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never,Opaque Pre-Pass"), "set_depth_draw_mode", "get_depth_draw_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_depth_draw_mode", PROPERTY_HINT_ENUM, "Opaque Only,Always,Never,Opaque Pre-Pass"), "set_depth_draw_mode", "get_depth_draw_mode");
@ -2006,7 +2006,7 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR); BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR);
BIND_ENUM_CONSTANT(DIFFUSE_TOON); BIND_ENUM_CONSTANT(DIFFUSE_TOON);
BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX); BIND_ENUM_CONSTANT(SPECULAR_GGX);
BIND_ENUM_CONSTANT(SPECULAR_BLINN); BIND_ENUM_CONSTANT(SPECULAR_BLINN);
BIND_ENUM_CONSTANT(SPECULAR_PHONG); BIND_ENUM_CONSTANT(SPECULAR_PHONG);
BIND_ENUM_CONSTANT(SPECULAR_TOON); BIND_ENUM_CONSTANT(SPECULAR_TOON);
@ -2087,7 +2087,7 @@ SpatialMaterial::SpatialMaterial()
flags[i] = 0; flags[i] = 0;
} }
diffuse_mode = DIFFUSE_LAMBERT; diffuse_mode = DIFFUSE_LAMBERT;
specular_mode = SPECULAR_SCHLICK_GGX; specular_mode = SPECULAR_GGX;
for (int i = 0; i < FEATURE_MAX; i++) { for (int i = 0; i < FEATURE_MAX; i++) {
features[i] = false; features[i] = false;

View File

@ -193,7 +193,7 @@ public:
}; };
enum SpecularMode { enum SpecularMode {
SPECULAR_SCHLICK_GGX, SPECULAR_GGX,
SPECULAR_BLINN, SPECULAR_BLINN,
SPECULAR_PHONG, SPECULAR_PHONG,
SPECULAR_TOON, SPECULAR_TOON,

View File

@ -159,7 +159,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_burley"); shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_burley");
shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_toon"); shader_modes[VS::SHADER_SPATIAL].modes.insert("diffuse_toon");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_schlick_ggx"); shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_ggx");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_blinn"); shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_blinn");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_phong"); shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_phong");
shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_toon"); shader_modes[VS::SHADER_SPATIAL].modes.insert("specular_toon");