diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2021-08-01 23:17:40 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-08-06 16:01:58 +0300 |
commit | 47a6bb2f284ec8527c51bc692d4671a116976284 (patch) | |
tree | 813160b7ee0778c0f93002dce20c4b047a455a05 | |
parent | d4e7a1af4416b6485ace5de19660d41cbe0fdb11 (diff) |
Fix a default shader specular render mode to (`SCHLICK_GGX`/`BLINN`)
-rw-r--r-- | scene/resources/visual_shader.cpp | 13 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl | 5 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl | 5 |
3 files changed, 12 insertions, 11 deletions
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index a23152a6d1..a6815da6f4 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1648,19 +1648,10 @@ void VisualShader::_update_shader() const { { //fill render mode enums int idx = 0; - bool specular = false; while (render_mode_enums[idx].string) { if (shader_mode == render_mode_enums[idx].mode) { - if (shader_mode == Shader::MODE_SPATIAL) { - if (String(render_mode_enums[idx].string) == "specular") { - specular = true; - } - } - if (modes.has(render_mode_enums[idx].string) || specular) { - int which = 0; - if (modes.has(render_mode_enums[idx].string)) { - which = modes[render_mode_enums[idx].string]; - } + if (modes.has(render_mode_enums[idx].string)) { + int which = modes[render_mode_enums[idx].string]; int count = 0; for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) { String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i]; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index b3a349c948..f0b484d50f 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -466,6 +466,11 @@ layout(location = 0) out vec4 frag_color; #if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) +/* Make a default specular mode SPECULAR_SCHLICK_GGX. */ +#if !defined(SPECULAR_DISABLED) && !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN) && !defined(SPECULAR_PHONG) && !defined(SPECULAR_TOON) +#define SPECULAR_SCHLICK_GGX +#endif + #include "scene_forward_lights_inc.glsl" #include "scene_forward_gi_inc.glsl" diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl index 70900a847c..f050e3775a 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl @@ -491,6 +491,11 @@ layout(location = 0) out vec4 frag_color; #if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) +/* Make a default specular mode SPECULAR_SCHLICK_GGX. */ +#if !defined(SPECULAR_DISABLED) && !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN) && !defined(SPECULAR_PHONG) && !defined(SPECULAR_TOON) +#define SPECULAR_SCHLICK_GGX +#endif + #include "scene_forward_lights_inc.glsl" #endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED) |