From caacd3e5cfcbaac7c707bb8d15e8a435b1a8d322 Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 7 Feb 2018 18:46:47 -0800 Subject: [PATCH 1/5] Trying to fix the forwaard rendering --- .../render-utils/src/ForwardBufferWrite.slh | 38 ------------------- .../render-utils/src/ForwardGlobalLight.slh | 9 +++-- .../render-utils/src/MaterialTextures.slh | 1 + libraries/render-utils/src/forward_model.slf | 5 +-- .../src/forward_model_normal_map.slf | 6 +-- .../src/forward_model_specular_map.slf | 38 +++++++------------ .../render-utils/src/forward_model_unlit.slf | 8 ++-- 7 files changed, 28 insertions(+), 77 deletions(-) diff --git a/libraries/render-utils/src/ForwardBufferWrite.slh b/libraries/render-utils/src/ForwardBufferWrite.slh index 873514d51f..5bb838c971 100644 --- a/libraries/render-utils/src/ForwardBufferWrite.slh +++ b/libraries/render-utils/src/ForwardBufferWrite.slh @@ -11,17 +11,8 @@ <@if not FORWARD_BUFFER_WRITE_SLH@> <@def FORWARD_BUFFER_WRITE_SLH@> -<@include ForwardBuffer.slh@> - - layout(location = 0) out vec4 _fragColor0; -// the alpha threshold -const float alphaThreshold = 0.5; -float evalOpaqueFinalAlpha(float alpha, float mapAlpha) { - return mix(alpha, 1.0 - alpha, step(mapAlpha, alphaThreshold)); -} - const float DEFAULT_ROUGHNESS = 0.9; const float DEFAULT_SHININESS = 10.0; const float DEFAULT_METALLIC = 0.0; @@ -31,33 +22,4 @@ const float DEFAULT_OCCLUSION = 1.0; const float DEFAULT_SCATTERING = 0.0; const vec3 DEFAULT_FRESNEL = DEFAULT_EMISSIVE; -void packForwardFragment(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 emissive, float occlusion, float scattering) { - if (alpha != 1.0) { - discard; - } - _fragColor0 = vec4(albedo, ((scattering > 0.0) ? packScatteringMetallic(metallic) : packShadedMetallic(metallic))); -} - -void packForwardFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 fresnel, vec3 lightmap) { - if (alpha != 1.0) { - discard; - } - - _fragColor0 = vec4(albedo, packLightmappedMetallic(metallic)); -} - -void packForwardFragmentUnlit(vec3 normal, float alpha, vec3 color) { - if (alpha != 1.0) { - discard; - } - _fragColor0 = vec4(color, packUnlit()); -} - -void packForwardFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, vec3 fresnel, float roughness) { - if (alpha <= 0.0) { - discard; - } - _fragColor0 = vec4(albedo.rgb, alpha); -} - <@endif@> diff --git a/libraries/render-utils/src/ForwardGlobalLight.slh b/libraries/render-utils/src/ForwardGlobalLight.slh index ea30fa471a..3361eaf565 100644 --- a/libraries/render-utils/src/ForwardGlobalLight.slh +++ b/libraries/render-utils/src/ForwardGlobalLight.slh @@ -135,11 +135,12 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu color += directionalSpecular; // Attenuate the light if haze effect selected - if ((hazeParams.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) { - color = computeHazeColorKeyLightAttenuation(color, lightDirection, position); - } + // if ((hazeParams.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) { + // color = computeHazeColorKeyLightAttenuation(color, lightDirection, position); + // } - return color; + return normal; + // return color; } <@endfunc@> diff --git a/libraries/render-utils/src/MaterialTextures.slh b/libraries/render-utils/src/MaterialTextures.slh index 40709b3668..79ff47ff6c 100644 --- a/libraries/render-utils/src/MaterialTextures.slh +++ b/libraries/render-utils/src/MaterialTextures.slh @@ -155,6 +155,7 @@ vec3 fetchLightmapMap(vec2 uv) { vec3 normalizedBitangent = normalize(cross(normalizedNormal, normalizedTangent)); vec3 localNormal = <$fetchedNormal$>; <$normal$> = vec3(normalizedTangent * localNormal.x + normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z); +<$normal$> = normalizedNormal; } <@endfunc@> diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index 24ae4394fe..9bcc72b61d 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -66,9 +66,8 @@ void main(void) { TransformCamera cam = getTransformCamera(); vec3 fragNormal; - <$transformEyeToWorldDir(cam, _normal, fragNormal)$> - fragNormal = normalize(fragNormal); - + fragNormal = normalize(_normal); + vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, diff --git a/libraries/render-utils/src/forward_model_normal_map.slf b/libraries/render-utils/src/forward_model_normal_map.slf index 8d5086f930..d939e60c13 100644 --- a/libraries/render-utils/src/forward_model_normal_map.slf +++ b/libraries/render-utils/src/forward_model_normal_map.slf @@ -63,8 +63,8 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - vec3 viewNormal; - <$tangentToViewSpace(normalTex, _normal, _tangent, viewNormal)$> + vec3 fragNormal; + <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> float scattering = getMaterialScattering(mat); <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; @@ -78,7 +78,7 @@ void main(void) { 1.0, 1.0, fragPosition, - viewNormal, + fragNormal, albedo, fresnel, metallic, diff --git a/libraries/render-utils/src/forward_model_specular_map.slf b/libraries/render-utils/src/forward_model_specular_map.slf index 7240d7882e..673b1e5c66 100644 --- a/libraries/render-utils/src/forward_model_specular_map.slf +++ b/libraries/render-utils/src/forward_model_specular_map.slf @@ -63,36 +63,24 @@ void main(void) { else { fresnel = albedo; metallic = 1.0; - }/* - float scattering = getMaterialScattering(mat); - - packForwardFragment( - normalize(_normal), - opacity, - albedo, - roughness, - metallic, - emissive, - occlusionTex, - scattering); - */ + } vec3 fragPosition = _position.xyz; TransformCamera cam = getTransformCamera(); vec3 fragNormal; - <$transformEyeToWorldDir(cam, _normal, fragNormal)$> + fragNormal = normalize(_normal); - vec4 color = vec4(evalSkyboxGlobalColor( - cam._viewInverse, - 1.0, - 1.0, - fragPosition, - fragNormal, - albedo, - fresnel, - metallic, - roughness), - opacity); + vec4 color = vec4(evalSkyboxGlobalColor( + cam._viewInverse, + 1.0, + 1.0, + fragPosition, + fragNormal, + albedo, + fresnel, + metallic, + roughness), + opacity); color.rgb += emissive * isEmissiveEnabled(); // _fragColor = vec4(albedo, opacity); diff --git a/libraries/render-utils/src/forward_model_unlit.slf b/libraries/render-utils/src/forward_model_unlit.slf index a5087b4686..42f311bb65 100644 --- a/libraries/render-utils/src/forward_model_unlit.slf +++ b/libraries/render-utils/src/forward_model_unlit.slf @@ -38,8 +38,8 @@ void main(void) { <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; albedo *= _color; - packForwardFragmentUnlit( - normalize(_normal), - opacity, - albedo * isUnlitEnabled()); + if (opacity != 1.0) { + discard; + } + _fragColor0 = vec4(albedo * isUnlitEnabled(), 1.0); } From b66da1897dac9e526cdf16e0b0e851cc031a0839 Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 8 Feb 2018 17:59:07 -0800 Subject: [PATCH 2/5] improving the forward rendering pass, removing the specular variation and making it defautl --- .../display-plugins/OpenGLDisplayPlugin.cpp | 1 + .../render-utils/src/ForwardGlobalLight.slh | 9 +- libraries/render-utils/src/LightingModel.slh | 10 ++ .../render-utils/src/MaterialTextures.slh | 2 +- .../render-utils/src/MeshPartPayload.cpp | 10 +- .../render-utils/src/RenderForwardTask.cpp | 45 ++------ .../render-utils/src/RenderPipelines.cpp | 104 +++--------------- libraries/render-utils/src/ZoneRenderer.cpp | 12 +- libraries/render-utils/src/forward_model.slf | 8 +- .../src/forward_model_normal_map.slf | 15 +-- .../src/forward_model_normal_specular_map.slf | 22 +--- .../src/forward_model_specular_map.slf | 15 +-- .../src/forward_model_translucent.slf | 8 +- libraries/render-utils/src/model.slf | 8 +- .../render-utils/src/model_normal_map.slf | 9 +- .../src/model_normal_specular_map.slf | 1 + .../render-utils/src/model_specular_map.slf | 1 + libraries/render/src/render/ShapePipeline.h | 7 -- 18 files changed, 78 insertions(+), 209 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 40dcf1b8c7..ce3721b76b 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -64,6 +64,7 @@ vec3 colorToLinearRGB(vec3 srgb) { void main(void) { outFragColor.a = 1.0; outFragColor.rgb = colorToLinearRGB(texture(colorMap, varTexCoord0).rgb); + // outFragColor.rgb = texture(colorMap, varTexCoord0).rgb; } )SCRIBE"; diff --git a/libraries/render-utils/src/ForwardGlobalLight.slh b/libraries/render-utils/src/ForwardGlobalLight.slh index 3361eaf565..d30a5451ce 100644 --- a/libraries/render-utils/src/ForwardGlobalLight.slh +++ b/libraries/render-utils/src/ForwardGlobalLight.slh @@ -139,8 +139,9 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu // color = computeHazeColorKeyLightAttenuation(color, lightDirection, position); // } - return normal; - // return color; + // return normal; + // return pow(color, vec3(1.0/2.2)); + return color; } <@endfunc@> @@ -228,7 +229,7 @@ vec3 evalGlobalLightingAlphaBlendedWithHaze( color += directionalSpecular / opacity; // Haze - if ((hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE) { + /* if ((hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE) { vec4 colorV4 = computeHazeColor( vec4(color, 1.0), // fragment original color position, // fragment position in eye coordinates @@ -238,7 +239,7 @@ vec3 evalGlobalLightingAlphaBlendedWithHaze( ); color = colorV4.rgb; - } + }*/ return color; } diff --git a/libraries/render-utils/src/LightingModel.slh b/libraries/render-utils/src/LightingModel.slh index ddcbf8229c..2280d12465 100644 --- a/libraries/render-utils/src/LightingModel.slh +++ b/libraries/render-utils/src/LightingModel.slh @@ -311,4 +311,14 @@ void evalFragShadingGloss(out vec3 diffuse, out vec3 specular, specular = shading.xyz; } + +<@if not GETFRESNEL0@> +<@def GETFRESNEL0@> +vec3 getFresnelF0(float metallic, vec3 metalF0) { + // Enable continuous metallness value by lerping between dielectric + // and metal fresnel F0 value based on the "metallic" parameter + return mix(vec3(0.03), metalF0, metallic); +} +<@endif@> + <@endif@> diff --git a/libraries/render-utils/src/MaterialTextures.slh b/libraries/render-utils/src/MaterialTextures.slh index 79ff47ff6c..044ef6c92d 100644 --- a/libraries/render-utils/src/MaterialTextures.slh +++ b/libraries/render-utils/src/MaterialTextures.slh @@ -155,7 +155,7 @@ vec3 fetchLightmapMap(vec2 uv) { vec3 normalizedBitangent = normalize(cross(normalizedNormal, normalizedTangent)); vec3 localNormal = <$fetchedNormal$>; <$normal$> = vec3(normalizedTangent * localNormal.x + normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z); -<$normal$> = normalizedNormal; +// <$normal$> = fetchedNormal; } <@endfunc@> diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index c506887fc4..372803f329 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -104,9 +104,9 @@ ShapeKey MeshPartPayload::getShapeKey() const { if (drawMaterialKey.isNormalMap()) { builder.withTangents(); } - if (drawMaterialKey.isMetallicMap()) { + /* if (drawMaterialKey.isMetallicMap()) { builder.withSpecular(); - } + }*/ if (drawMaterialKey.isLightmapMap()) { builder.withLightmap(); } @@ -446,14 +446,13 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe bool isTranslucent = drawMaterialKey.isTranslucent(); bool hasTangents = drawMaterialKey.isNormalMap() && _hasTangents; - bool hasSpecular = drawMaterialKey.isMetallicMap(); bool hasLightmap = drawMaterialKey.isLightmapMap(); bool isUnlit = drawMaterialKey.isUnlit(); bool isSkinned = _isSkinned; if (isWireframe) { - isTranslucent = hasTangents = hasSpecular = hasLightmap = isSkinned = false; + isTranslucent = hasTangents = hasLightmap = isSkinned = false; } ShapeKey::Builder builder; @@ -465,9 +464,6 @@ void ModelMeshPartPayload::setShapeKey(bool invalidateShapeKey, bool isWireframe if (hasTangents) { builder.withTangents(); } - if (hasSpecular) { - builder.withSpecular(); - } if (hasLightmap) { builder.withLightmap(); } diff --git a/libraries/render-utils/src/RenderForwardTask.cpp b/libraries/render-utils/src/RenderForwardTask.cpp index c201e8a106..b267037c52 100755 --- a/libraries/render-utils/src/RenderForwardTask.cpp +++ b/libraries/render-utils/src/RenderForwardTask.cpp @@ -19,6 +19,8 @@ #include #include +#include + #include "StencilMaskPass.h" #include "ZoneRenderer.h" #include "FadeEffect.h" @@ -56,6 +58,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend fadeEffect->build(task, opaques); // Prepare objects shared by several jobs + const auto deferredFrameTransform = task.addJob("DeferredFrameTransform"); const auto lightingModel = task.addJob("LightingModel"); // Filter zones from the general metas bucket @@ -87,6 +90,8 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend task.addJob("DrawTransparentBounds", transparents); task.addJob("DrawZones", zones); + task.addJob("DrawZoneStack", deferredFrameTransform); + } // Layered Overlays @@ -136,34 +141,6 @@ void PrepareFramebuffer::run(const RenderContextPointer& renderContext, gpu::Fra framebuffer = _framebuffer; } -enum ForwardShader_MapSlot { - DEFERRED_BUFFER_COLOR_UNIT = 0, - DEFERRED_BUFFER_NORMAL_UNIT = 1, - DEFERRED_BUFFER_EMISSIVE_UNIT = 2, - DEFERRED_BUFFER_DEPTH_UNIT = 3, - DEFERRED_BUFFER_OBSCURANCE_UNIT = 4, - SHADOW_MAP_UNIT = 5, - SKYBOX_MAP_UNIT = SHADOW_MAP_UNIT + 4, - DEFERRED_BUFFER_LINEAR_DEPTH_UNIT, - DEFERRED_BUFFER_CURVATURE_UNIT, - DEFERRED_BUFFER_DIFFUSED_CURVATURE_UNIT, - SCATTERING_LUT_UNIT, - SCATTERING_SPECULAR_UNIT, -}; -enum ForwardShader_BufferSlot { - DEFERRED_FRAME_TRANSFORM_BUFFER_SLOT = 0, - CAMERA_CORRECTION_BUFFER_SLOT, - SCATTERING_PARAMETERS_BUFFER_SLOT, - LIGHTING_MODEL_BUFFER_SLOT = render::ShapePipeline::Slot::LIGHTING_MODEL, - LIGHT_GPU_SLOT = render::ShapePipeline::Slot::LIGHT, - LIGHT_AMBIENT_SLOT = render::ShapePipeline::Slot::LIGHT_AMBIENT_BUFFER, - HAZE_MODEL_BUFFER_SLOT = render::ShapePipeline::Slot::HAZE_MODEL, - LIGHT_INDEX_GPU_SLOT, - LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT, - LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT, - LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT, -}; - void PrepareForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) { RenderArgs* args = renderContext->args; gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { @@ -181,18 +158,14 @@ void PrepareForward::run(const RenderContextPointer& renderContext, const Inputs } if (keySunLight) { - if (LIGHT_GPU_SLOT >= 0) { - batch.setUniformBuffer(LIGHT_GPU_SLOT, keySunLight->getLightSchemaBuffer()); - } + batch.setUniformBuffer(render::ShapePipeline::Slot::KEY_LIGHT, keySunLight->getLightSchemaBuffer()); } if (keyAmbiLight) { - if (LIGHT_AMBIENT_SLOT >= 0) { - batch.setUniformBuffer(LIGHT_AMBIENT_SLOT, keyAmbiLight->getAmbientSchemaBuffer()); - } + batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHT_AMBIENT_BUFFER, keyAmbiLight->getAmbientSchemaBuffer()); - if (keyAmbiLight->getAmbientMap() && (SKYBOX_MAP_UNIT >= 0)) { - batch.setResourceTexture(SKYBOX_MAP_UNIT, keyAmbiLight->getAmbientMap()); + if (keyAmbiLight->getAmbientMap()) { + batch.setResourceTexture(render::ShapePipeline::Slot::LIGHT_AMBIENT, keyAmbiLight->getAmbientMap()); } } }); diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index f9a2b613a3..5125f555ca 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -216,28 +216,20 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip auto simpleUnlitPixel = simple_textured_unlit_frag::getShader(); auto simpleTranslucentPixel = simple_transparent_textured_frag::getShader(); auto simpleTranslucentUnlitPixel = simple_transparent_textured_unlit_frag::getShader(); - auto modelPixel = model_frag::getShader(); + auto modelPixel = model_specular_map_frag::getShader(); //model_frag::getShader(); auto modelUnlitPixel = model_unlit_frag::getShader(); - auto modelNormalMapPixel = model_normal_map_frag::getShader(); - auto modelSpecularMapPixel = model_specular_map_frag::getShader(); - auto modelNormalSpecularMapPixel = model_normal_specular_map_frag::getShader(); + auto modelNormalMapPixel = model_normal_specular_map_frag::getShader(); //model_normal_map_frag::getShader(); auto modelTranslucentPixel = model_translucent_frag::getShader(); auto modelTranslucentUnlitPixel = model_translucent_unlit_frag::getShader(); auto modelShadowPixel = model_shadow_frag::getShader(); - auto modelLightmapPixel = model_lightmap_frag::getShader(); - auto modelLightmapNormalMapPixel = model_lightmap_normal_map_frag::getShader(); - auto modelLightmapSpecularMapPixel = model_lightmap_specular_map_frag::getShader(); - auto modelLightmapNormalSpecularMapPixel = model_lightmap_normal_specular_map_frag::getShader(); - auto modelLightmapFadePixel = model_lightmap_fade_frag::getShader(); - auto modelLightmapNormalMapFadePixel = model_lightmap_normal_map_fade_frag::getShader(); - auto modelLightmapSpecularMapFadePixel = model_lightmap_specular_map_fade_frag::getShader(); - auto modelLightmapNormalSpecularMapFadePixel = model_lightmap_normal_specular_map_fade_frag::getShader(); + auto modelLightmapPixel = model_lightmap_specular_map_frag::getShader(); // model_lightmap_frag::getShader(); + auto modelLightmapNormalMapPixel = model_lightmap_normal_specular_map_frag::getShader(); //model_lightmap_normal_map_frag::getShader(); + auto modelLightmapFadePixel = model_lightmap_specular_map_fade_frag::getShader(); //model_lightmap_fade_frag::getShader(); + auto modelLightmapNormalMapFadePixel = model_lightmap_normal_specular_map_fade_frag::getShader(); //model_lightmap_normal_map_fade_frag::getShader(); - auto modelFadePixel = model_fade_frag::getShader(); + auto modelFadePixel = model_specular_map_fade_frag::getShader(); //model_fade_frag::getShader(); auto modelUnlitFadePixel = model_unlit_fade_frag::getShader(); - auto modelNormalMapFadePixel = model_normal_map_fade_frag::getShader(); - auto modelSpecularMapFadePixel = model_specular_map_fade_frag::getShader(); - auto modelNormalSpecularMapFadePixel = model_normal_specular_map_fade_frag::getShader(); + auto modelNormalMapFadePixel = model_normal_specular_map_fade_frag::getShader(); //model_normal_map_fade_frag::getShader(); auto modelShadowFadePixel = model_shadow_fade_frag::getShader(); auto modelTranslucentFadePixel = model_translucent_fade_frag::getShader(); auto modelTranslucentUnlitFadePixel = model_translucent_unlit_fade_frag::getShader(); @@ -265,12 +257,7 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withTangents(), modelNormalMapVertex, modelNormalMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withSpecular(), - modelVertex, modelSpecularMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withTangents().withSpecular(), - modelNormalMapVertex, modelNormalSpecularMapPixel, nullptr, nullptr); + // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withFade(), @@ -287,12 +274,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withTangents().withFade(), modelNormalMapFadeVertex, modelNormalMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withSpecular().withFade(), - modelFadeVertex, modelSpecularMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withTangents().withSpecular().withFade(), - modelNormalMapFadeVertex, modelNormalSpecularMapFadePixel, batchSetter, itemSetter); // Translucents addPipeline( @@ -310,12 +291,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withTranslucent().withTangents(), modelTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withTranslucent().withSpecular(), - modelTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withTranslucent().withTangents().withSpecular(), - modelTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); addPipeline( // FIXME: Ignore lightmap for translucents meshpart Key::Builder().withMaterial().withTranslucent().withLightmap(), @@ -336,12 +311,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withTranslucent().withTangents().withFade(), modelNormalMapFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withTranslucent().withSpecular().withFade(), - modelFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withTranslucent().withTangents().withSpecular().withFade(), - modelNormalMapFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); addPipeline( // FIXME: Ignore lightmap for translucents meshpart Key::Builder().withMaterial().withTranslucent().withLightmap().withFade(), @@ -354,12 +323,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withLightmap().withTangents(), modelLightmapNormalMapVertex, modelLightmapNormalMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withLightmap().withSpecular(), - modelLightmapVertex, modelLightmapSpecularMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withLightmap().withTangents().withSpecular(), - modelLightmapNormalMapVertex, modelLightmapNormalSpecularMapPixel, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withLightmap().withFade(), @@ -367,12 +330,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withLightmap().withTangents().withFade(), modelLightmapNormalMapFadeVertex, modelLightmapNormalMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withLightmap().withSpecular().withFade(), - modelLightmapFadeVertex, modelLightmapSpecularMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withLightmap().withTangents().withSpecular().withFade(), - modelLightmapNormalMapFadeVertex, modelLightmapNormalSpecularMapFadePixel, batchSetter, itemSetter); // Skinned addPipeline( @@ -381,12 +338,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withSkinned().withTangents(), skinModelNormalMapVertex, modelNormalMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withSkinned().withSpecular(), - skinModelVertex, modelSpecularMapPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(), - skinModelNormalMapVertex, modelNormalSpecularMapPixel, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withFade(), @@ -394,12 +345,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withSkinned().withTangents().withFade(), skinModelNormalMapFadeVertex, modelNormalMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withSkinned().withSpecular().withFade(), - skinModelFadeVertex, modelSpecularMapFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents().withSpecular().withFade(), - skinModelNormalMapFadeVertex, modelNormalSpecularMapFadePixel, batchSetter, itemSetter); // Skinned and Translucent addPipeline( @@ -408,12 +353,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), skinModelNormalMapTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withSpecular(), - skinModelTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withSpecular(), - skinModelNormalMapTranslucentVertex, modelTranslucentPixel, nullptr, nullptr); // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withFade(), @@ -421,12 +360,6 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withFade(), skinModelNormalMapFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withSpecular().withFade(), - skinModelFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); - addPipeline( - Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withSpecular().withFade(), - skinModelNormalMapFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); // Depth-only addPipeline( @@ -450,15 +383,11 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba auto modelNormalMapVertex = model_normal_map_vert::getShader(); auto skinModelVertex = skin_model_vert::getShader(); auto skinModelNormalMapVertex = skin_model_normal_map_vert::getShader(); - auto skinModelNormalMapFadeVertex = skin_model_normal_map_fade_vert::getShader(); // Pixel shaders - auto modelPixel = forward_model_frag::getShader(); + auto modelPixel = forward_model_specular_map_frag::getShader(); //forward_model_frag::getShader(); auto modelUnlitPixel = forward_model_unlit_frag::getShader(); - auto modelNormalMapPixel = forward_model_normal_map_frag::getShader(); - auto modelSpecularMapPixel = forward_model_specular_map_frag::getShader(); - auto modelNormalSpecularMapPixel = forward_model_normal_specular_map_frag::getShader(); - auto modelNormalMapFadePixel = model_normal_map_fade_frag::getShader(); + auto modelNormalMapPixel = forward_model_normal_specular_map_frag::getShader(); //forward_model_normal_map_frag::getShader(); auto modelTranslucentPixel = forward_model_translucent_frag::getShader(); using Key = render::ShapeKey; @@ -472,31 +401,24 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba // Forward pipelines need the lightBatchSetter for opaques and transparents forceLightBatchSetter = true; + // forceLightBatchSetter = false; // Opaques addPipeline(Key::Builder().withMaterial(), modelVertex, modelPixel); addPipeline(Key::Builder().withMaterial().withUnlit(), modelVertex, modelUnlitPixel); addPipeline(Key::Builder().withMaterial().withTangents(), modelNormalMapVertex, modelNormalMapPixel); - addPipeline(Key::Builder().withMaterial().withSpecular(), modelVertex, modelSpecularMapPixel); - addPipeline(Key::Builder().withMaterial().withTangents().withSpecular(), modelNormalMapVertex, modelNormalSpecularMapPixel); - + // Skinned Opaques addPipeline(Key::Builder().withMaterial().withSkinned(), skinModelVertex, modelPixel); addPipeline(Key::Builder().withMaterial().withSkinned().withTangents(), skinModelNormalMapVertex, modelNormalMapPixel); - addPipeline(Key::Builder().withMaterial().withSkinned().withSpecular(), skinModelVertex, modelSpecularMapPixel); - addPipeline(Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(), skinModelNormalMapVertex, modelNormalSpecularMapPixel); // Translucents addPipeline(Key::Builder().withMaterial().withTranslucent(), modelVertex, modelTranslucentPixel); addPipeline(Key::Builder().withMaterial().withTranslucent().withTangents(), modelNormalMapVertex, modelTranslucentPixel); - addPipeline(Key::Builder().withMaterial().withTranslucent().withSpecular(), modelVertex, modelTranslucentPixel); - addPipeline(Key::Builder().withMaterial().withTranslucent().withTangents().withSpecular(), modelNormalMapVertex, modelTranslucentPixel); // Skinned Translucents addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent(), skinModelVertex, modelTranslucentPixel); addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), skinModelNormalMapVertex, modelTranslucentPixel); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withSpecular(), skinModelVertex, modelTranslucentPixel); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withSpecular(), skinModelNormalMapVertex, modelTranslucentPixel); forceLightBatchSetter = false; } diff --git a/libraries/render-utils/src/ZoneRenderer.cpp b/libraries/render-utils/src/ZoneRenderer.cpp index 1d358ff895..b6d0e61577 100644 --- a/libraries/render-utils/src/ZoneRenderer.cpp +++ b/libraries/render-utils/src/ZoneRenderer.cpp @@ -52,25 +52,25 @@ void ZoneRendererTask::build(JobModel& task, const Varying& input, Varying& oupu } void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) { + // Grab light, background and haze stages and clear them + auto lightStage = context->_scene->getStage(); + assert(lightStage); + lightStage->_currentFrame.clear(); + auto backgroundStage = context->_scene->getStage(); assert(backgroundStage); backgroundStage->_currentFrame.clear(); - // Haze auto hazeStage = context->_scene->getStage(); assert(hazeStage); hazeStage->_currentFrame.clear(); - // call render in the correct order first... + // call render over the zones to grab their components in the correct order first... render::renderItems(context, inputs); // Finally add the default lights and background: - auto lightStage = context->_scene->getStage(); - assert(lightStage); - lightStage->_currentFrame.pushSunLight(lightStage->getDefaultLight()); lightStage->_currentFrame.pushAmbientLight(lightStage->getDefaultLight()); - backgroundStage->_currentFrame.pushBackground(0); hazeStage->_currentFrame.pushHaze(0); } diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index 9bcc72b61d..f38530af54 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -47,13 +47,7 @@ void main(void) { albedo *= _color; float metallic = getMaterialMetallic(mat); - vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value - if (metallic <= 0.5) { - metallic = 0.0; - } else { - fresnel = albedo; - metallic = 1.0; - } + vec3 fresnel = getFresnelF0(metallic, albedo); float roughness = getMaterialRoughness(mat); <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; diff --git a/libraries/render-utils/src/forward_model_normal_map.slf b/libraries/render-utils/src/forward_model_normal_map.slf index d939e60c13..c139bd8997 100644 --- a/libraries/render-utils/src/forward_model_normal_map.slf +++ b/libraries/render-utils/src/forward_model_normal_map.slf @@ -49,13 +49,7 @@ void main(void) { albedo *= _color; float metallic = getMaterialMetallic(mat); - vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value - if (metallic <= 0.5) { - metallic = 0.0; - } else { - fresnel = albedo; - metallic = 1.0; - } + vec3 fresnel = getFresnelF0(metallic, albedo); float roughness = getMaterialRoughness(mat); <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; @@ -63,20 +57,19 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - vec3 fragNormal; - <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> - float scattering = getMaterialScattering(mat); <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; vec3 fragPosition = _position.xyz; + vec3 fragNormal; + <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> TransformCamera cam = getTransformCamera(); vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, - 1.0, + occlusionTex, fragPosition, fragNormal, albedo, diff --git a/libraries/render-utils/src/forward_model_normal_specular_map.slf b/libraries/render-utils/src/forward_model_normal_specular_map.slf index 7ce76f3d39..d8b0011bc3 100644 --- a/libraries/render-utils/src/forward_model_normal_specular_map.slf +++ b/libraries/render-utils/src/forward_model_normal_specular_map.slf @@ -12,9 +12,6 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - - !> - <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> @@ -55,29 +52,22 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - vec3 viewNormal; - <$tangentToViewSpace(normalTex, _normal, _tangent, viewNormal)$> - float metallic = getMaterialMetallic(mat); <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value - if (metallic <= 0.5) { - metallic = 0.0; - } - else { - fresnel = albedo; - metallic = 1.0; - } + vec3 fresnel = getFresnelF0(metallic, albedo); + vec3 fragPosition = _position.xyz; + vec3 fragNormal; + <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> TransformCamera cam = getTransformCamera(); vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, - 1.0, + occlusionTex, fragPosition, - viewNormal, + fragNormal, albedo, fresnel, metallic, diff --git a/libraries/render-utils/src/forward_model_specular_map.slf b/libraries/render-utils/src/forward_model_specular_map.slf index 673b1e5c66..2ab8f2851b 100644 --- a/libraries/render-utils/src/forward_model_specular_map.slf +++ b/libraries/render-utils/src/forward_model_specular_map.slf @@ -38,7 +38,7 @@ void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> - !> + <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; @@ -56,19 +56,12 @@ void main(void) { float metallic = getMaterialMetallic(mat); <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value - if (metallic <= 0.5) { - metallic = 0.0; - } - else { - fresnel = albedo; - metallic = 1.0; - } + vec3 fresnel = getFresnelF0(metallic, albedo); + vec3 fragPosition = _position.xyz; + vec3 fragNormal = normalize(_normal); TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - fragNormal = normalize(_normal); vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, diff --git a/libraries/render-utils/src/forward_model_translucent.slf b/libraries/render-utils/src/forward_model_translucent.slf index d632d7e05e..9404740594 100644 --- a/libraries/render-utils/src/forward_model_translucent.slf +++ b/libraries/render-utils/src/forward_model_translucent.slf @@ -50,13 +50,7 @@ void main(void) { <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; float metallic = getMaterialMetallic(mat); - vec3 fresnel = vec3(0.03); // Default Di-electric fresnel value - if (metallic <= 0.5) { - metallic = 0.0; - } else { - fresnel = albedo; - metallic = 1.0; - } + vec3 fresnel = getFresnelF0(metallic, albedo); vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index c26ac2eb70..b52e56abd3 100644 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -16,7 +16,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> in vec4 _position; in vec3 _normal; @@ -45,14 +45,18 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; + float scattering = getMaterialScattering(mat); + <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( normalize(_normal.xyz), opacity, albedo, roughness, - getMaterialMetallic(mat), + metallic, emissive, occlusionTex, scattering); diff --git a/libraries/render-utils/src/model_normal_map.slf b/libraries/render-utils/src/model_normal_map.slf index 95d1323e7f..7f2c010a36 100644 --- a/libraries/render-utils/src/model_normal_map.slf +++ b/libraries/render-utils/src/model_normal_map.slf @@ -17,7 +17,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$> in vec4 _position; in vec2 _texCoord0; @@ -29,7 +29,7 @@ in vec3 _color; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex, scatteringTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex, scatteringTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; @@ -49,6 +49,9 @@ void main(void) { vec3 viewNormal; <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; + float scattering = getMaterialScattering(mat); <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; @@ -57,7 +60,7 @@ void main(void) { opacity, albedo, roughness, - getMaterialMetallic(mat), + metallic, emissive, occlusionTex, scattering); diff --git a/libraries/render-utils/src/model_normal_specular_map.slf b/libraries/render-utils/src/model_normal_specular_map.slf index 91ec4d7a0f..18c0797a4c 100644 --- a/libraries/render-utils/src/model_normal_specular_map.slf +++ b/libraries/render-utils/src/model_normal_specular_map.slf @@ -53,6 +53,7 @@ void main(void) { <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; float scattering = getMaterialScattering(mat); + <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( normalize(viewNormal.xyz), diff --git a/libraries/render-utils/src/model_specular_map.slf b/libraries/render-utils/src/model_specular_map.slf index e8e2b93143..830c788674 100644 --- a/libraries/render-utils/src/model_specular_map.slf +++ b/libraries/render-utils/src/model_specular_map.slf @@ -50,6 +50,7 @@ void main(void) { <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; float scattering = getMaterialScattering(mat); + <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( normalize(_normal), diff --git a/libraries/render/src/render/ShapePipeline.h b/libraries/render/src/render/ShapePipeline.h index 1dd9f5da49..2cdbdfb9ce 100644 --- a/libraries/render/src/render/ShapePipeline.h +++ b/libraries/render/src/render/ShapePipeline.h @@ -29,7 +29,6 @@ public: TRANSLUCENT, LIGHTMAP, TANGENTS, - SPECULAR, UNLIT, SKINNED, DEPTH_ONLY, @@ -77,7 +76,6 @@ public: Builder& withTranslucent() { _flags.set(TRANSLUCENT); return (*this); } Builder& withLightmap() { _flags.set(LIGHTMAP); return (*this); } Builder& withTangents() { _flags.set(TANGENTS); return (*this); } - Builder& withSpecular() { _flags.set(SPECULAR); return (*this); } Builder& withUnlit() { _flags.set(UNLIT); return (*this); } Builder& withSkinned() { _flags.set(SKINNED); return (*this); } Builder& withDepthOnly() { _flags.set(DEPTH_ONLY); return (*this); } @@ -124,9 +122,6 @@ public: Builder& withTangents() { _flags.set(TANGENTS); _mask.set(TANGENTS); return (*this); } Builder& withoutTangents() { _flags.reset(TANGENTS); _mask.set(TANGENTS); return (*this); } - Builder& withSpecular() { _flags.set(SPECULAR); _mask.set(SPECULAR); return (*this); } - Builder& withoutSpecular() { _flags.reset(SPECULAR); _mask.set(SPECULAR); return (*this); } - Builder& withUnlit() { _flags.set(UNLIT); _mask.set(UNLIT); return (*this); } Builder& withoutUnlit() { _flags.reset(UNLIT); _mask.set(UNLIT); return (*this); } @@ -167,7 +162,6 @@ public: bool useMaterial() const { return _flags[MATERIAL]; } bool hasLightmap() const { return _flags[LIGHTMAP]; } bool hasTangents() const { return _flags[TANGENTS]; } - bool hasSpecular() const { return _flags[SPECULAR]; } bool isUnlit() const { return _flags[UNLIT]; } bool isTranslucent() const { return _flags[TRANSLUCENT]; } bool isSkinned() const { return _flags[SKINNED]; } @@ -207,7 +201,6 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) { << "useMaterial:" << key.useMaterial() << "hasLightmap:" << key.hasLightmap() << "hasTangents:" << key.hasTangents() - << "hasSpecular:" << key.hasSpecular() << "isUnlit:" << key.isUnlit() << "isTranslucent:" << key.isTranslucent() << "isSkinned:" << key.isSkinned() From f20e1a727e356d2b7b3416b8528dc37ca4a56993 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 8 Feb 2018 23:07:39 -0800 Subject: [PATCH 3/5] Removing the specular pipeline since we now take care of it with the base shader, remove unused shader include files adding the tone map pass --- libraries/render-utils/src/ForwardBuffer.slh | 68 ---------------- .../render-utils/src/ForwardBufferWrite.slh | 25 ------ .../render-utils/src/ForwardGlobalLight.slh | 2 - .../render-utils/src/RenderForwardTask.cpp | 5 ++ .../render-utils/src/RenderPipelines.cpp | 35 +++----- libraries/render-utils/src/forward_model.slf | 38 +++++---- .../src/forward_model_normal_map.slf | 31 +++---- .../src/forward_model_normal_specular_map.slf | 81 ------------------- .../src/forward_model_specular_map.slf | 81 ------------------- .../src/forward_model_translucent.slf | 9 ++- .../render-utils/src/forward_model_unlit.slf | 3 +- libraries/render-utils/src/model.slf | 17 ++-- libraries/render-utils/src/model_fade.slf | 26 +++--- libraries/render-utils/src/model_lightmap.slf | 13 ++- .../render-utils/src/model_lightmap_fade.slf | 11 ++- .../src/model_lightmap_normal_map.slf | 16 ++-- .../src/model_lightmap_normal_map_fade.slf | 14 ++-- .../model_lightmap_normal_specular_map.slf | 47 ----------- ...odel_lightmap_normal_specular_map_fade.slf | 57 ------------- .../src/model_lightmap_specular_map.slf | 43 ---------- .../src/model_lightmap_specular_map_fade.slf | 53 ------------ .../render-utils/src/model_normal_map.slf | 10 +-- .../src/model_normal_map_fade.slf | 22 ++--- .../src/model_normal_specular_map.slf | 67 --------------- .../src/model_normal_specular_map_fade.slf | 76 ----------------- .../render-utils/src/model_specular_map.slf | 64 --------------- .../src/model_specular_map_fade.slf | 72 ----------------- tests/shaders/src/main.cpp | 10 --- 28 files changed, 121 insertions(+), 875 deletions(-) delete mode 100644 libraries/render-utils/src/ForwardBuffer.slh delete mode 100644 libraries/render-utils/src/ForwardBufferWrite.slh delete mode 100644 libraries/render-utils/src/forward_model_normal_specular_map.slf delete mode 100644 libraries/render-utils/src/forward_model_specular_map.slf delete mode 100644 libraries/render-utils/src/model_lightmap_normal_specular_map.slf delete mode 100644 libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf delete mode 100644 libraries/render-utils/src/model_lightmap_specular_map.slf delete mode 100644 libraries/render-utils/src/model_lightmap_specular_map_fade.slf delete mode 100644 libraries/render-utils/src/model_normal_specular_map.slf delete mode 100644 libraries/render-utils/src/model_normal_specular_map_fade.slf delete mode 100644 libraries/render-utils/src/model_specular_map.slf delete mode 100644 libraries/render-utils/src/model_specular_map_fade.slf diff --git a/libraries/render-utils/src/ForwardBuffer.slh b/libraries/render-utils/src/ForwardBuffer.slh deleted file mode 100644 index 4d1dc89aa4..0000000000 --- a/libraries/render-utils/src/ForwardBuffer.slh +++ /dev/null @@ -1,68 +0,0 @@ - -<@if not FORWARD_BUFFER_SLH@> -<@def FORWARD_BUFFER_SLH@> - -<@include gpu/PackedNormal.slh@> - -// Unpack the metallic-mode value -const float FRAG_PACK_SHADED_NON_METALLIC = 0.0; -const float FRAG_PACK_SHADED_METALLIC = 0.1; -const float FRAG_PACK_SHADED_RANGE_INV = 1.0 / (FRAG_PACK_SHADED_METALLIC - FRAG_PACK_SHADED_NON_METALLIC); - -const float FRAG_PACK_LIGHTMAPPED_NON_METALLIC = 0.2; -const float FRAG_PACK_LIGHTMAPPED_METALLIC = 0.3; -const float FRAG_PACK_LIGHTMAPPED_RANGE_INV = 1.0 / (FRAG_PACK_LIGHTMAPPED_METALLIC - FRAG_PACK_LIGHTMAPPED_NON_METALLIC); - -const float FRAG_PACK_SCATTERING_NON_METALLIC = 0.4; -const float FRAG_PACK_SCATTERING_METALLIC = 0.5; -const float FRAG_PACK_SCATTERING_RANGE_INV = 1.0 / (FRAG_PACK_SCATTERING_METALLIC - FRAG_PACK_SCATTERING_NON_METALLIC); - -const float FRAG_PACK_UNLIT = 0.6; - -const int FRAG_MODE_UNLIT = 0; -const int FRAG_MODE_SHADED = 1; -const int FRAG_MODE_LIGHTMAPPED = 2; -const int FRAG_MODE_SCATTERING = 3; - -void unpackModeMetallic(float rawValue, out int mode, out float metallic) { - if (rawValue <= FRAG_PACK_SHADED_METALLIC) { - mode = FRAG_MODE_SHADED; - metallic = clamp((rawValue - FRAG_PACK_SHADED_NON_METALLIC) * FRAG_PACK_SHADED_RANGE_INV, 0.0, 1.0); - } else if (rawValue <= FRAG_PACK_LIGHTMAPPED_METALLIC) { - mode = FRAG_MODE_LIGHTMAPPED; - metallic = clamp((rawValue - FRAG_PACK_LIGHTMAPPED_NON_METALLIC) * FRAG_PACK_LIGHTMAPPED_RANGE_INV, 0.0, 1.0); - } else if (rawValue <= FRAG_PACK_SCATTERING_METALLIC) { - mode = FRAG_MODE_SCATTERING; - metallic = clamp((rawValue - FRAG_PACK_SCATTERING_NON_METALLIC) * FRAG_PACK_SCATTERING_RANGE_INV, 0.0, 1.0); - } else if (rawValue >= FRAG_PACK_UNLIT) { - mode = FRAG_MODE_UNLIT; - metallic = 0.0; - } -} - -float packShadedMetallic(float metallic) { - return mix(FRAG_PACK_SHADED_NON_METALLIC, FRAG_PACK_SHADED_METALLIC, metallic); -} - -float packLightmappedMetallic(float metallic) { - return mix(FRAG_PACK_LIGHTMAPPED_NON_METALLIC, FRAG_PACK_LIGHTMAPPED_METALLIC, metallic); -} - -float packScatteringMetallic(float metallic) { - return mix(FRAG_PACK_SCATTERING_NON_METALLIC, FRAG_PACK_SCATTERING_METALLIC, metallic); -} - -float packUnlit() { - return FRAG_PACK_UNLIT; -} - -<@endif@> diff --git a/libraries/render-utils/src/ForwardBufferWrite.slh b/libraries/render-utils/src/ForwardBufferWrite.slh deleted file mode 100644 index 5bb838c971..0000000000 --- a/libraries/render-utils/src/ForwardBufferWrite.slh +++ /dev/null @@ -1,25 +0,0 @@ - -<@if not FORWARD_BUFFER_WRITE_SLH@> -<@def FORWARD_BUFFER_WRITE_SLH@> - -layout(location = 0) out vec4 _fragColor0; - -const float DEFAULT_ROUGHNESS = 0.9; -const float DEFAULT_SHININESS = 10.0; -const float DEFAULT_METALLIC = 0.0; -const vec3 DEFAULT_SPECULAR = vec3(0.1); -const vec3 DEFAULT_EMISSIVE = vec3(0.0); -const float DEFAULT_OCCLUSION = 1.0; -const float DEFAULT_SCATTERING = 0.0; -const vec3 DEFAULT_FRESNEL = DEFAULT_EMISSIVE; - -<@endif@> diff --git a/libraries/render-utils/src/ForwardGlobalLight.slh b/libraries/render-utils/src/ForwardGlobalLight.slh index d30a5451ce..c0aebfd087 100644 --- a/libraries/render-utils/src/ForwardGlobalLight.slh +++ b/libraries/render-utils/src/ForwardGlobalLight.slh @@ -139,8 +139,6 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu // color = computeHazeColorKeyLightAttenuation(color, lightDirection, position); // } - // return normal; - // return pow(color, vec3(1.0/2.2)); return color; } diff --git a/libraries/render-utils/src/RenderForwardTask.cpp b/libraries/render-utils/src/RenderForwardTask.cpp index b267037c52..c97d95cc30 100755 --- a/libraries/render-utils/src/RenderForwardTask.cpp +++ b/libraries/render-utils/src/RenderForwardTask.cpp @@ -24,6 +24,7 @@ #include "StencilMaskPass.h" #include "ZoneRenderer.h" #include "FadeEffect.h" +#include "ToneMappingEffect.h" #include "BackgroundStage.h" #include "FramebufferCache.h" #include "TextureCache.h" @@ -83,6 +84,10 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend const auto transparentInputs = DrawForward::Inputs(transparents, lightingModel).asVarying(); task.addJob("DrawTransparents", transparentInputs, shapePlumber); + // Lighting Buffer ready for tone mapping + const auto toneMappingInputs = ToneMappingDeferred::Inputs(framebuffer, framebuffer).asVarying(); + task.addJob("ToneMapping", toneMappingInputs); + { // Debug the bounds of the rendered items, still look at the zbuffer task.addJob("DrawMetaBounds", metas); diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 5125f555ca..9ab4245e53 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -49,36 +49,25 @@ #include "model_frag.h" #include "model_unlit_frag.h" #include "model_normal_map_frag.h" -#include "model_normal_specular_map_frag.h" -#include "model_specular_map_frag.h" - #include "model_fade_vert.h" #include "model_normal_map_fade_vert.h" #include "model_fade_frag.h" #include "model_unlit_fade_frag.h" #include "model_normal_map_fade_frag.h" -#include "model_normal_specular_map_fade_frag.h" -#include "model_specular_map_fade_frag.h" #include "forward_model_frag.h" #include "forward_model_unlit_frag.h" #include "forward_model_normal_map_frag.h" -#include "forward_model_normal_specular_map_frag.h" -#include "forward_model_specular_map_frag.h" #include "forward_model_translucent_frag.h" #include "model_lightmap_frag.h" #include "model_lightmap_normal_map_frag.h" -#include "model_lightmap_normal_specular_map_frag.h" -#include "model_lightmap_specular_map_frag.h" #include "model_translucent_frag.h" #include "model_translucent_unlit_frag.h" #include "model_lightmap_fade_frag.h" #include "model_lightmap_normal_map_fade_frag.h" -#include "model_lightmap_normal_specular_map_fade_frag.h" -#include "model_lightmap_specular_map_fade_frag.h" #include "model_translucent_fade_frag.h" #include "model_translucent_unlit_fade_frag.h" @@ -216,20 +205,20 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip auto simpleUnlitPixel = simple_textured_unlit_frag::getShader(); auto simpleTranslucentPixel = simple_transparent_textured_frag::getShader(); auto simpleTranslucentUnlitPixel = simple_transparent_textured_unlit_frag::getShader(); - auto modelPixel = model_specular_map_frag::getShader(); //model_frag::getShader(); + auto modelPixel = model_frag::getShader(); auto modelUnlitPixel = model_unlit_frag::getShader(); - auto modelNormalMapPixel = model_normal_specular_map_frag::getShader(); //model_normal_map_frag::getShader(); + auto modelNormalMapPixel = model_normal_map_frag::getShader(); auto modelTranslucentPixel = model_translucent_frag::getShader(); auto modelTranslucentUnlitPixel = model_translucent_unlit_frag::getShader(); auto modelShadowPixel = model_shadow_frag::getShader(); - auto modelLightmapPixel = model_lightmap_specular_map_frag::getShader(); // model_lightmap_frag::getShader(); - auto modelLightmapNormalMapPixel = model_lightmap_normal_specular_map_frag::getShader(); //model_lightmap_normal_map_frag::getShader(); - auto modelLightmapFadePixel = model_lightmap_specular_map_fade_frag::getShader(); //model_lightmap_fade_frag::getShader(); - auto modelLightmapNormalMapFadePixel = model_lightmap_normal_specular_map_fade_frag::getShader(); //model_lightmap_normal_map_fade_frag::getShader(); + auto modelLightmapPixel = model_lightmap_frag::getShader(); + auto modelLightmapNormalMapPixel = model_lightmap_normal_map_frag::getShader(); + auto modelLightmapFadePixel = model_lightmap_fade_frag::getShader(); + auto modelLightmapNormalMapFadePixel = model_lightmap_normal_map_fade_frag::getShader(); - auto modelFadePixel = model_specular_map_fade_frag::getShader(); //model_fade_frag::getShader(); + auto modelFadePixel = model_fade_frag::getShader(); auto modelUnlitFadePixel = model_unlit_fade_frag::getShader(); - auto modelNormalMapFadePixel = model_normal_specular_map_fade_frag::getShader(); //model_normal_map_fade_frag::getShader(); + auto modelNormalMapFadePixel = model_normal_map_fade_frag::getShader(); auto modelShadowFadePixel = model_shadow_fade_frag::getShader(); auto modelTranslucentFadePixel = model_translucent_fade_frag::getShader(); auto modelTranslucentUnlitFadePixel = model_translucent_unlit_fade_frag::getShader(); @@ -385,9 +374,9 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba auto skinModelNormalMapVertex = skin_model_normal_map_vert::getShader(); // Pixel shaders - auto modelPixel = forward_model_specular_map_frag::getShader(); //forward_model_frag::getShader(); + auto modelPixel = forward_model_frag::getShader(); auto modelUnlitPixel = forward_model_unlit_frag::getShader(); - auto modelNormalMapPixel = forward_model_normal_specular_map_frag::getShader(); //forward_model_normal_map_frag::getShader(); + auto modelNormalMapPixel = forward_model_normal_map_frag::getShader(); auto modelTranslucentPixel = forward_model_translucent_frag::getShader(); using Key = render::ShapeKey; @@ -400,8 +389,8 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba }; // Forward pipelines need the lightBatchSetter for opaques and transparents - forceLightBatchSetter = true; - // forceLightBatchSetter = false; + // forceLightBatchSetter = true; + forceLightBatchSetter = false; // Opaques addPipeline(Key::Builder().withMaterial(), modelVertex, modelPixel); diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index f38530af54..382a6ea8e9 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -1,18 +1,16 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> -// forward_model.frag +// +// forward_model_specular_map.frag // fragment shader // -// Created by Andrzej Kapolka on 10/14/13. -// Copyright 2013 High Fidelity, Inc. +// Created by Sam Gateau on 2/15/2016. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - - !> - <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> @@ -22,21 +20,21 @@ <$declareStandardCameraTransform()$> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, _SCRIBE_NULL)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> in vec4 _position; -in vec3 _normal; -in vec3 _color; in vec2 _texCoord0; in vec2 _texCoord1; +in vec3 _normal; +in vec3 _color; -out vec4 _fragColor; +layout(location = 0) out vec4 _fragColor0; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$> - !> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> + <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; @@ -46,21 +44,20 @@ void main(void) { <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; albedo *= _color; - float metallic = getMaterialMetallic(mat); - vec3 fresnel = getFresnelF0(metallic, albedo); - float roughness = getMaterialRoughness(mat); <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; + vec3 fresnel = getFresnelF0(metallic, albedo); vec3 fragPosition = _position.xyz; + vec3 fragNormal = normalize(_normal); TransformCamera cam = getTransformCamera(); - vec3 fragNormal; - fragNormal = normalize(_normal); vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, @@ -72,7 +69,8 @@ void main(void) { fresnel, metallic, roughness), - opacity); - color.rgb += emissive * isEmissiveEnabled(); - _fragColor = color; + opacity); + color.rgb += emissive * isEmissiveEnabled(); + + _fragColor0 = color; } diff --git a/libraries/render-utils/src/forward_model_normal_map.slf b/libraries/render-utils/src/forward_model_normal_map.slf index c139bd8997..ba482cf909 100644 --- a/libraries/render-utils/src/forward_model_normal_map.slf +++ b/libraries/render-utils/src/forward_model_normal_map.slf @@ -2,18 +2,16 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// forward_model_normal_map.frag +// forward_model_normal_specular_map.frag // fragment shader // -// Created by Andrzej Kapolka on 10/29/13. -// Copyright 2013 High Fidelity, Inc. +// Created by Sam Gateau on 2/15/2016. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - !> - <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> @@ -23,7 +21,7 @@ <$declareStandardCameraTransform()$> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> in vec4 _position; in vec2 _texCoord0; @@ -32,40 +30,38 @@ in vec3 _normal; in vec3 _tangent; in vec3 _color; -out vec4 _fragColor; +layout(location = 0) out vec4 _fragColor0; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex, scatteringTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; + <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$discardTransparent(opacity)$>; vec3 albedo = getMaterialAlbedo(mat); <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; albedo *= _color; - float metallic = getMaterialMetallic(mat); - vec3 fresnel = getFresnelF0(metallic, albedo); - float roughness = getMaterialRoughness(mat); <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - float scattering = getMaterialScattering(mat); - <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; + vec3 fresnel = getFresnelF0(metallic, albedo); vec3 fragPosition = _position.xyz; vec3 fragNormal; <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> TransformCamera cam = getTransformCamera(); - + vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, @@ -76,10 +72,9 @@ void main(void) { fresnel, metallic, roughness), - opacity); + opacity); color.rgb += emissive * isEmissiveEnabled(); -// _fragColor = vec4(albedo, opacity); - _fragColor = color; + _fragColor0 = color; } diff --git a/libraries/render-utils/src/forward_model_normal_specular_map.slf b/libraries/render-utils/src/forward_model_normal_specular_map.slf deleted file mode 100644 index d8b0011bc3..0000000000 --- a/libraries/render-utils/src/forward_model_normal_specular_map.slf +++ /dev/null @@ -1,81 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// forward_model_normal_specular_map.frag -// fragment shader -// -// Created by Andrzej Kapolka on 5/6/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include ForwardGlobalLight.slh@> -<$declareEvalSkyboxGlobalColor()$> - -<@include graphics/Material.slh@> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - vec3 fresnel = getFresnelF0(metallic, albedo); - - vec3 fragPosition = _position.xyz; - vec3 fragNormal; - <$tangentToViewSpace(normalTex, _normal, _tangent, fragNormal)$> - - TransformCamera cam = getTransformCamera(); - - vec4 color = vec4(evalSkyboxGlobalColor( - cam._viewInverse, - 1.0, - occlusionTex, - fragPosition, - fragNormal, - albedo, - fresnel, - metallic, - roughness), - opacity); - - color.rgb += emissive * isEmissiveEnabled(); - - // _fragColor = vec4(albedo, opacity); - _fragColor = color; -} diff --git a/libraries/render-utils/src/forward_model_specular_map.slf b/libraries/render-utils/src/forward_model_specular_map.slf deleted file mode 100644 index 2ab8f2851b..0000000000 --- a/libraries/render-utils/src/forward_model_specular_map.slf +++ /dev/null @@ -1,81 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// forward_model_specular_map.frag -// fragment shader -// -// Created by Andrzej Kapolka on 5/6/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - - - !> - -<@include ForwardGlobalLight.slh@> -<$declareEvalSkyboxGlobalColor()$> - -<@include graphics/Material.slh@> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - vec3 fresnel = getFresnelF0(metallic, albedo); - - vec3 fragPosition = _position.xyz; - vec3 fragNormal = normalize(_normal); - - TransformCamera cam = getTransformCamera(); - - vec4 color = vec4(evalSkyboxGlobalColor( - cam._viewInverse, - 1.0, - 1.0, - fragPosition, - fragNormal, - albedo, - fresnel, - metallic, - roughness), - opacity); - color.rgb += emissive * isEmissiveEnabled(); - - // _fragColor = vec4(albedo, opacity); - _fragColor = color; -} diff --git a/libraries/render-utils/src/forward_model_translucent.slf b/libraries/render-utils/src/forward_model_translucent.slf index 9404740594..2892a6bbf5 100644 --- a/libraries/render-utils/src/forward_model_translucent.slf +++ b/libraries/render-utils/src/forward_model_translucent.slf @@ -22,7 +22,7 @@ <$declareStandardCameraTransform()$> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> in vec2 _texCoord0; in vec2 _texCoord1; @@ -31,12 +31,12 @@ in vec3 _normal; in vec3 _color; in float _alpha; -out vec4 _fragColor; +layout(location = 0) out vec4 _fragColor0; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = getMaterialOpacity(mat) * _alpha; @@ -50,6 +50,7 @@ void main(void) { <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; vec3 fresnel = getFresnelF0(metallic, albedo); vec3 emissive = getMaterialEmissive(mat); @@ -60,7 +61,7 @@ void main(void) { TransformCamera cam = getTransformCamera(); - _fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze( + _fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze( cam._viewInverse, 1.0, occlusionTex, diff --git a/libraries/render-utils/src/forward_model_unlit.slf b/libraries/render-utils/src/forward_model_unlit.slf index 42f311bb65..fda001dba9 100644 --- a/libraries/render-utils/src/forward_model_unlit.slf +++ b/libraries/render-utils/src/forward_model_unlit.slf @@ -12,7 +12,6 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include ForwardBufferWrite.slh@> <@include LightingModel.slh@> <@include graphics/Material.slh@> @@ -24,6 +23,8 @@ in vec3 _normal; in vec3 _color; in float _alpha; +layout(location = 0) out vec4 _fragColor0; + void main(void) { Material mat = getMaterial(); diff --git a/libraries/render-utils/src/model.slf b/libraries/render-utils/src/model.slf index b52e56abd3..94929f4943 100644 --- a/libraries/render-utils/src/model.slf +++ b/libraries/render-utils/src/model.slf @@ -1,11 +1,12 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> -// model.frag +// +// model_specular_map.frag // fragment shader // -// Created by Andrzej Kapolka on 10/14/13. -// Copyright 2013 High Fidelity, Inc. +// Created by Andrzej Kapolka on 5/6/14. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -16,19 +17,19 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$> in vec4 _position; -in vec3 _normal; -in vec3 _color; in vec2 _texCoord0; in vec2 _texCoord1; +in vec3 _normal; +in vec3 _color; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex, scatteringTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; @@ -52,7 +53,7 @@ void main(void) { <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( - normalize(_normal.xyz), + normalize(_normal), opacity, albedo, roughness, diff --git a/libraries/render-utils/src/model_fade.slf b/libraries/render-utils/src/model_fade.slf index c61ce91eeb..be8f003d63 100644 --- a/libraries/render-utils/src/model_fade.slf +++ b/libraries/render-utils/src/model_fade.slf @@ -1,10 +1,11 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> -// model_fade.frag +// +// model_specular_map_fade.frag // fragment shader // -// Created by Olivier Prat on 04/19/17. +// Created by Olivier Prat on 06/05/17. // Copyright 2017 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -16,18 +17,17 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> <@include Fade.slh@> <$declareFadeFragment()$> in vec4 _position; -in vec4 _worldPosition; -in vec3 _normal; -in vec3 _color; in vec2 _texCoord0; in vec2 _texCoord1; - +in vec3 _normal; +in vec3 _color; +in vec4 _worldPosition; void main(void) { vec3 fadeEmissive; @@ -38,7 +38,7 @@ void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; @@ -54,17 +54,19 @@ void main(void) { vec3 emissive = getMaterialEmissive(mat); <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - emissive += fadeEmissive; + + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; float scattering = getMaterialScattering(mat); packDeferredFragment( - normalize(_normal.xyz), + normalize(_normal), opacity, albedo, roughness, - getMaterialMetallic(mat), - emissive, + metallic, + emissive+fadeEmissive, occlusionTex, scattering); } diff --git a/libraries/render-utils/src/model_lightmap.slf b/libraries/render-utils/src/model_lightmap.slf index 91aab2dc6d..33195fce00 100644 --- a/libraries/render-utils/src/model_lightmap.slf +++ b/libraries/render-utils/src/model_lightmap.slf @@ -2,11 +2,11 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// model_lightmap.frag +// model_lightmap_specular_map.frag // fragment shader // // Created by Samuel Gateau on 11/19/14. -// Copyright 2013 High Fidelity, Inc. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -17,7 +17,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> <$declareMaterialLightmap()$> in vec4 _position; @@ -29,16 +29,15 @@ in vec3 _color; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - packDeferredFragmentLightmap( normalize(_normal), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat), - getMaterialFresnel(mat), + getMaterialMetallic(mat) * metallicTex, + /*metallicTex, // no use of */getMaterialFresnel(mat), lightmapVal); } diff --git a/libraries/render-utils/src/model_lightmap_fade.slf b/libraries/render-utils/src/model_lightmap_fade.slf index 4756c41846..36e1d8acea 100644 --- a/libraries/render-utils/src/model_lightmap_fade.slf +++ b/libraries/render-utils/src/model_lightmap_fade.slf @@ -2,7 +2,7 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// model_lightmap_fade.frag +// model_lightmap_specular_map_fade.frag // fragment shader // // Created by Olivier Prat on 06/05/17. @@ -17,7 +17,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> <$declareMaterialLightmap()$> <@include Fade.slh@> @@ -39,16 +39,15 @@ void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - packDeferredFragmentLightmap( normalize(_normal), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat), - getMaterialFresnel(mat), + getMaterialMetallic(mat) * metallicTex, + /*metallicTex, // no use of */getMaterialFresnel(mat), lightmapVal+fadeEmissive); } diff --git a/libraries/render-utils/src/model_lightmap_normal_map.slf b/libraries/render-utils/src/model_lightmap_normal_map.slf index ecc1d16398..1a52ffe368 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map.slf @@ -2,11 +2,11 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// model_lightmap_normal_map.frag +// model_lightmap_normal_specular_map.frag // fragment shader // // Created by Samuel Gateau on 11/19/14. -// Copyright 2013 High Fidelity, Inc. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -17,7 +17,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> <$declareMaterialLightmap()$> in vec4 _position; @@ -30,9 +30,9 @@ in vec3 _color; void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - + vec3 viewNormal; <$tangentToViewSpaceLOD(_position, normalTexel, _normal, _tangent, viewNormal)$> @@ -40,8 +40,8 @@ void main(void) { normalize(viewNormal.xyz), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat), - getMaterialMetallic(mat), - getMaterialFresnel(mat), + getMaterialRoughness(mat) * roughness, + getMaterialMetallic(mat) * metallicTex, + /*specular, // no use of */ getMaterialFresnel(mat), lightmapVal); } 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 60a9eb9ed6..ea187cfbf7 100644 --- a/libraries/render-utils/src/model_lightmap_normal_map_fade.slf +++ b/libraries/render-utils/src/model_lightmap_normal_map_fade.slf @@ -2,7 +2,7 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// model_lightmap_normal_map_fade.frag +// model_lightmap_normal_specular_map_fade.frag // fragment shader // // Created by Olivier Prat on 06/05/17. @@ -17,7 +17,7 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> <$declareMaterialLightmap()$> <@include Fade.slh@> @@ -40,9 +40,9 @@ void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - + vec3 viewNormal; <$tangentToViewSpaceLOD(_position, normalTexel, _normal, _tangent, viewNormal)$> @@ -50,8 +50,8 @@ void main(void) { normalize(viewNormal.xyz), evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat), - getMaterialMetallic(mat), - getMaterialFresnel(mat), + getMaterialRoughness(mat) * roughness, + getMaterialMetallic(mat) * metallicTex, + /*specular, // no use of */ getMaterialFresnel(mat), lightmapVal+fadeEmissive); } diff --git a/libraries/render-utils/src/model_lightmap_normal_specular_map.slf b/libraries/render-utils/src/model_lightmap_normal_specular_map.slf deleted file mode 100644 index 1a52ffe368..0000000000 --- a/libraries/render-utils/src/model_lightmap_normal_specular_map.slf +++ /dev/null @@ -1,47 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_normal_specular_map.frag -// fragment shader -// -// Created by Samuel Gateau on 11/19/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> -<$declareMaterialLightmap()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; -in vec3 _color; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - - vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTexel, _normal, _tangent, viewNormal)$> - - packDeferredFragmentLightmap( - normalize(viewNormal.xyz), - evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), - getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat) * metallicTex, - /*specular, // no use of */ getMaterialFresnel(mat), - lightmapVal); -} diff --git a/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf b/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf deleted file mode 100644 index ea187cfbf7..0000000000 --- a/libraries/render-utils/src/model_lightmap_normal_specular_map_fade.slf +++ /dev/null @@ -1,57 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_normal_specular_map_fade.frag -// fragment shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$> -<$declareMaterialLightmap()$> - -<@include Fade.slh@> -<$declareFadeFragment()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; -in vec3 _color; -in vec4 _worldPosition; - -void main(void) { - vec3 fadeEmissive; - FadeObjectParams fadeParams; - - <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - - vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTexel, _normal, _tangent, viewNormal)$> - - packDeferredFragmentLightmap( - normalize(viewNormal.xyz), - evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), - getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat) * metallicTex, - /*specular, // no use of */ getMaterialFresnel(mat), - lightmapVal+fadeEmissive); -} diff --git a/libraries/render-utils/src/model_lightmap_specular_map.slf b/libraries/render-utils/src/model_lightmap_specular_map.slf deleted file mode 100644 index 33195fce00..0000000000 --- a/libraries/render-utils/src/model_lightmap_specular_map.slf +++ /dev/null @@ -1,43 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_specular_map.frag -// fragment shader -// -// Created by Samuel Gateau on 11/19/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> -<$declareMaterialLightmap()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _color; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - - packDeferredFragmentLightmap( - normalize(_normal), - evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), - getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat) * metallicTex, - /*metallicTex, // no use of */getMaterialFresnel(mat), - lightmapVal); -} diff --git a/libraries/render-utils/src/model_lightmap_specular_map_fade.slf b/libraries/render-utils/src/model_lightmap_specular_map_fade.slf deleted file mode 100644 index 36e1d8acea..0000000000 --- a/libraries/render-utils/src/model_lightmap_specular_map_fade.slf +++ /dev/null @@ -1,53 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_lightmap_specular_map_fade.frag -// fragment shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$> -<$declareMaterialLightmap()$> - -<@include Fade.slh@> -<$declareFadeFragment()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _color; -in vec4 _worldPosition; - -void main(void) { - vec3 fadeEmissive; - FadeObjectParams fadeParams; - - <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$> - - packDeferredFragmentLightmap( - normalize(_normal), - evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a), - getMaterialAlbedo(mat) * albedo.rgb * _color, - getMaterialRoughness(mat) * roughness, - getMaterialMetallic(mat) * metallicTex, - /*metallicTex, // no use of */getMaterialFresnel(mat), - lightmapVal+fadeEmissive); -} diff --git a/libraries/render-utils/src/model_normal_map.slf b/libraries/render-utils/src/model_normal_map.slf index 7f2c010a36..82f667bf73 100644 --- a/libraries/render-utils/src/model_normal_map.slf +++ b/libraries/render-utils/src/model_normal_map.slf @@ -5,8 +5,8 @@ // model_normal_map.frag // fragment shader // -// Created by Andrzej Kapolka on 10/29/13. -// Copyright 2013 High Fidelity, Inc. +// Created by Andrzej Kapolka on 5/6/14. +// Copyright 2014 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -33,7 +33,7 @@ void main(void) { <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; + <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$discardTransparent(opacity)$>; vec3 albedo = getMaterialAlbedo(mat); @@ -47,7 +47,7 @@ void main(void) { <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> + <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> float metallic = getMaterialMetallic(mat); <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; @@ -56,7 +56,7 @@ void main(void) { <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( - viewNormal, + normalize(viewNormal.xyz), opacity, albedo, roughness, diff --git a/libraries/render-utils/src/model_normal_map_fade.slf b/libraries/render-utils/src/model_normal_map_fade.slf index 6cb32f9f3a..67bea98cf0 100644 --- a/libraries/render-utils/src/model_normal_map_fade.slf +++ b/libraries/render-utils/src/model_normal_map_fade.slf @@ -2,10 +2,10 @@ <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // -// model_normal_map_fade.frag +// model_normal_specular_map_fade.frag // fragment shader // -// Created by Olivier Prat on 04/19/17. +// Created by Olivier Prat on 06/05/17. // Copyright 2017 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -17,18 +17,18 @@ <@include graphics/Material.slh@> <@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION, SCATTERING)$> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> <@include Fade.slh@> <$declareFadeFragment()$> in vec4 _position; -in vec4 _worldPosition; in vec2 _texCoord0; in vec2 _texCoord1; in vec3 _normal; in vec3 _tangent; in vec3 _color; +in vec4 _worldPosition; void main(void) { vec3 fadeEmissive; @@ -39,11 +39,11 @@ void main(void) { Material mat = getMaterial(); BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex, scatteringTex)$> + <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$> <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; + <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; <$discardTransparent(opacity)$>; vec3 albedo = getMaterialAlbedo(mat); @@ -57,17 +57,19 @@ void main(void) { <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> + <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> + + float metallic = getMaterialMetallic(mat); + <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; float scattering = getMaterialScattering(mat); - <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; packDeferredFragment( - viewNormal, + normalize(viewNormal.xyz), opacity, albedo, roughness, - getMaterialMetallic(mat), + metallic, emissive+fadeEmissive, occlusionTex, scattering); diff --git a/libraries/render-utils/src/model_normal_specular_map.slf b/libraries/render-utils/src/model_normal_specular_map.slf deleted file mode 100644 index 18c0797a4c..0000000000 --- a/libraries/render-utils/src/model_normal_specular_map.slf +++ /dev/null @@ -1,67 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_normal_specular_map.frag -// fragment shader -// -// Created by Andrzej Kapolka on 5/6/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; -in vec3 _color; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - - float scattering = getMaterialScattering(mat); - <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; - - packDeferredFragment( - normalize(viewNormal.xyz), - opacity, - albedo, - roughness, - metallic, - emissive, - occlusionTex, - scattering); -} diff --git a/libraries/render-utils/src/model_normal_specular_map_fade.slf b/libraries/render-utils/src/model_normal_specular_map_fade.slf deleted file mode 100644 index 67bea98cf0..0000000000 --- a/libraries/render-utils/src/model_normal_specular_map_fade.slf +++ /dev/null @@ -1,76 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_normal_specular_map_fade.frag -// fragment shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$> - -<@include Fade.slh@> -<$declareFadeFragment()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _tangent; -in vec3 _color; -in vec4 _worldPosition; - -void main(void) { - vec3 fadeEmissive; - FadeObjectParams fadeParams; - - <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - vec3 viewNormal; - <$tangentToViewSpaceLOD(_position, normalTex, _normal, _tangent, viewNormal)$> - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - - float scattering = getMaterialScattering(mat); - - packDeferredFragment( - normalize(viewNormal.xyz), - opacity, - albedo, - roughness, - metallic, - emissive+fadeEmissive, - occlusionTex, - scattering); -} diff --git a/libraries/render-utils/src/model_specular_map.slf b/libraries/render-utils/src/model_specular_map.slf deleted file mode 100644 index 830c788674..0000000000 --- a/libraries/render-utils/src/model_specular_map.slf +++ /dev/null @@ -1,64 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_specular_map.frag -// fragment shader -// -// Created by Andrzej Kapolka on 5/6/14. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _color; - - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - - float scattering = getMaterialScattering(mat); - <$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>; - - packDeferredFragment( - normalize(_normal), - opacity, - albedo, - roughness, - metallic, - emissive, - occlusionTex, - scattering); -} diff --git a/libraries/render-utils/src/model_specular_map_fade.slf b/libraries/render-utils/src/model_specular_map_fade.slf deleted file mode 100644 index be8f003d63..0000000000 --- a/libraries/render-utils/src/model_specular_map_fade.slf +++ /dev/null @@ -1,72 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// model_specular_map_fade.frag -// fragment shader -// -// Created by Olivier Prat on 06/05/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -<@include DeferredBufferWrite.slh@> - -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$> - -<@include Fade.slh@> -<$declareFadeFragment()$> - -in vec4 _position; -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec3 _normal; -in vec3 _color; -in vec4 _worldPosition; - -void main(void) { - vec3 fadeEmissive; - FadeObjectParams fadeParams; - - <$fetchFadeObjectParams(fadeParams)$> - applyFade(fadeParams, _worldPosition.xyz, fadeEmissive); - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - float roughness = getMaterialRoughness(mat); - <$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>; - - vec3 emissive = getMaterialEmissive(mat); - <$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>; - - float metallic = getMaterialMetallic(mat); - <$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>; - - float scattering = getMaterialScattering(mat); - - packDeferredFragment( - normalize(_normal), - opacity, - albedo, - roughness, - metallic, - emissive+fadeEmissive, - occlusionTex, - scattering); -} diff --git a/tests/shaders/src/main.cpp b/tests/shaders/src/main.cpp index d97d70585b..0ee0051483 100644 --- a/tests/shaders/src/main.cpp +++ b/tests/shaders/src/main.cpp @@ -50,12 +50,8 @@ #include #include #include -#include -#include #include #include -#include -#include #include #include @@ -179,19 +175,13 @@ void QTestWindow::draw() { testShaderBuild(model_vert::getSource(), model_frag::getSource()); testShaderBuild(model_normal_map_vert::getSource(), model_normal_map_frag::getSource()); - testShaderBuild(model_vert::getSource(), model_specular_map_frag::getSource()); - testShaderBuild(model_normal_map_vert::getSource(), model_normal_specular_map_frag::getSource()); testShaderBuild(model_vert::getSource(), model_translucent_frag::getSource()); testShaderBuild(model_normal_map_vert::getSource(), model_translucent_frag::getSource()); testShaderBuild(model_lightmap_vert::getSource(), model_lightmap_frag::getSource()); testShaderBuild(model_lightmap_normal_map_vert::getSource(), model_lightmap_normal_map_frag::getSource()); - testShaderBuild(model_lightmap_vert::getSource(), model_lightmap_specular_map_frag::getSource()); - testShaderBuild(model_lightmap_normal_map_vert::getSource(), model_lightmap_normal_specular_map_frag::getSource()); testShaderBuild(skin_model_vert::getSource(), model_frag::getSource()); testShaderBuild(skin_model_normal_map_vert::getSource(), model_normal_map_frag::getSource()); - testShaderBuild(skin_model_vert::getSource(), model_specular_map_frag::getSource()); - testShaderBuild(skin_model_normal_map_vert::getSource(), model_normal_specular_map_frag::getSource()); testShaderBuild(skin_model_vert::getSource(), model_translucent_frag::getSource()); testShaderBuild(skin_model_normal_map_vert::getSource(), model_translucent_frag::getSource()); From 0e25b7bd35cfa8568c60886fca8d5430e8d3f0ad Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 8 Feb 2018 23:27:12 -0800 Subject: [PATCH 4/5] Fixing the normal map computation --- libraries/render-utils/src/MaterialTextures.slh | 3 +-- libraries/render-utils/src/forward_model.slf | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/render-utils/src/MaterialTextures.slh b/libraries/render-utils/src/MaterialTextures.slh index 044ef6c92d..b3662385b0 100644 --- a/libraries/render-utils/src/MaterialTextures.slh +++ b/libraries/render-utils/src/MaterialTextures.slh @@ -154,8 +154,7 @@ vec3 fetchLightmapMap(vec2 uv) { vec3 normalizedTangent = normalize(<$interpolatedTangent$>.xyz); vec3 normalizedBitangent = normalize(cross(normalizedNormal, normalizedTangent)); vec3 localNormal = <$fetchedNormal$>; - <$normal$> = vec3(normalizedTangent * localNormal.x + normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z); -// <$normal$> = fetchedNormal; + <$normal$> = vec3(normalizedTangent * localNormal.x + normalizedNormal * localNormal.y + normalizedBitangent * localNormal.z); } <@endfunc@> diff --git a/libraries/render-utils/src/forward_model.slf b/libraries/render-utils/src/forward_model.slf index 382a6ea8e9..de721e9c2e 100644 --- a/libraries/render-utils/src/forward_model.slf +++ b/libraries/render-utils/src/forward_model.slf @@ -62,7 +62,7 @@ void main(void) { vec4 color = vec4(evalSkyboxGlobalColor( cam._viewInverse, 1.0, - 1.0, + occlusionTex, fragPosition, fragNormal, albedo, From 4419dfe622fa8e8513e954c7c94a4eaac61dceb9 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 9 Feb 2018 10:02:16 -0800 Subject: [PATCH 5/5] Addressing review comments --- .../src/display-plugins/OpenGLDisplayPlugin.cpp | 1 - libraries/render-utils/src/ForwardGlobalLight.slh | 2 ++ libraries/render-utils/src/MeshPartPayload.cpp | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index ce3721b76b..40dcf1b8c7 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -64,7 +64,6 @@ vec3 colorToLinearRGB(vec3 srgb) { void main(void) { outFragColor.a = 1.0; outFragColor.rgb = colorToLinearRGB(texture(colorMap, varTexCoord0).rgb); - // outFragColor.rgb = texture(colorMap, varTexCoord0).rgb; } )SCRIBE"; diff --git a/libraries/render-utils/src/ForwardGlobalLight.slh b/libraries/render-utils/src/ForwardGlobalLight.slh index c0aebfd087..a945acb8c4 100644 --- a/libraries/render-utils/src/ForwardGlobalLight.slh +++ b/libraries/render-utils/src/ForwardGlobalLight.slh @@ -134,6 +134,7 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu color += directionalDiffuse; color += directionalSpecular; + // FIXME - temporarily removed until we support it for forward... // Attenuate the light if haze effect selected // if ((hazeParams.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) { // color = computeHazeColorKeyLightAttenuation(color, lightDirection, position); @@ -227,6 +228,7 @@ vec3 evalGlobalLightingAlphaBlendedWithHaze( color += directionalSpecular / opacity; // Haze + // FIXME - temporarily removed until we support it for forward... /* if ((hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE) { vec4 colorV4 = computeHazeColor( vec4(color, 1.0), // fragment original color diff --git a/libraries/render-utils/src/MeshPartPayload.cpp b/libraries/render-utils/src/MeshPartPayload.cpp index 372803f329..39773c66db 100644 --- a/libraries/render-utils/src/MeshPartPayload.cpp +++ b/libraries/render-utils/src/MeshPartPayload.cpp @@ -104,9 +104,6 @@ ShapeKey MeshPartPayload::getShapeKey() const { if (drawMaterialKey.isNormalMap()) { builder.withTangents(); } - /* if (drawMaterialKey.isMetallicMap()) { - builder.withSpecular(); - }*/ if (drawMaterialKey.isLightmapMap()) { builder.withLightmap(); }