Trying to fix the overlay Image3D shading pipeline used

This commit is contained in:
samcake 2017-04-03 17:35:28 -07:00
parent 66ff551a7c
commit a882beb2fd
5 changed files with 62 additions and 8 deletions

View file

@ -573,7 +573,7 @@ void OpenGLDisplayPlugin::compositeLayers() {
{
PROFILE_RANGE_EX(render_detail, "compositeOverlay", 0xff0077ff, (uint64_t)presentCount())
compositeOverlay();
// compositeOverlay();
}
auto compositorHelper = DependencyManager::get<CompositorHelper>();
if (compositorHelper->getReticleVisible()) {

View file

@ -278,6 +278,7 @@ void OffscreenQmlSurface::cleanup() {
}
void OffscreenQmlSurface::render() {
return;
if (_paused) {
return;
}

View file

@ -28,6 +28,10 @@
#include "skin_model_shadow_vert.h"
#include "skin_model_normal_map_vert.h"
#include "simple_vert.h"
#include "simple_textured_frag.h"
#include "simple_textured_unlit_frag.h"
#include "model_frag.h"
#include "model_unlit_frag.h"
#include "model_shadow_frag.h"
@ -135,6 +139,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
void initDeferredPipelines(render::ShapePlumber& plumber) {
// Vertex shaders
auto simpleVertex = gpu::Shader::createVertex(std::string(simple_vert));
auto modelVertex = gpu::Shader::createVertex(std::string(model_vert));
auto modelNormalMapVertex = gpu::Shader::createVertex(std::string(model_normal_map_vert));
auto modelLightmapVertex = gpu::Shader::createVertex(std::string(model_lightmap_vert));
@ -145,6 +150,8 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
auto skinModelShadowVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_vert));
// Pixel shaders
auto simplePixel = gpu::Shader::createPixel(std::string(simple_textured_frag));
auto simpleUnlitPixel = gpu::Shader::createPixel(std::string(simple_textured_unlit_frag));
auto modelPixel = gpu::Shader::createPixel(std::string(model_frag));
auto modelUnlitPixel = gpu::Shader::createPixel(std::string(model_unlit_frag));
auto modelNormalMapPixel = gpu::Shader::createPixel(std::string(model_normal_map_frag));
@ -167,13 +174,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
modelVertex, modelPixel);
addPipeline(
Key::Builder(),
modelVertex, modelPixel);
modelVertex, simplePixel);
addPipeline(
Key::Builder().withMaterial().withUnlit(),
modelVertex, modelUnlitPixel);
addPipeline(
Key::Builder().withUnlit(),
modelVertex, modelUnlitPixel);
modelVertex, simpleUnlitPixel);
addPipeline(
Key::Builder().withMaterial().withTangents(),
modelNormalMapVertex, modelNormalMapPixel);
@ -189,13 +196,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
modelVertex, modelTranslucentPixel);
addPipeline(
Key::Builder().withTranslucent(),
modelVertex, modelTranslucentPixel);
simpleVertex, simplePixel);
addPipeline(
Key::Builder().withMaterial().withTranslucent().withUnlit(),
modelVertex, modelTranslucentUnlitPixel);
addPipeline(
Key::Builder().withTranslucent().withUnlit(),
modelVertex, modelTranslucentUnlitPixel);
simpleVertex, simpleUnlitPixel);
addPipeline(
Key::Builder().withMaterial().withTranslucent().withTangents(),
modelNormalMapVertex, modelTranslucentPixel);

View file

@ -2,7 +2,7 @@
<$VERSION_HEADER$>
// Generated on <$_SCRIBE_DATE$>
//
// simple.frag
// simple_textured_unlit.frag
// fragment shader
//
// Created by Clément Brisset on 5/29/15.
@ -31,12 +31,22 @@ void main(void) {
const float ALPHA_THRESHOLD = 0.999;
if (_color.a * texel.a < ALPHA_THRESHOLD) {
packDeferredFragmentTranslucent(
_fragColor0 = vec4(_color.rgb * texel.rgb, _color.a * texel.a);
if (_color.a * texel.a <= 0.0) {
_fragColor0 = vec4(_color.rgb * texel.rgb, _color.a * texel.a);
//discard;
} else {
_fragColor0 = vec4(_color.rgb * texel.rgb, _color.a * texel.a);
}
// _fragColor0 = vec4(albedo.rgb, alpha);
/* packDeferredFragmentTranslucent(
normalize(_normal),
_color.a * texel.a,
_color.rgb * texel.rgb,
DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS);
DEFAULT_ROUGHNESS);*/
} else {
packDeferredFragmentUnlit(
normalize(_normal),

View file

@ -0,0 +1,36 @@
<@include gpu/Config.slh@>
<$VERSION_HEADER$>
// Generated on <$_SCRIBE_DATE$>
//
// simple_transparent_textured.slf
// fragment shader
//
// Created by Sam Gateau on 4/3/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 gpu/Color.slh@>
<@include DeferredBufferWrite.slh@>
<@include model/Material.slh@>
// the albedo texture
uniform sampler2D originalTexture;
// the interpolated normal
in vec3 _normal;
in vec4 _color;
in vec2 _texCoord0;
void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st);
texel = colorToLinearRGBA(texel);
packDeferredFragmentTranslucent(
normalize(_normal),
_color.a,
_color.rgb * texel.rgb,
DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS);
}