diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 85041aad4e..7a9ff648fb 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -41,8 +41,6 @@ Q_LOGGING_CATEGORY(trace_render_overlays, "trace.render.overlays") -extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false); - Overlays::Overlays() { auto pointerManager = DependencyManager::get(); connect(pointerManager.data(), &PointerManager::hoverBeginOverlay, this, &Overlays::hoverEnterPointerEvent); diff --git a/libraries/render-utils/src/RenderCommonTask.cpp b/libraries/render-utils/src/RenderCommonTask.cpp index 293393550b..24715f0afb 100644 --- a/libraries/render-utils/src/RenderCommonTask.cpp +++ b/libraries/render-utils/src/RenderCommonTask.cpp @@ -14,7 +14,7 @@ #include "RenderUtilsLogging.h" using namespace render; -extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false); +extern void initForwardPipelines(ShapePlumber& plumber); void BeginGPURangeTimer::run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) { timer = _gpuTimer; @@ -35,7 +35,7 @@ void EndGPURangeTimer::run(const render::RenderContextPointer& renderContext, co DrawOverlay3D::DrawOverlay3D(bool opaque) : _shapePlumber(std::make_shared()), _opaquePass(opaque) { - initOverlay3DPipelines(*_shapePlumber); + initForwardPipelines(*_shapePlumber); } void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs& inputs) { diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 47cab54d09..dc12c0f781 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -53,7 +53,6 @@ #include using namespace render; -extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false); extern void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); RenderDeferredTask::RenderDeferredTask() diff --git a/libraries/render-utils/src/RenderForwardTask.cpp b/libraries/render-utils/src/RenderForwardTask.cpp index 09a2afb711..d2933627f4 100755 --- a/libraries/render-utils/src/RenderForwardTask.cpp +++ b/libraries/render-utils/src/RenderForwardTask.cpp @@ -37,10 +37,7 @@ #include "nop_frag.h" using namespace render; -extern void initForwardPipelines(ShapePlumber& plumber, - const render::ShapePipeline::BatchSetter& batchSetter, - const render::ShapePipeline::ItemSetter& itemSetter); -extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false); +extern void initForwardPipelines(ShapePlumber& plumber); void RenderForwardTask::build(JobModel& task, const render::Varying& input, render::Varying& output) { auto items = input.get(); @@ -48,8 +45,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend // Prepare the ShapePipelines ShapePlumberPointer shapePlumber = std::make_shared(); - initForwardPipelines(*shapePlumber, fadeEffect->getBatchSetter(), fadeEffect->getItemUniformSetter()); - initOverlay3DPipelines(*shapePlumber); + initForwardPipelines(*shapePlumber); // Extract opaques / transparents / lights / metas / overlays / background const auto& opaques = items.get0()[RenderFetchCullSortTask::OPAQUE_SHAPE]; diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index b02266e67b..39da386dc4 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -80,16 +80,6 @@ #include "model_translucent_unlit_fade_frag.h" #include "model_translucent_normal_map_fade_frag.h" -#include "overlay3D_vert.h" -#include "overlay3D_frag.h" -#include "overlay3D_model_frag.h" -#include "overlay3D_model_translucent_frag.h" -#include "overlay3D_translucent_frag.h" -#include "overlay3D_unlit_frag.h" -#include "overlay3D_translucent_unlit_frag.h" -#include "overlay3D_model_unlit_frag.h" -#include "overlay3D_model_translucent_unlit_frag.h" - #include "model_shadow_vert.h" #include "skin_model_shadow_vert.h" #include "skin_model_shadow_dq_vert.h" @@ -104,12 +94,16 @@ #include "model_shadow_fade_frag.h" #include "skin_model_shadow_fade_frag.h" +#include "simple_vert.h" +#include "forward_simple_textured_frag.h" +#include "forward_simple_textured_transparent_frag.h" +#include "forward_simple_textured_unlit_frag.h" + using namespace render; using namespace std::placeholders; -void initOverlay3DPipelines(ShapePlumber& plumber, bool depthTest = false); void initDeferredPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); -void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); +void initForwardPipelines(ShapePlumber& plumber); void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state); void addPlumberPipeline(ShapePlumber& plumber, @@ -120,71 +114,6 @@ void batchSetter(const ShapePipeline& pipeline, gpu::Batch& batch, RenderArgs* a void lightBatchSetter(const ShapePipeline& pipeline, gpu::Batch& batch, RenderArgs* args); static bool forceLightBatchSetter{ false }; -void initOverlay3DPipelines(ShapePlumber& plumber, bool depthTest) { - auto vertex = overlay3D_vert::getShader(); - auto vertexModel = model_vert::getShader(); - auto pixel = overlay3D_frag::getShader(); - auto pixelTranslucent = overlay3D_translucent_frag::getShader(); - auto pixelUnlit = overlay3D_unlit_frag::getShader(); - auto pixelTranslucentUnlit = overlay3D_translucent_unlit_frag::getShader(); - auto pixelModel = overlay3D_model_frag::getShader(); - auto pixelModelTranslucent = overlay3D_model_translucent_frag::getShader(); - auto pixelModelUnlit = overlay3D_model_unlit_frag::getShader(); - auto pixelModelTranslucentUnlit = overlay3D_model_translucent_unlit_frag::getShader(); - - auto opaqueProgram = gpu::Shader::createProgram(vertex, pixel); - auto translucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucent); - auto unlitOpaqueProgram = gpu::Shader::createProgram(vertex, pixelUnlit); - auto unlitTranslucentProgram = gpu::Shader::createProgram(vertex, pixelTranslucentUnlit); - auto materialOpaqueProgram = gpu::Shader::createProgram(vertexModel, pixelModel); - auto materialTranslucentProgram = gpu::Shader::createProgram(vertexModel, pixelModelTranslucent); - auto materialUnlitOpaqueProgram = gpu::Shader::createProgram(vertexModel, pixelModel); - auto materialUnlitTranslucentProgram = gpu::Shader::createProgram(vertexModel, pixelModelTranslucent); - - for (int i = 0; i < 8; i++) { - bool isCulled = (i & 1); - bool isBiased = (i & 2); - bool isOpaque = (i & 4); - - auto state = std::make_shared(); - if (depthTest) { - state->setDepthTest(true, true, gpu::LESS_EQUAL); - } else { - state->setDepthTest(false); - } - state->setCullMode(isCulled ? gpu::State::CULL_BACK : gpu::State::CULL_NONE); - if (isBiased) { - state->setDepthBias(1.0f); - state->setDepthBiasSlopeScale(1.0f); - } - if (isOpaque) { - // Soft edges - state->setBlendFunction(true, - gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); - } else { - state->setBlendFunction(true, - gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, - gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); - } - - ShapeKey::Filter::Builder builder; - - isCulled ? builder.withCullFace() : builder.withoutCullFace(); - isBiased ? builder.withDepthBias() : builder.withoutDepthBias(); - isOpaque ? builder.withOpaque() : builder.withTranslucent(); - - auto simpleProgram = isOpaque ? opaqueProgram : translucentProgram; - auto unlitProgram = isOpaque ? unlitOpaqueProgram : unlitTranslucentProgram; - auto materialProgram = isOpaque ? materialOpaqueProgram : materialTranslucentProgram; - auto materialUnlitProgram = isOpaque ? materialUnlitOpaqueProgram : materialUnlitTranslucentProgram; - - plumber.addPipeline(builder.withMaterial().build().key(), materialProgram, state, &lightBatchSetter); - plumber.addPipeline(builder.withMaterial().withUnlit().build().key(), materialUnlitProgram, state, &batchSetter); - plumber.addPipeline(builder.withoutUnlit().withoutMaterial().build().key(), simpleProgram, state, &lightBatchSetter); - plumber.addPipeline(builder.withUnlit().withoutMaterial().build().key(), unlitProgram, state, &batchSetter); - } -} - void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter) { // Vertex shaders auto simpleVertex = simple_vert::getShader(); @@ -432,8 +361,9 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip skinModelShadowFadeDualQuatVertex, modelShadowFadePixel, batchSetter, itemSetter); } -void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter) { +void initForwardPipelines(ShapePlumber& plumber) { // Vertex shaders + auto simpleVertex = simple_vert::getShader(); auto modelVertex = model_vert::getShader(); auto modelNormalMapVertex = model_normal_map_vert::getShader(); auto skinModelVertex = skin_model_vert::getShader(); @@ -443,6 +373,10 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba auto skinModelNormalMapDualQuatVertex = skin_model_normal_map_dq_vert::getShader(); // Pixel shaders + auto simplePixel = forward_simple_textured_frag::getShader(); + auto simpleTranslucentPixel = forward_simple_textured_transparent_frag::getShader(); + auto simpleUnlitPixel = forward_simple_textured_unlit_frag::getShader(); + auto simpleTranslucentUnlitPixel = simple_transparent_textured_unlit_frag::getShader(); auto modelPixel = forward_model_frag::getShader(); auto modelUnlitPixel = forward_model_unlit_frag::getShader(); auto modelNormalMapPixel = forward_model_normal_map_frag::getShader(); @@ -458,8 +392,15 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba }; // Forward pipelines need the lightBatchSetter for opaques and transparents - // forceLightBatchSetter = true; - forceLightBatchSetter = false; + forceLightBatchSetter = true; + + // Simple Opaques + addPipeline(Key::Builder(), simpleVertex, simplePixel); + addPipeline(Key::Builder().withUnlit(), simpleVertex, simpleUnlitPixel); + + // Simple Translucents + addPipeline(Key::Builder().withTranslucent(), simpleVertex, simpleTranslucentPixel); + addPipeline(Key::Builder().withTranslucent().withUnlit(), simpleVertex, simpleTranslucentUnlitPixel); // Opaques addPipeline(Key::Builder().withMaterial(), modelVertex, modelPixel); diff --git a/libraries/render-utils/src/overlay3D.slf b/libraries/render-utils/src/overlay3D.slf deleted file mode 100644 index 83cee88790..0000000000 --- a/libraries/render-utils/src/overlay3D.slf +++ /dev/null @@ -1,92 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D.slf -// fragment shader -// -// Created by Sam Gateau on 6/16/15. -// Copyright 2015 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 graphics/Light.slh@> -<$declareLightBuffer()$> -<$declareLightAmbientBuffer()$> - -<@include LightingModel.slh@> - -<@include LightDirectional.slh@> -<$declareLightingDirectional()$> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 albedo, float metallic, vec3 fresnel, float roughness, float opacity) { - - // Need the light now - Light light = getKeyLight(); - vec3 lightDirection = getLightDirection(light); - vec3 lightIrradiance = getLightIrradiance(light); - - LightAmbient ambient = getLightAmbient(); - - TransformCamera cam = getTransformCamera(); - vec3 fragEyeVectorView = normalize(-position); - vec3 fragEyeDir; - <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> - - SurfaceData surface = initSurfaceData(roughness, normal, fragEyeDir); - - vec3 color = opacity * albedo * getLightColor(light) * getLightAmbientIntensity(ambient); - - // Directional - vec3 directionalDiffuse; - vec3 directionalSpecular; - evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surface, metallic, fresnel, albedo, shadowAttenuation); - color += directionalDiffuse * isDiffuseEnabled() * isDirectionalEnabled(); - color += directionalSpecular * isSpecularEnabled() * isDirectionalEnabled(); - - return vec4(color, opacity); -} - -uniform sampler2D originalTexture; - -in vec2 _texCoord0; -in vec4 _positionES; -in vec3 _normalWS; -in vec3 _color; -in float _alpha; - -out vec4 _fragColor; - -void main(void) { - vec4 albedo = texture(originalTexture, _texCoord0); - - vec3 fragPosition = _positionES.xyz; - vec3 fragNormal = normalize(_normalWS); - vec3 fragAlbedo = albedo.rgb * _color; - float fragMetallic = 0.0; - vec3 fragSpecular = vec3(0.1); - float fragRoughness = 0.9; - float fragOpacity = albedo.a; - - if (fragOpacity <= 0.1) { - discard; - } - - vec4 color = evalGlobalColor(1.0, - fragPosition, - fragNormal, - fragAlbedo, - fragMetallic, - fragSpecular, - fragRoughness, - fragOpacity); - - - // Apply standard tone mapping - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} diff --git a/libraries/render-utils/src/overlay3D.slv b/libraries/render-utils/src/overlay3D.slv deleted file mode 100644 index 9e13fb3776..0000000000 --- a/libraries/render-utils/src/overlay3D.slv +++ /dev/null @@ -1,36 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D.slv -// vertex shader -// -// Created by Sam Gateau on 6/16/15. -// Copyright 2015 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 gpu/Inputs.slh@> -<@include gpu/Color.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -out vec3 _color; -out float _alpha; -out vec2 _texCoord0; -out vec4 _positionES; -out vec3 _normalWS; - -void main(void) { - _color = color_sRGBToLinear(inColor.xyz); - _alpha = inColor.w; - - _texCoord0 = inTexCoord0.st; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToEyeAndClipPos(cam, obj, inPosition, _positionES, gl_Position)$> - <$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$> -} diff --git a/libraries/render-utils/src/overlay3D_model.slf b/libraries/render-utils/src/overlay3D_model.slf deleted file mode 100644 index fd6470efb2..0000000000 --- a/libraries/render-utils/src/overlay3D_model.slf +++ /dev/null @@ -1,79 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D.slf -// fragment shader -// -// Created by Sam Gateau on 6/16/15. -// Copyright 2015 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 DeferredGlobalLight.slh@> -<$declareEvalSkyboxGlobalColor()$> - -<@include graphics/Material.slh@> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> - -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec4 _positionES; -in vec3 _normalWS; -in vec3 _color; -in float _alpha; - -out vec4 _fragColor; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, 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 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)$>; - - - vec3 fragPosition = _positionES.xyz; - - TransformCamera cam = getTransformCamera(); - - vec4 color = vec4(evalSkyboxGlobalColor( - cam._viewInverse, - 1.0, - occlusionTex, - fragPosition, - normalize(_normalWS), - albedo, - fresnel, - metallic, - roughness), - opacity); - - // And emissive - color.rgb += emissive * isEmissiveEnabled(); - - // Apply standard tone mapping - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} \ No newline at end of file diff --git a/libraries/render-utils/src/overlay3D_model_translucent.slf b/libraries/render-utils/src/overlay3D_model_translucent.slf deleted file mode 100644 index 0c5b922d34..0000000000 --- a/libraries/render-utils/src/overlay3D_model_translucent.slf +++ /dev/null @@ -1,72 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D_model_transparent.slf -// -// Created by Sam Gateau on 2/27/2017. -// 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 DeferredGlobalLight.slh@> -<$declareEvalGlobalLightingAlphaBlendedWithHaze()$> - -<@include graphics/Material.slh@> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> - -in vec2 _texCoord0; -in vec2 _texCoord1; -in vec4 _positionES; -in vec3 _normalWS; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$> - <$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, 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)$>; - - vec3 fragPosition = _positionES.xyz; - TransformCamera cam = getTransformCamera(); - - vec4 color = vec4(evalGlobalLightingAlphaBlendedWithHaze( - cam._viewInverse, - 1.0, - occlusionTex, - fragPosition, - normalize(_normalWS), - albedo, - fresnel, - metallic, - emissive, - roughness, opacity), - opacity); - - // Apply standard tone mapping - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} \ No newline at end of file diff --git a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf b/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf deleted file mode 100644 index b1822a645a..0000000000 --- a/libraries/render-utils/src/overlay3D_model_translucent_unlit.slf +++ /dev/null @@ -1,41 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D-model_transparent_unlit.slf -// fragment shader -// -// Created by Sam Gateau on 2/28/2017. -// Copyright 2015 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 LightingModel.slh@> -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO)$> - -in vec2 _texCoord0; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - vec4 color = vec4(albedo * isUnlitEnabled(), opacity); - - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} \ No newline at end of file diff --git a/libraries/render-utils/src/overlay3D_model_unlit.slf b/libraries/render-utils/src/overlay3D_model_unlit.slf deleted file mode 100644 index cc16d0751d..0000000000 --- a/libraries/render-utils/src/overlay3D_model_unlit.slf +++ /dev/null @@ -1,42 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// overlay3D-model_unlit.slf -// fragment shader -// -// Created by Sam Gateau on 2/28/2017. -// Copyright 2015 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 LightingModel.slh@> -<@include graphics/Material.slh@> - -<@include MaterialTextures.slh@> -<$declareMaterialTextures(ALBEDO)$> - -in vec2 _texCoord0; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - - Material mat = getMaterial(); - BITFIELD matKey = getMaterialKey(mat); - <$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex)$> - - float opacity = 1.0; - <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>; - <$discardTransparent(opacity)$>; - - vec3 albedo = getMaterialAlbedo(mat); - <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; - albedo *= _color; - - vec4 color = vec4(albedo * isUnlitEnabled(), opacity); - - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} diff --git a/libraries/render-utils/src/overlay3D_translucent.slf b/libraries/render-utils/src/overlay3D_translucent.slf deleted file mode 100644 index b93550a63d..0000000000 --- a/libraries/render-utils/src/overlay3D_translucent.slf +++ /dev/null @@ -1,87 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// overlay3D_translucent.slf -// fragment shader -// -// Created by Sam Gateau on 6/16/15. -// Copyright 2015 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 graphics/Light.slh@> -<$declareLightBuffer()$> -<$declareLightAmbientBuffer()$> - -<@include LightingModel.slh@> - -<@include LightDirectional.slh@> -<$declareLightingDirectional()$> - -<@include gpu/Transform.slh@> -<$declareStandardCameraTransform()$> - -vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 albedo, float metallic, vec3 fresnel, float roughness, float opacity) { - - // Need the light now - Light light = getKeyLight(); - vec3 lightDirection = getLightDirection(light); - vec3 lightIrradiance = getLightIrradiance(light); - - LightAmbient ambient = getLightAmbient(); - - TransformCamera cam = getTransformCamera(); - vec3 fragEyeVectorView = normalize(-position); - vec3 fragEyeDir; - <$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$> - - SurfaceData surface = initSurfaceData(roughness, normal, fragEyeDir); - - vec3 color = opacity * albedo * getLightColor(light) * getLightAmbientIntensity(ambient); - - // Directional - vec3 directionalDiffuse; - vec3 directionalSpecular; - evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surface, metallic, fresnel, albedo, shadowAttenuation); - color += directionalDiffuse; - color += directionalSpecular / opacity; - - return vec4(color, opacity); -} - -uniform sampler2D originalTexture; - -in vec2 _texCoord0; -in vec4 _positionES; -in vec3 _normalWS; -in vec3 _color; -in float _alpha; - -out vec4 _fragColor; - -void main(void) { - vec4 albedo = texture(originalTexture, _texCoord0); - - vec3 fragPosition = _positionES.xyz; - vec3 fragNormal = normalize(_normalWS); - vec3 fragAlbedo = albedo.rgb * _color; - float fragMetallic = 0.0; - vec3 fragSpecular = vec3(0.1); - float fragRoughness = 0.9; - float fragOpacity = albedo.a * _alpha; - - vec4 color = evalGlobalColor(1.0, - fragPosition, - fragNormal, - fragAlbedo, - fragMetallic, - fragSpecular, - fragRoughness, - fragOpacity); - - // Apply standard tone mapping - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} diff --git a/libraries/render-utils/src/overlay3D_translucent_unlit.slf b/libraries/render-utils/src/overlay3D_translucent_unlit.slf deleted file mode 100644 index 18a26d0790..0000000000 --- a/libraries/render-utils/src/overlay3D_translucent_unlit.slf +++ /dev/null @@ -1,27 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// overlay3D_translucent_unlit.frag -// fragment shader -// -// Created by Zach Pomerantz on 2/2/2016. -// Copyright 2016 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 -// - -uniform sampler2D originalTexture; - -in vec2 _texCoord0; -in vec3 _color; -in float _alpha; - -out vec4 _fragColor; - -void main(void) { - vec4 albedo = texture(originalTexture, _texCoord0); - - _fragColor = vec4(albedo.rgb * _color, albedo.a * _alpha); -} diff --git a/libraries/render-utils/src/overlay3D_unlit.slf b/libraries/render-utils/src/overlay3D_unlit.slf deleted file mode 100644 index 42e51bdc25..0000000000 --- a/libraries/render-utils/src/overlay3D_unlit.slf +++ /dev/null @@ -1,32 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// overlay3D_unlit.frag -// fragment shader -// -// Created by Zach Pomerantz on 2/2/2016. -// Copyright 2016 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 -// - -uniform sampler2D originalTexture; - -in vec2 _texCoord0; -in vec3 _color; - -out vec4 _fragColor; - -void main(void) { - vec4 albedo = texture(originalTexture, _texCoord0); - - if (albedo.a <= 0.1) { - discard; - } - vec4 color = vec4(albedo.rgb * _color, albedo.a); - - // Apply standard tone mapping - _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); -} diff --git a/tests-manual/shaders/src/main.cpp b/tests-manual/shaders/src/main.cpp index 67cb58182c..6e117b33cb 100644 --- a/tests-manual/shaders/src/main.cpp +++ b/tests-manual/shaders/src/main.cpp @@ -57,9 +57,6 @@ #include #include -#include -#include - #include #include @@ -195,8 +192,6 @@ void QTestWindow::draw() { testShaderBuild(ambient_occlusion_vert::getSource(), occlusion_blend_frag::getSource()); */ - testShaderBuild(overlay3D_vert::getSource(), overlay3D_frag::getSource()); - testShaderBuild(paintStroke_vert::getSource(),paintStroke_frag::getSource()); testShaderBuild(polyvox_vert::getSource(), polyvox_frag::getSource());