From 901301485b3b694c674d8545e13df9bd8dd21ffb Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 17 Apr 2018 15:11:56 -0700 Subject: [PATCH 1/5] reorganizing shader defines to fix compilation errors --- .../gpu-gl-common/src/gpu/gl/GLBackend.h | 2 +- .../src/gpu/gl/GLBackendShader.cpp | 21 ------------------- .../gpu-gl/src/gpu/gl41/GL41BackendShader.cpp | 8 ++++++- .../gpu-gl/src/gpu/gl45/GL45BackendShader.cpp | 16 +++++++------- .../src/gpu/gles/GLESBackendShader.cpp | 11 +++++++++- libraries/graphics/src/graphics/Light.slh | 9 +------- .../src/graphics/LightIrradiance.shared.slh | 8 +------ .../src/graphics/LightVolume.shared.slh | 8 ------- libraries/graphics/src/graphics/Material.slh | 9 +------- .../graphics/SphericalHarmonics.shared.slh | 8 ------- libraries/render-utils/src/LightingModel.slh | 8 ------- 11 files changed, 30 insertions(+), 78 deletions(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h index 6355137a19..895a7777c9 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h @@ -452,7 +452,7 @@ protected: // Backend dependant compilation of the shader virtual GLShader* compileBackendProgram(const Shader& program, const Shader::CompilationHandler& handler); virtual GLShader* compileBackendShader(const Shader& shader, const Shader::CompilationHandler& handler); - virtual std::string getBackendShaderHeader() const; + virtual std::string getBackendShaderHeader() const = 0; virtual void makeProgramBindings(ShaderObject& shaderObject); class ElementResource { public: diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendShader.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendShader.cpp index 0df228ddc4..bf36c134de 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendShader.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendShader.cpp @@ -12,27 +12,6 @@ using namespace gpu; using namespace gpu::gl; -// GLSL version -std::string GLBackend::getBackendShaderHeader() const { - -#if defined(USE_GLES) - static const std::string header( -R"SHADER(#version 310 es -#extension GL_EXT_texture_buffer : enable -precision lowp float; // check precision 2 -precision lowp samplerBuffer; -precision lowp sampler2DShadow; -)SHADER"); -#else - static const std::string header( -R"SHADER(#version 410 core -)SHADER"); -#endif - - return header; -} - - // Shader domain static const size_t NUM_SHADER_DOMAINS = 3; static_assert(Shader::Type::NUM_DOMAINS == NUM_SHADER_DOMAINS, "GL shader domains must equal defined GPU shader domains"); diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp index 35bfafdc50..151b5bd1f9 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp @@ -14,7 +14,13 @@ using namespace gpu::gl41; // GLSL version std::string GL41Backend::getBackendShaderHeader() const { - return std::string("#version 410 core\n#define GPU_GL410 1"); + static const std::string header( + R"SHADER(#version 410 core + #define GPU_GL410 + #define PRECISIONQ + #define BITFIELD int + )SHADER"); + return header; } int GL41Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) { diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp index 8de60a7921..6f6ded518f 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp @@ -15,15 +15,17 @@ using namespace gpu::gl45; // GLSL version std::string GL45Backend::getBackendShaderHeader() const { - const char header[] = -R"GLSL(#version 450 core -#define GPU_GL450 -)GLSL" + static const std::string header( + R"SHADER(#version 450 core + #define GPU_GL450 + #define PRECISIONQ + #define BITFIELD int + )SHADER" #ifdef GPU_SSBO_TRANSFORM_OBJECT - R"GLSL(#define GPU_SSBO_TRANSFORM_OBJECT 1)GLSL" + R"SHADER(#define GPU_SSBO_TRANSFORM_OBJECT)SHADER" #endif - ; - return std::string(header); + ); + return header; } int GL45Backend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) { diff --git a/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp b/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp index 16cf1559dd..4278d732c8 100644 --- a/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp +++ b/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp @@ -14,7 +14,16 @@ using namespace gpu::gles; // GLSL version std::string GLESBackend::getBackendShaderHeader() const { - return Parent::getBackendShaderHeader(); + static const std::string header( + R"SHADER(#version 310 es + #extension GL_EXT_texture_buffer : enable + precision lowp float; // check precision 2 + precision lowp samplerBuffer; + precision lowp sampler2DShadow; + #define PRECISIONQ highp + #define BITFIELD highp int + )SHADER"); + return header; } int GLESBackend::makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) { diff --git a/libraries/graphics/src/graphics/Light.slh b/libraries/graphics/src/graphics/Light.slh index 20394816c9..c8992730f0 100644 --- a/libraries/graphics/src/graphics/Light.slh +++ b/libraries/graphics/src/graphics/Light.slh @@ -29,16 +29,9 @@ vec3 getLightColor(Light l) { return lightIrradiance_getColor(l.irradiance); } float getLightIntensity(Light l) { return lightIrradiance_getIntensity(l.irradiance); } vec3 getLightIrradiance(Light l) { return lightIrradiance_getIrradiance(l.irradiance); } -// AMbient lighting needs extra info provided from a different Buffer +// Ambient lighting needs extra info provided from a different Buffer <@include graphics/SphericalHarmonics.shared.slh@> // Light Ambient -#ifndef PRECISIONQ -#ifdef GL_ES -#define PRECISIONQ highp -#else -#define PRECISIONQ -#endif -#endif struct LightAmbient { PRECISIONQ vec4 _ambient; diff --git a/libraries/graphics/src/graphics/LightIrradiance.shared.slh b/libraries/graphics/src/graphics/LightIrradiance.shared.slh index ff42f57fd9..4ae7967bf5 100644 --- a/libraries/graphics/src/graphics/LightIrradiance.shared.slh +++ b/libraries/graphics/src/graphics/LightIrradiance.shared.slh @@ -12,13 +12,7 @@ #define LightIrradianceConstRef LightIrradiance -#ifndef PRECISIONQ -#ifdef GL_ES -#define PRECISIONQ highp -#else -#define PRECISIONQ -#endif -#endif + struct LightIrradiance { PRECISIONQ vec4 colorIntensity; // falloffRadius, cutoffRadius, falloffSpot, spare diff --git a/libraries/graphics/src/graphics/LightVolume.shared.slh b/libraries/graphics/src/graphics/LightVolume.shared.slh index 48249e766f..4e4359eac0 100644 --- a/libraries/graphics/src/graphics/LightVolume.shared.slh +++ b/libraries/graphics/src/graphics/LightVolume.shared.slh @@ -15,14 +15,6 @@ #define LightVolumeConstRef LightVolume -#ifndef PRECISIONQ -#ifdef GL_ES -#define PRECISIONQ highp -#else -#define PRECISIONQ -#endif -#endif - struct LightVolume { PRECISIONQ vec4 positionRadius; PRECISIONQ vec4 directionSpotCos; diff --git a/libraries/graphics/src/graphics/Material.slh b/libraries/graphics/src/graphics/Material.slh index f9f4144748..ecf3c18a0e 100644 --- a/libraries/graphics/src/graphics/Material.slh +++ b/libraries/graphics/src/graphics/Material.slh @@ -13,14 +13,7 @@ // The material values (at least the material key) must be precisely bitwise accurate // to what is provided by the uniform buffer, or the material key has the wrong bits -#ifdef GL_ES -precision highp float; -#define BITFIELD highp int -#define PRECISIONQ highp -#else -#define BITFIELD int -#define PRECISIONQ -#endif + struct Material { PRECISIONQ vec4 _emissiveOpacity; PRECISIONQ vec4 _albedoRoughness; diff --git a/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh index 72a505fa25..6e1763dcba 100644 --- a/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh +++ b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh @@ -15,14 +15,6 @@ #define SphericalHarmonicsConstRef SphericalHarmonics -#ifndef PRECISIONQ -#ifdef GL_ES -#define PRECISIONQ highp -#else -#define PRECISIONQ -#endif -#endif - struct SphericalHarmonics { PRECISIONQ vec4 L00; PRECISIONQ vec4 L1m1; diff --git a/libraries/render-utils/src/LightingModel.slh b/libraries/render-utils/src/LightingModel.slh index 3f615f11db..6a5982f1e8 100644 --- a/libraries/render-utils/src/LightingModel.slh +++ b/libraries/render-utils/src/LightingModel.slh @@ -13,14 +13,6 @@ <@func declareLightingModel()@> -#ifndef PRECISIONQ -#ifdef GL_ES -#define PRECISIONQ highp -#else -#define PRECISIONQ -#endif -#endif - struct LightingModel { PRECISIONQ vec4 _UnlitEmissiveLightmapBackground; PRECISIONQ vec4 _ScatteringDiffuseSpecularAlbedo; From 238f59f229c3c7920cb636a1426b07db330fd34f Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 20 Apr 2018 00:08:25 -0400 Subject: [PATCH 2/5] make positional streams honor user-specified gain overrides --- assignment-client/src/audio/AudioMixerSlave.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assignment-client/src/audio/AudioMixerSlave.cpp b/assignment-client/src/audio/AudioMixerSlave.cpp index 3c8e38f278..25964d6674 100644 --- a/assignment-client/src/audio/AudioMixerSlave.cpp +++ b/assignment-client/src/audio/AudioMixerSlave.cpp @@ -376,6 +376,11 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU return; } + if (streamToAdd.getType() == PositionalAudioStream::Injector) { + // apply per-avatar gain to positional audio injectors, which wouldn't otherwise be affected by PAL sliders + gain *= listenerNodeData.hrtfForStream(sourceNodeID, QUuid()).getGainAdjustment(); + } + hrtf.render(_bufferSamples, _mixSamples, HRTF_DATASET_INDEX, azimuth, distance, gain, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL); From b86f553550768e0269b60eae8c91c0488851c263 Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 20 Apr 2018 15:34:43 -0400 Subject: [PATCH 3/5] poke per-avatar gain into per-stream HRTF --- assignment-client/src/audio/AudioMixerSlave.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment-client/src/audio/AudioMixerSlave.cpp b/assignment-client/src/audio/AudioMixerSlave.cpp index 25964d6674..b447048ac9 100644 --- a/assignment-client/src/audio/AudioMixerSlave.cpp +++ b/assignment-client/src/audio/AudioMixerSlave.cpp @@ -378,7 +378,7 @@ void AudioMixerSlave::addStream(AudioMixerClientData& listenerNodeData, const QU if (streamToAdd.getType() == PositionalAudioStream::Injector) { // apply per-avatar gain to positional audio injectors, which wouldn't otherwise be affected by PAL sliders - gain *= listenerNodeData.hrtfForStream(sourceNodeID, QUuid()).getGainAdjustment(); + hrtf.setGainAdjustment(listenerNodeData.hrtfForStream(sourceNodeID, QUuid()).getGainAdjustment()); } hrtf.render(_bufferSamples, _mixSamples, HRTF_DATASET_INDEX, azimuth, distance, gain, From d59f368ad61d49df7f11412fe5b56acbd4bdd5c0 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 20 Apr 2018 11:37:49 -0700 Subject: [PATCH 4/5] hide menu, fix shaders --- interface/src/Application.cpp | 6 ++++++ libraries/render-utils/src/forward_model.slf | 8 ++++---- .../src/forward_model_translucent.slf | 8 ++++---- .../render-utils/src/forward_model_unlit.slf | 2 -- libraries/render-utils/src/forward_simple.slf | 11 ++++------ .../src/forward_simple_textured.slf | 8 ++++---- .../forward_simple_textured_transparent.slf | 8 ++++---- .../src/forward_simple_transparent.slf | 10 ++++------ libraries/render-utils/src/model.slf | 5 ++--- libraries/render-utils/src/model.slv | 8 ++++---- libraries/render-utils/src/model_fade.slf | 1 - libraries/render-utils/src/model_lightmap.slf | 5 ++--- libraries/render-utils/src/model_lightmap.slv | 11 +++++----- .../render-utils/src/model_lightmap_fade.slf | 9 ++++----- .../render-utils/src/model_lightmap_fade.slv | 12 +++++------ .../src/model_lightmap_normal_map.slf | 8 ++++---- .../src/model_lightmap_normal_map.slv | 12 +++++------ .../src/model_lightmap_normal_map_fade.slf | 12 +++++------ .../src/model_lightmap_normal_map_fade.slv | 16 +++++++-------- .../render-utils/src/model_shadow_fade.slf | 4 ++-- .../render-utils/src/model_shadow_fade.slv | 4 ++-- libraries/render-utils/src/model_unlit.slf | 4 ++-- libraries/render-utils/src/overlay3D.slf | 10 ++++------ libraries/render-utils/src/overlay3D.slv | 8 ++++---- .../render-utils/src/overlay3D_model.slf | 11 ++++------ .../src/overlay3D_model_translucent.slf | 13 ++++-------- .../src/overlay3D_model_translucent_unlit.slf | 2 -- .../src/overlay3D_model_unlit.slf | 2 -- .../src/overlay3D_translucent.slf | 10 ++++------ libraries/render-utils/src/sdf_text3D.slf | 4 ++-- libraries/render-utils/src/sdf_text3D.slv | 4 ++-- .../src/sdf_text3D_transparent.slf | 4 ++-- libraries/render-utils/src/simple.slf | 7 ++----- libraries/render-utils/src/simple.slv | 16 +++++++-------- libraries/render-utils/src/simple_fade.slf | 11 ++++------ libraries/render-utils/src/simple_fade.slv | 20 +++++++++---------- .../src/simple_opaque_web_browser.slf | 4 ++-- .../render-utils/src/simple_textured.slf | 4 ++-- .../render-utils/src/simple_textured_fade.slf | 10 +++++----- .../src/simple_textured_unlit.slf | 6 +++--- .../src/simple_textured_unlit_fade.slf | 10 +++++----- .../render-utils/src/simple_transparent.slf | 7 ++----- .../src/simple_transparent_textured.slf | 4 ++-- .../src/simple_transparent_textured_fade.slf | 13 ++++++------ .../src/simple_transparent_textured_unlit.slf | 3 --- ...simple_transparent_textured_unlit_fade.slf | 8 +++----- .../src/simple_transparent_web_browser.slf | 4 ++-- libraries/render-utils/src/skin_model.slv | 8 ++++---- libraries/render-utils/src/skin_model_dq.slv | 8 ++++---- .../src/skin_model_shadow_fade.slf | 4 ++-- .../src/skin_model_shadow_fade.slv | 4 ++-- .../src/skin_model_shadow_fade_dq.slv | 4 ++-- 52 files changed, 179 insertions(+), 216 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 83d6bc1b28..6079a866c4 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2654,6 +2654,12 @@ void Application::initializeUi() { // Now that the menu is instantiated, ensure the display plugin menu is properly updated updateDisplayMode(); flushMenuUpdates(); + + // The display plugins are created before the menu now, so we need to do this here to hide the menu bar + // now that it exists + if (_window && _window->isFullScreen()) { + setFullscreen(nullptr, true); + } } diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index 9241503902..ea3a66d21c 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -22,10 +22,10 @@ <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> -in vec4 _position; +in vec4 _positionES; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; +in vec3 _normalWS; in vec3 _color; layout(location = 0) out vec4 _fragColor0; @@ -54,8 +54,8 @@ void main(void) { <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; vec3 fresnel = getFresnelF0(metallic, albedo); - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; + vec3 fragNormal = normalize(_normalWS); TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/forward_model_translucent.slf b/libraries/render-utils/src/forward_model_translucent.slf index 2892a6bbf5..b8d43f15f1 100644 --- a/libraries/render-utils/src/forward_model_translucent.slf +++ b/libraries/render-utils/src/forward_model_translucent.slf @@ -26,8 +26,8 @@ in vec2 _texCoord0; in vec2 _texCoord1; -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec3 _color; in float _alpha; @@ -56,8 +56,8 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; + vec3 fragNormal = normalize(_normalWS); TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/forward_model_unlit.slf b/libraries/render-utils/src/forward_model_unlit.slf index fda001dba9..e693a79e53 100644 --- a/libraries/render-utils/src/forward_model_unlit.slf +++ b/libraries/render-utils/src/forward_model_unlit.slf @@ -19,9 +19,7 @@ <$declareMaterialTextures(ALBEDO)$> in vec2 _texCoord0; -in vec3 _normal; in vec3 _color; -in float _alpha; layout(location = 0) out vec4 _fragColor0; diff --git a/libraries/render-utils/src/forward_simple.slf b/libraries/render-utils/src/forward_simple.slf index ac2aa63697..587fcbde73 100644 --- a/libraries/render-utils/src/forward_simple.slf +++ b/libraries/render-utils/src/forward_simple.slf @@ -17,12 +17,9 @@ <$declareEvalSkyboxGlobalColor()$> // the interpolated normal -in vec3 _normal; -in vec3 _modelNormal; +in vec3 _normalWS; in vec4 _color; -in vec2 _texCoord0; -in vec4 _position; -in vec4 _eyePosition; +in vec4 _positionES; layout(location = 0) out vec4 _fragColor0; @@ -33,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0; #line 2030 void main(void) { - vec3 normal = normalize(_normal.xyz); + vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; @@ -53,7 +50,7 @@ void main(void) { #endif TransformCamera cam = getTransformCamera(); - vec3 fragPosition = _eyePosition.xyz; + vec3 fragPosition = _positionES.xyz; if (emissiveAmount > 0.0) { _fragColor0 = vec4(evalSkyboxGlobalColor( diff --git a/libraries/render-utils/src/forward_simple_textured.slf b/libraries/render-utils/src/forward_simple_textured.slf index c88482c208..9bdf236743 100644 --- a/libraries/render-utils/src/forward_simple_textured.slf +++ b/libraries/render-utils/src/forward_simple_textured.slf @@ -23,10 +23,10 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; -in vec4 _eyePosition; +in vec4 _positionES; layout(location = 0) out vec4 _fragColor0; @@ -35,14 +35,14 @@ void main(void) { float colorAlpha = _color.a * texel.a; TransformCamera cam = getTransformCamera(); - vec3 fragPosition = _eyePosition.xyz; + vec3 fragPosition = _positionES.xyz; _fragColor0 = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, DEFAULT_OCCLUSION, fragPosition, - normalize(_normal), + normalize(_normalWS), _color.rgb * texel.rgb, DEFAULT_FRESNEL, DEFAULT_METALLIC, diff --git a/libraries/render-utils/src/forward_simple_textured_transparent.slf b/libraries/render-utils/src/forward_simple_textured_transparent.slf index a8f23907d3..167d1cb87a 100644 --- a/libraries/render-utils/src/forward_simple_textured_transparent.slf +++ b/libraries/render-utils/src/forward_simple_textured_transparent.slf @@ -23,10 +23,10 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; -in vec4 _eyePosition; +in vec4 _positionES; layout(location = 0) out vec4 _fragColor0; @@ -35,14 +35,14 @@ void main(void) { float colorAlpha = _color.a * texel.a; TransformCamera cam = getTransformCamera(); - vec3 fragPosition = _eyePosition.xyz; + vec3 fragPosition = _positionES.xyz; _fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze( cam._viewInverse, 1.0, DEFAULT_OCCLUSION, fragPosition, - normalize(_normal), + normalize(_normalWS), _color.rgb * texel.rgb, DEFAULT_FRESNEL, DEFAULT_METALLIC, diff --git a/libraries/render-utils/src/forward_simple_transparent.slf b/libraries/render-utils/src/forward_simple_transparent.slf index 551e10282a..f40ba2ed4f 100644 --- a/libraries/render-utils/src/forward_simple_transparent.slf +++ b/libraries/render-utils/src/forward_simple_transparent.slf @@ -17,11 +17,9 @@ <$declareEvalGlobalLightingAlphaBlended()$> // the interpolated normal -in vec3 _normal; -in vec3 _modelNormal; +in vec3 _normalWS; in vec4 _color; -in vec2 _texCoord0; -in vec4 _eyePosition; +in vec4 _positionES; layout(location = 0) out vec4 _fragColor0; @@ -32,7 +30,7 @@ layout(location = 0) out vec4 _fragColor0; #line 2030 void main(void) { - vec3 normal = normalize(_normal.xyz); + vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; @@ -52,7 +50,7 @@ void main(void) { #endif TransformCamera cam = getTransformCamera(); - vec3 fragPosition = _eyePosition.xyz; + vec3 fragPosition = _positionES.xyz; if (emissiveAmount > 0.0) { _fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze( diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index 94929f4943..e5c25c8bc1 100644 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -19,10 +19,9 @@ <@include MaterialTextures.slh@> <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$> -in vec4 _position; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; +in vec3 _normalWS; in vec3 _color; @@ -53,7 +52,7 @@ void main(void) { <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( - normalize(_normal), + normalize(_normalWS), opacity, albedo, roughness, diff --git a/libraries/render-utils/src/model.slv b/libraries/render-utils/src/model.slv index ccedff9b61..7cfedfe877 100644 --- a/libraries/render-utils/src/model.slv +++ b/libraries/render-utils/src/model.slv @@ -23,8 +23,8 @@ out vec3 _color; out float _alpha; out vec2 _texCoord0; out vec2 _texCoord1; -out vec4 _position; -out vec3 _normal; +out vec4 _positionES; +out vec3 _normalWS; void main(void) { _color = color_sRGBToLinear(inColor.xyz); @@ -37,6 +37,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> } diff --git a/libraries/render-utils/src/model_fade.slf b/libraries/render-utils/src/model_fade.slf index 432fc0239b..323d1828a0 100644 --- a/libraries/render-utils/src/model_fade.slf +++ b/libraries/render-utils/src/model_fade.slf @@ -22,7 +22,6 @@ <@include Fade.slh@> <$declareFadeFragment()$> -in vec4 _positionES; in vec2 _texCoord0; in vec2 _texCoord1; in vec3 _normalWS; diff --git a/libraries/render-utils/src/model_lightmap.slf b/libraries/render-utils/src/model_lightmap.slf index 33195fce00..c4eed4185e 100644 --- a/libraries/render-utils/src/model_lightmap.slf +++ b/libraries/render-utils/src/model_lightmap.slf @@ -20,10 +20,9 @@ <$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> <$declareMaterialLightmap()$> -in vec4 _position; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; +in vec3 _normalWS; in vec3 _color; void main(void) { @@ -33,7 +32,7 @@ void main(void) { <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> packDeferredFragmentLightmap( - normalize(_normal), + normalize(_normalWS), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialRoughness(mat) * roughness, diff --git a/libraries/render-utils/src/model_lightmap.slv b/libraries/render-utils/src/model_lightmap.slv index e00fcb708e..b3f20357cd 100644 --- a/libraries/render-utils/src/model_lightmap.slv +++ b/libraries/render-utils/src/model_lightmap.slv @@ -20,10 +20,10 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; +out vec3 _normalWS; out vec3 _color; void main(void) { @@ -38,7 +38,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> -} - + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> +} \ No newline at end of file diff --git a/libraries/render-utils/src/model_lightmap_fade.slf b/libraries/render-utils/src/model_lightmap_fade.slf index 1dfc6a1b9e..ba651711c3 100644 --- a/libraries/render-utils/src/model_lightmap_fade.slf +++ b/libraries/render-utils/src/model_lightmap_fade.slf @@ -23,19 +23,18 @@ <@include Fade.slh@> <$declareFadeFragment()$> -in vec4 _position; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; +in vec3 _normalWS; in vec3 _color; -in vec4 _worldPosition; +in vec4 _positionWS; void main(void) { vec3 fadeEmissive; FadeObjectParams fadeParams; <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); @@ -43,7 +42,7 @@ void main(void) { <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> packDeferredFragmentLightmap( - normalize(_normal), + normalize(_normalWS), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialRoughness(mat) * roughness, diff --git a/libraries/render-utils/src/model_lightmap_fade.slv b/libraries/render-utils/src/model_lightmap_fade.slv index d1a1194de1..31abb36c4b 100644 --- a/libraries/render-utils/src/model_lightmap_fade.slv +++ b/libraries/render-utils/src/model_lightmap_fade.slv @@ -20,12 +20,12 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; +out vec3 _normalWS; out vec3 _color; -out vec4 _worldPosition; +out vec4 _positionWS; void main(void) { // pass along the color in linear space @@ -39,8 +39,8 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _worldPosition)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldPos(obj, inPosition, _positionWS)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> } diff --git a/libraries/render-utils/src/model_lightmap_normal_map.slf b/libraries/render-utils/src/model_lightmap_normal_map.slf index eecde59e54..57aaa3ed2e 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map.slf @@ -20,11 +20,11 @@ <$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> <$declareMaterialLightmap()$> -in vec4 _position; +in vec4 _positionES; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; +in vec3 _normalWS; +in vec3 _tangentWS; in vec3 _color; void main(void) { @@ -34,7 +34,7 @@ void main(void) { <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> vec3 fragNormal; - <$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$> + <$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$> packDeferredFragmentLightmap( normalize(fragNormal.xyz), diff --git a/libraries/render-utils/src/model_lightmap_normal_map.slv b/libraries/render-utils/src/model_lightmap_normal_map.slv index 3b1ecaab0c..15fc4099d5 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map.slv +++ b/libraries/render-utils/src/model_lightmap_normal_map.slv @@ -20,11 +20,11 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; -out vec3 _tangent; +out vec3 _normalWS; +out vec3 _tangentWS; out vec3 _color; void main(void) { @@ -38,7 +38,7 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> + <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> } diff --git a/libraries/render-utils/src/model_lightmap_normal_map_fade.slf b/libraries/render-utils/src/model_lightmap_normal_map_fade.slf index af497f90c6..2cd5ac433f 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map_fade.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map_fade.slf @@ -23,20 +23,20 @@ <@include Fade.slh@> <$declareFadeFragment()$> -in vec4 _position; +in vec4 _positionES; in vec2 _texCoord0; in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; +in vec3 _normalWS; +in vec3 _tangentWS; in vec3 _color; -in vec4 _worldPosition; +in vec4 _positionWS; void main(void) { vec3 fadeEmissive; FadeObjectParams fadeParams; <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); @@ -44,7 +44,7 @@ void main(void) { <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> vec3 fragNormal; - <$evalMaterialNormalLOD(_position, normalTexel, _normal, _tangent, fragNormal)$> + <$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$> packDeferredFragmentLightmap( normalize(fragNormal.xyz), diff --git a/libraries/render-utils/src/model_lightmap_normal_map_fade.slv b/libraries/render-utils/src/model_lightmap_normal_map_fade.slv index 5c1212b1b7..8fc3fa28d8 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map_fade.slv +++ b/libraries/render-utils/src/model_lightmap_normal_map_fade.slv @@ -20,13 +20,13 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; -out vec3 _tangent; +out vec3 _normalWS; +out vec3 _tangentWS; out vec3 _color; -out vec4 _worldPosition; +out vec4 _positionWS; void main(void) { // pass along the color in linear space @@ -39,8 +39,8 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _worldPosition)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> - <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangent)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldPos(obj, inPosition, _positionWS)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> + <$transformModelToWorldDir(cam, obj, inTangent.xyz, _tangentWS)$> } diff --git a/libraries/render-utils/src/model_shadow_fade.slf b/libraries/render-utils/src/model_shadow_fade.slf index c00eed622c..403f32c457 100644 --- a/libraries/render-utils/src/model_shadow_fade.slf +++ b/libraries/render-utils/src/model_shadow_fade.slf @@ -17,13 +17,13 @@ layout(location = 0) out vec4 _fragColor; -in vec4 _worldPosition; +in vec4 _positionWS; void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParams(fadeParams)$> - applyFadeClip(fadeParams, _worldPosition.xyz); + applyFadeClip(fadeParams, _positionWS.xyz); // pass-through to set z-buffer _fragColor = vec4(1.0, 1.0, 1.0, 0.0); diff --git a/libraries/render-utils/src/model_shadow_fade.slv b/libraries/render-utils/src/model_shadow_fade.slv index 8762f1dd90..72e4a1a823 100644 --- a/libraries/render-utils/src/model_shadow_fade.slv +++ b/libraries/render-utils/src/model_shadow_fade.slv @@ -18,12 +18,12 @@ <$declareStandardTransform()$> -out vec4 _worldPosition; +out vec4 _positionWS; void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _worldPosition)$> + <$transformModelToWorldPos(obj, inPosition, _positionWS)$> } diff --git a/libraries/render-utils/src/model_unlit.slf b/libraries/render-utils/src/model_unlit.slf index d786c94634..d4c1334e12 100644 --- a/libraries/render-utils/src/model_unlit.slf +++ b/libraries/render-utils/src/model_unlit.slf @@ -20,7 +20,7 @@ <$declareMaterialTextures(ALBEDO)$> in vec2 _texCoord0; -in vec3 _normal; +in vec3 _normalWS; in vec3 _color; in float _alpha; @@ -39,7 +39,7 @@ void main(void) { albedo *= _color; packDeferredFragmentUnlit( - normalize(_normal), + normalize(_normalWS), opacity, albedo * isUnlitEnabled()); } diff --git a/libraries/render-utils/src/overlay3D.slf b/libraries/render-utils/src/overlay3D.slf index b6df71ccc3..83cee88790 100644 --- a/libraries/render-utils/src/overlay3D.slf +++ b/libraries/render-utils/src/overlay3D.slf @@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a LightAmbient ambient = getLightAmbient(); TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - <$transformEyeToWorldDir(cam, normal, fragNormal)$> vec3 fragEyeVectorView = normalize(-position); vec3 fragEyeDir; <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> @@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a uniform sampler2D originalTexture; in vec2 _texCoord0; -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec3 _color; in float _alpha; @@ -67,8 +65,8 @@ out vec4 _fragColor; void main(void) { vec4 albedo = texture(originalTexture, _texCoord0); - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; + vec3 fragNormal = normalize(_normalWS); vec3 fragAlbedo = albedo.rgb * _color; float fragMetallic = 0.0; vec3 fragSpecular = vec3(0.1); diff --git a/libraries/render-utils/src/overlay3D.slv b/libraries/render-utils/src/overlay3D.slv index 7184f923e4..9e13fb3776 100644 --- a/libraries/render-utils/src/overlay3D.slv +++ b/libraries/render-utils/src/overlay3D.slv @@ -19,8 +19,8 @@ out vec3 _color; out float _alpha; out vec2 _texCoord0; -out vec4 _position; -out vec3 _normal; +out vec4 _positionES; +out vec3 _normalWS; void main(void) { _color = color_sRGBToLinear(inColor.xyz); @@ -31,6 +31,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> } diff --git a/libraries/render-utils/src/overlay3D_model.slf b/libraries/render-utils/src/overlay3D_model.slf index 8e8c3e6077..fd6470efb2 100644 --- a/libraries/render-utils/src/overlay3D_model.slf +++ b/libraries/render-utils/src/overlay3D_model.slf @@ -24,8 +24,8 @@ in vec2 _texCoord0; in vec2 _texCoord1; -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec3 _color; in float _alpha; @@ -55,19 +55,16 @@ void main(void) { <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - vec3 fragPosition = _position.xyz; - //vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - <$transformEyeToWorldDir(cam, _normal, fragNormal)$>; vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, occlusionTex, fragPosition, - fragNormal, + normalize(_normalWS), albedo, fresnel, metallic, diff --git a/libraries/render-utils/src/overlay3D_model_translucent.slf b/libraries/render-utils/src/overlay3D_model_translucent.slf index 040b491346..0c5b922d34 100644 --- a/libraries/render-utils/src/overlay3D_model_translucent.slf +++ b/libraries/render-utils/src/overlay3D_model_translucent.slf @@ -23,10 +23,9 @@ in vec2 _texCoord0; in vec2 _texCoord1; -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec3 _color; -in float _alpha; out vec4 _fragColor; @@ -52,19 +51,15 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - vec3 fragPosition = _position.xyz; - + vec3 fragPosition = _positionES.xyz; TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - <$transformEyeToWorldDir(cam, _normal, fragNormal)$> vec4 color = vec4(evalGlobalLightingAlphaBlendedWithHaze( cam._viewInverse, 1.0, occlusionTex, fragPosition, - fragNormal, + normalize(_normalWS), albedo, fresnel, metallic, diff --git a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf b/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf index 6753b02a05..b1822a645a 100644 --- a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf +++ b/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf @@ -18,9 +18,7 @@ <$declareMaterialTextures(ALBEDO)$> in vec2 _texCoord0; -in vec3 _normal; in vec3 _color; -in float _alpha; out vec4 _fragColor; diff --git a/libraries/render-utils/src/overlay3D_model_unlit.slf b/libraries/render-utils/src/overlay3D_model_unlit.slf index 8b7eb06d41..cc16d0751d 100644 --- a/libraries/render-utils/src/overlay3D_model_unlit.slf +++ b/libraries/render-utils/src/overlay3D_model_unlit.slf @@ -18,9 +18,7 @@ <$declareMaterialTextures(ALBEDO)$> in vec2 _texCoord0; -in vec3 _normal; in vec3 _color; -in float _alpha; out vec4 _fragColor; diff --git a/libraries/render-utils/src/overlay3D_translucent.slf b/libraries/render-utils/src/overlay3D_translucent.slf index c247364a8c..b93550a63d 100644 --- a/libraries/render-utils/src/overlay3D_translucent.slf +++ b/libraries/render-utils/src/overlay3D_translucent.slf @@ -34,8 +34,6 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a LightAmbient ambient = getLightAmbient(); TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - <$transformEyeToWorldDir(cam, normal, fragNormal)$> vec3 fragEyeVectorView = normalize(-position); vec3 fragEyeDir; <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> @@ -57,8 +55,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 a uniform sampler2D originalTexture; in vec2 _texCoord0; -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec3 _color; in float _alpha; @@ -67,8 +65,8 @@ out vec4 _fragColor; void main(void) { vec4 albedo = texture(originalTexture, _texCoord0); - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; + vec3 fragNormal = normalize(_normalWS); vec3 fragAlbedo = albedo.rgb * _color; float fragMetallic = 0.0; vec3 fragSpecular = vec3(0.1); diff --git a/libraries/render-utils/src/sdf_text3D.slf b/libraries/render-utils/src/sdf_text3D.slf index 8863e15b00..2742341628 100644 --- a/libraries/render-utils/src/sdf_text3D.slf +++ b/libraries/render-utils/src/sdf_text3D.slf @@ -17,7 +17,7 @@ uniform bool Outline; uniform vec4 Color; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec2 _texCoord0; const float gamma = 2.2; @@ -47,7 +47,7 @@ void main() { } packDeferredFragment( - normalize(_normal), + normalize(_normalWS), a * Color.a, Color.rgb, DEFAULT_ROUGHNESS, diff --git a/libraries/render-utils/src/sdf_text3D.slv b/libraries/render-utils/src/sdf_text3D.slv index d9f6e0cdda..bcf42c3cff 100644 --- a/libraries/render-utils/src/sdf_text3D.slv +++ b/libraries/render-utils/src/sdf_text3D.slv @@ -17,7 +17,7 @@ <$declareStandardTransform()$> // the interpolated normal -out vec3 _normal; +out vec3 _normalWS; out vec2 _texCoord0; void main() { @@ -28,5 +28,5 @@ void main() { TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> const vec3 normal = vec3(0, 0, 1); - <$transformModelToWorldDir(cam, obj, normal, _normal)$> + <$transformModelToWorldDir(cam, obj, normal, _normalWS)$> } \ No newline at end of file diff --git a/libraries/render-utils/src/sdf_text3D_transparent.slf b/libraries/render-utils/src/sdf_text3D_transparent.slf index fc78ab3a37..10eb88b198 100644 --- a/libraries/render-utils/src/sdf_text3D_transparent.slf +++ b/libraries/render-utils/src/sdf_text3D_transparent.slf @@ -17,7 +17,7 @@ uniform bool Outline; uniform vec4 Color; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec2 _texCoord0; const float gamma = 2.2; @@ -47,7 +47,7 @@ void main() { } packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), a * Color.a, Color.rgb, DEFAULT_FRESNEL, diff --git a/libraries/render-utils/src/simple.slf b/libraries/render-utils/src/simple.slf index 1c2ad9a413..ed77777184 100644 --- a/libraries/render-utils/src/simple.slf +++ b/libraries/render-utils/src/simple.slf @@ -15,11 +15,8 @@ <@include DeferredBufferWrite.slh@> // the interpolated normal -in vec3 _normal; -in vec3 _modelNormal; +in vec3 _normalWS; in vec4 _color; -in vec2 _texCoord0; -in vec4 _position; //PROCEDURAL_COMMON_BLOCK @@ -28,7 +25,7 @@ in vec4 _position; #line 2030 void main(void) { - vec3 normal = normalize(_normal.xyz); + vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; diff --git a/libraries/render-utils/src/simple.slv b/libraries/render-utils/src/simple.slv index f63ccb61a6..01338be15f 100644 --- a/libraries/render-utils/src/simple.slv +++ b/libraries/render-utils/src/simple.slv @@ -18,22 +18,22 @@ <$declareStandardTransform()$> // the interpolated normal -out vec3 _normal; -out vec3 _modelNormal; +out vec3 _normalWS; +out vec3 _normalMS; out vec4 _color; out vec2 _texCoord0; -out vec4 _position; -out vec4 _eyePosition; +out vec4 _positionMS; +out vec4 _positionES; void main(void) { _color = color_sRGBAToLinear(inColor); _texCoord0 = inTexCoord0.st; - _position = inPosition; - _modelNormal = inNormal.xyz; + _positionMS = inPosition; + _normalMS = inNormal.xyz; // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> } \ No newline at end of file diff --git a/libraries/render-utils/src/simple_fade.slf b/libraries/render-utils/src/simple_fade.slf index 1c74612ff0..6e7aee2894 100644 --- a/libraries/render-utils/src/simple_fade.slf +++ b/libraries/render-utils/src/simple_fade.slf @@ -18,12 +18,9 @@ <$declareFadeFragmentInstanced()$> // the interpolated normal -in vec3 _normal; -in vec3 _modelNormal; +in vec3 _normalWS; in vec4 _color; -in vec2 _texCoord0; -in vec4 _position; -in vec4 _worldPosition; +in vec4 _positionWS; //PROCEDURAL_COMMON_BLOCK @@ -36,9 +33,9 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParamsInstanced(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); - vec3 normal = normalize(_normal.xyz); + vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; diff --git a/libraries/render-utils/src/simple_fade.slv b/libraries/render-utils/src/simple_fade.slv index 6dbe40485a..c7d7c5d1b3 100644 --- a/libraries/render-utils/src/simple_fade.slv +++ b/libraries/render-utils/src/simple_fade.slv @@ -21,25 +21,25 @@ <$declareFadeVertexInstanced()$> // the interpolated normal -out vec3 _normal; -out vec3 _modelNormal; +out vec3 _normalWS; +out vec3 _normalMS; out vec4 _color; out vec2 _texCoord0; -out vec4 _position; -out vec4 _eyePosition; -out vec4 _worldPosition; +out vec4 _positionMS; +out vec4 _positionES; +out vec4 _positionWS; void main(void) { _color = color_sRGBAToLinear(inColor); _texCoord0 = inTexCoord0.st; - _position = inPosition; - _modelNormal = inNormal.xyz; + _positionMS = inPosition; + _normalMS = inNormal.xyz; // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _eyePosition, gl_Position)$> - <$transformModelToWorldPos(obj, inPosition, _worldPosition)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normal)$> + <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> + <$transformModelToWorldPos(obj, inPosition, _positionWS)$> + <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> <$passThroughFadeObjectParams()$> } \ No newline at end of file diff --git a/libraries/render-utils/src/simple_opaque_web_browser.slf b/libraries/render-utils/src/simple_opaque_web_browser.slf index af7ef78682..3492e0cc90 100644 --- a/libraries/render-utils/src/simple_opaque_web_browser.slf +++ b/libraries/render-utils/src/simple_opaque_web_browser.slf @@ -19,12 +19,12 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; void main(void) { vec4 texel = texture(originalTexture, _texCoord0.st); texel = color_sRGBAToLinear(texel); - packDeferredFragmentUnlit(normalize(_normal), 1.0, _color.rgb * texel.rgb); + packDeferredFragmentUnlit(normalize(_normalWS), 1.0, _color.rgb * texel.rgb); } diff --git a/libraries/render-utils/src/simple_textured.slf b/libraries/render-utils/src/simple_textured.slf index bb50c9d158..072e2e8e18 100644 --- a/libraries/render-utils/src/simple_textured.slf +++ b/libraries/render-utils/src/simple_textured.slf @@ -18,7 +18,7 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; @@ -26,7 +26,7 @@ void main(void) { vec4 texel = texture(originalTexture, _texCoord0); packDeferredFragment( - normalize(_normal), + normalize(_normalWS), 1.0, _color.rgb * texel.rgb, DEFAULT_ROUGHNESS, diff --git a/libraries/render-utils/src/simple_textured_fade.slf b/libraries/render-utils/src/simple_textured_fade.slf index e5ecd94852..9ec02798ef 100644 --- a/libraries/render-utils/src/simple_textured_fade.slf +++ b/libraries/render-utils/src/simple_textured_fade.slf @@ -21,10 +21,10 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; -in vec4 _worldPosition; +in vec4 _positionWS; // Declare after all samplers to prevent sampler location mix up with originalTexture <$declareFadeFragmentInstanced()$> @@ -34,7 +34,7 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParamsInstanced(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); vec4 texel = texture(originalTexture, _texCoord0); float colorAlpha = _color.a; @@ -46,14 +46,14 @@ void main(void) { const float ALPHA_THRESHOLD = 0.999; if (colorAlpha * texel.a < ALPHA_THRESHOLD) { packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), colorAlpha * texel.a, _color.rgb * texel.rgb + fadeEmissive, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS); } else { packDeferredFragment( - normalize(_normal), + normalize(_normalWS), 1.0, _color.rgb * texel.rgb, DEFAULT_ROUGHNESS, diff --git a/libraries/render-utils/src/simple_textured_unlit.slf b/libraries/render-utils/src/simple_textured_unlit.slf index 1daea2f5c7..c5cca9e0f8 100644 --- a/libraries/render-utils/src/simple_textured_unlit.slf +++ b/libraries/render-utils/src/simple_textured_unlit.slf @@ -19,7 +19,7 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; @@ -34,14 +34,14 @@ void main(void) { const float ALPHA_THRESHOLD = 0.999; if (colorAlpha * texel.a < ALPHA_THRESHOLD) { packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), colorAlpha * texel.a, _color.rgb * texel.rgb, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS); } else { packDeferredFragmentUnlit( - normalize(_normal), + normalize(_normalWS), 1.0, _color.rgb * texel.rgb); } diff --git a/libraries/render-utils/src/simple_textured_unlit_fade.slf b/libraries/render-utils/src/simple_textured_unlit_fade.slf index b3c5a914b2..a8d0f3bffe 100644 --- a/libraries/render-utils/src/simple_textured_unlit_fade.slf +++ b/libraries/render-utils/src/simple_textured_unlit_fade.slf @@ -21,10 +21,10 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; -in vec4 _worldPosition; +in vec4 _positionWS; // Declare after all samplers to prevent sampler location mix up with originalTexture <$declareFadeFragmentInstanced()$> @@ -34,7 +34,7 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParamsInstanced(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); vec4 texel = texture(originalTexture, _texCoord0.st); float colorAlpha = _color.a; @@ -46,14 +46,14 @@ void main(void) { const float ALPHA_THRESHOLD = 0.999; if (colorAlpha * texel.a < ALPHA_THRESHOLD) { packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), colorAlpha * texel.a, _color.rgb * texel.rgb+fadeEmissive, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS); } else { packDeferredFragmentUnlit( - normalize(_normal), + normalize(_normalWS), 1.0, _color.rgb * texel.rgb+fadeEmissive); } diff --git a/libraries/render-utils/src/simple_transparent.slf b/libraries/render-utils/src/simple_transparent.slf index 65ffe0504a..c9815e8a80 100644 --- a/libraries/render-utils/src/simple_transparent.slf +++ b/libraries/render-utils/src/simple_transparent.slf @@ -15,11 +15,8 @@ <@include DeferredBufferWrite.slh@> // the interpolated normal -in vec3 _normal; -in vec3 _modelNormal; +in vec3 _normalWS; in vec4 _color; -in vec2 _texCoord0; -in vec4 _position; //PROCEDURAL_COMMON_BLOCK @@ -28,7 +25,7 @@ in vec4 _position; #line 2030 void main(void) { - vec3 normal = normalize(_normal.xyz); + vec3 normal = normalize(_normalWS.xyz); vec3 diffuse = _color.rgb; vec3 specular = DEFAULT_SPECULAR; float shininess = DEFAULT_SHININESS; diff --git a/libraries/render-utils/src/simple_transparent_textured.slf b/libraries/render-utils/src/simple_transparent_textured.slf index 7c7168ec0f..96895f74f3 100644 --- a/libraries/render-utils/src/simple_transparent_textured.slf +++ b/libraries/render-utils/src/simple_transparent_textured.slf @@ -18,7 +18,7 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; @@ -27,7 +27,7 @@ void main(void) { float colorAlpha = _color.a * texel.a; packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), colorAlpha, _color.rgb * texel.rgb, DEFAULT_FRESNEL, diff --git a/libraries/render-utils/src/simple_transparent_textured_fade.slf b/libraries/render-utils/src/simple_transparent_textured_fade.slf index a5103660b9..947640687c 100644 --- a/libraries/render-utils/src/simple_transparent_textured_fade.slf +++ b/libraries/render-utils/src/simple_transparent_textured_fade.slf @@ -26,12 +26,11 @@ // the albedo texture uniform sampler2D originalTexture; -// the interpolated normal -in vec4 _position; -in vec3 _normal; +in vec4 _positionES; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; -in vec4 _worldPosition; +in vec4 _positionWS; // Declare after all samplers to prevent sampler location mix up with originalTexture <$declareFadeFragmentInstanced()$> @@ -41,7 +40,7 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParamsInstanced(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); vec4 texel = texture(originalTexture, _texCoord0.st); float opacity = _color.a; @@ -52,8 +51,8 @@ void main(void) { opacity *= texel.a; vec3 albedo = _color.rgb * texel.rgb; - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); + vec3 fragPosition = _positionES.xyz; + vec3 fragNormal = normalize(_normalWS); TransformCamera cam = getTransformCamera(); diff --git a/libraries/render-utils/src/simple_transparent_textured_unlit.slf b/libraries/render-utils/src/simple_transparent_textured_unlit.slf index e9c1104cf0..7582af59c6 100644 --- a/libraries/render-utils/src/simple_transparent_textured_unlit.slf +++ b/libraries/render-utils/src/simple_transparent_textured_unlit.slf @@ -17,12 +17,9 @@ // the albedo texture uniform sampler2D originalTexture; -// the interpolated normal -in vec3 _normal; in vec4 _color; in vec2 _texCoord0; - layout(location = 0) out vec4 _fragColor0; void main(void) { diff --git a/libraries/render-utils/src/simple_transparent_textured_unlit_fade.slf b/libraries/render-utils/src/simple_transparent_textured_unlit_fade.slf index 093b70755f..b4f95fc317 100644 --- a/libraries/render-utils/src/simple_transparent_textured_unlit_fade.slf +++ b/libraries/render-utils/src/simple_transparent_textured_unlit_fade.slf @@ -19,11 +19,9 @@ // the albedo texture uniform sampler2D originalTexture; -// the interpolated normal -in vec3 _normal; in vec4 _color; in vec2 _texCoord0; -in vec4 _worldPosition; +in vec4 _positionWS; layout(location = 0) out vec4 _fragColor0; @@ -35,7 +33,7 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParamsInstanced(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); + applyFade(fadeParams, _positionWS.xyz, fadeEmissive); vec4 texel = texture(originalTexture, _texCoord0.st); float colorAlpha = _color.a; @@ -43,5 +41,5 @@ void main(void) { texel = color_sRGBAToLinear(texel); colorAlpha = -_color.a; } - _fragColor0 = vec4(_color.rgb * texel.rgb+fadeEmissive, colorAlpha * texel.a); + _fragColor0 = vec4(_color.rgb * texel.rgb + fadeEmissive, colorAlpha * texel.a); } \ No newline at end of file diff --git a/libraries/render-utils/src/simple_transparent_web_browser.slf b/libraries/render-utils/src/simple_transparent_web_browser.slf index 414f3f683f..bb2a0846ed 100644 --- a/libraries/render-utils/src/simple_transparent_web_browser.slf +++ b/libraries/render-utils/src/simple_transparent_web_browser.slf @@ -19,7 +19,7 @@ uniform sampler2D originalTexture; // the interpolated normal -in vec3 _normal; +in vec3 _normalWS; in vec4 _color; in vec2 _texCoord0; @@ -27,7 +27,7 @@ void main(void) { vec4 texel = texture(originalTexture, _texCoord0.st); texel = color_sRGBAToLinear(texel); packDeferredFragmentTranslucent( - normalize(_normal), + normalize(_normalWS), _color.a, _color.rgb * texel.rgb, DEFAULT_FRESNEL, diff --git a/libraries/render-utils/src/skin_model.slv b/libraries/render-utils/src/skin_model.slv index 480e48a5d4..1d5013e623 100644 --- a/libraries/render-utils/src/skin_model.slv +++ b/libraries/render-utils/src/skin_model.slv @@ -23,10 +23,10 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; +out vec3 _normalWS; out vec3 _color; out float _alpha; @@ -47,6 +47,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$> + <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_dq.slv b/libraries/render-utils/src/skin_model_dq.slv index 6e369c7c82..21191e966d 100644 --- a/libraries/render-utils/src/skin_model_dq.slv +++ b/libraries/render-utils/src/skin_model_dq.slv @@ -23,10 +23,10 @@ <@include MaterialTextures.slh@> <$declareMaterialTexMapArrayBuffer()$> -out vec4 _position; +out vec4 _positionES; out vec2 _texCoord0; out vec2 _texCoord1; -out vec3 _normal; +out vec3 _normalWS; out vec3 _color; out float _alpha; @@ -47,6 +47,6 @@ void main(void) { // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$> - <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normal.xyz)$> + <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> + <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, _normalWS.xyz)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slf b/libraries/render-utils/src/skin_model_shadow_fade.slf index aaf29076b8..214fc72e42 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slf +++ b/libraries/render-utils/src/skin_model_shadow_fade.slf @@ -15,7 +15,7 @@ <@include Fade.slh@> <$declareFadeFragment()$> -in vec4 _worldPosition; +in vec4 _positionWS; layout(location = 0) out vec4 _fragColor; @@ -23,7 +23,7 @@ void main(void) { FadeObjectParams fadeParams; <$fetchFadeObjectParams(fadeParams)$> - applyFadeClip(fadeParams, _worldPosition.xyz); + applyFadeClip(fadeParams, _positionWS.xyz); // pass-through to set z-buffer _fragColor = vec4(1.0, 1.0, 1.0, 0.0); diff --git a/libraries/render-utils/src/skin_model_shadow_fade.slv b/libraries/render-utils/src/skin_model_shadow_fade.slv index d2e79f9d74..e3ddd25e81 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade.slv @@ -19,7 +19,7 @@ <@include Skinning.slh@> <$declareUseDualQuaternionSkinning()$> -out vec4 _worldPosition; +out vec4 _positionWS; void main(void) { vec4 position = vec4(0.0, 0.0, 0.0, 0.0); @@ -29,5 +29,5 @@ void main(void) { TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, position, gl_Position)$> - <$transformModelToWorldPos(obj, position, _worldPosition)$> + <$transformModelToWorldPos(obj, position, _positionWS)$> } diff --git a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv index fb9c60eefd..dcb15c6e84 100644 --- a/libraries/render-utils/src/skin_model_shadow_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_shadow_fade_dq.slv @@ -19,7 +19,7 @@ <@include Skinning.slh@> <$declareUseDualQuaternionSkinning(1)$> -out vec4 _worldPosition; +out vec4 _positionWS; void main(void) { vec4 position = vec4(0.0, 0.0, 0.0, 0.0); @@ -29,5 +29,5 @@ void main(void) { TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, position, gl_Position)$> - <$transformModelToWorldPos(obj, position, _worldPosition)$> + <$transformModelToWorldPos(obj, position, _positionWS)$> } From ac7e8623bf42a7fb123a916f5b15201158775a16 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 20 Apr 2018 18:25:30 -0700 Subject: [PATCH 5/5] quiet shader warnings --- libraries/render-utils/src/directional_ambient_light.slf | 4 ++-- .../render-utils/src/directional_ambient_light_shadow.slf | 4 ++-- libraries/render-utils/src/directional_skybox_light.slf | 4 ++-- .../render-utils/src/directional_skybox_light_shadow.slf | 4 ++-- libraries/render-utils/src/local_lights_drawOutline.slf | 1 + libraries/render-utils/src/local_lights_shading.slf | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libraries/render-utils/src/directional_ambient_light.slf b/libraries/render-utils/src/directional_ambient_light.slf index 6c99d44c5f..d7e0dcd08c 100644 --- a/libraries/render-utils/src/directional_ambient_light.slf +++ b/libraries/render-utils/src/directional_ambient_light.slf @@ -36,8 +36,8 @@ void main(void) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { discard; } else { - vec4 midNormalCurvature; - vec4 lowNormalCurvature; + vec4 midNormalCurvature = vec4(0); + vec4 lowNormalCurvature = vec4(0); if (frag.mode == FRAG_MODE_SCATTERING) { unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); } diff --git a/libraries/render-utils/src/directional_ambient_light_shadow.slf b/libraries/render-utils/src/directional_ambient_light_shadow.slf index eead392fd8..fda0164b4d 100644 --- a/libraries/render-utils/src/directional_ambient_light_shadow.slf +++ b/libraries/render-utils/src/directional_ambient_light_shadow.slf @@ -37,8 +37,8 @@ void main(void) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { discard; } else { - vec4 midNormalCurvature; - vec4 lowNormalCurvature; + vec4 midNormalCurvature = vec4(0); + vec4 lowNormalCurvature = vec4(0); if (frag.mode == FRAG_MODE_SCATTERING) { unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); } diff --git a/libraries/render-utils/src/directional_skybox_light.slf b/libraries/render-utils/src/directional_skybox_light.slf index d609dd2300..65b4b086e9 100644 --- a/libraries/render-utils/src/directional_skybox_light.slf +++ b/libraries/render-utils/src/directional_skybox_light.slf @@ -33,8 +33,8 @@ void main(void) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { discard; } else { - vec4 midNormalCurvature; - vec4 lowNormalCurvature; + vec4 midNormalCurvature = vec4(0); + vec4 lowNormalCurvature = vec4(0); if (frag.mode == FRAG_MODE_SCATTERING) { unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); } diff --git a/libraries/render-utils/src/directional_skybox_light_shadow.slf b/libraries/render-utils/src/directional_skybox_light_shadow.slf index 2a2f8f65a3..e927f53a1f 100644 --- a/libraries/render-utils/src/directional_skybox_light_shadow.slf +++ b/libraries/render-utils/src/directional_skybox_light_shadow.slf @@ -38,8 +38,8 @@ void main(void) { } else if (frag.mode == FRAG_MODE_LIGHTMAPPED) { discard; } else { - vec4 midNormalCurvature; - vec4 lowNormalCurvature; + vec4 midNormalCurvature = vec4(0); + vec4 lowNormalCurvature = vec4(0); if (frag.mode == FRAG_MODE_SCATTERING) { unpackMidLowNormalCurvature(_texCoord0, midNormalCurvature, lowNormalCurvature); } diff --git a/libraries/render-utils/src/local_lights_drawOutline.slf b/libraries/render-utils/src/local_lights_drawOutline.slf index 38dd383459..f4a135ff0d 100644 --- a/libraries/render-utils/src/local_lights_drawOutline.slf +++ b/libraries/render-utils/src/local_lights_drawOutline.slf @@ -62,6 +62,7 @@ void main(void) { // Frag to eye vec vec4 fragEyeVector = invViewMat * vec4(-frag.position.xyz, 0.0); vec3 fragEyeDir = normalize(fragEyeVector.xyz); + _fragColor = vec4(0, 0, 0, 1); int numLightTouching = 0; int lightClusterOffset = cluster.z; diff --git a/libraries/render-utils/src/local_lights_shading.slf b/libraries/render-utils/src/local_lights_shading.slf index 8ae8f3fb5b..b224fcb77d 100644 --- a/libraries/render-utils/src/local_lights_shading.slf +++ b/libraries/render-utils/src/local_lights_shading.slf @@ -45,8 +45,8 @@ void main(void) { discard; } - vec4 midNormalCurvature; - vec4 lowNormalCurvature; + vec4 midNormalCurvature = vec4(0); + vec4 lowNormalCurvature = vec4(0); if (frag.mode == FRAG_MODE_SCATTERING) { unpackMidLowNormalCurvature(texCoord, midNormalCurvature, lowNormalCurvature); }