mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:13:29 +02:00
Trying to fix the overlay Image3D shading pipeline used
This commit is contained in:
parent
66ff551a7c
commit
a882beb2fd
5 changed files with 62 additions and 8 deletions
|
@ -573,7 +573,7 @@ void OpenGLDisplayPlugin::compositeLayers() {
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE_EX(render_detail, "compositeOverlay", 0xff0077ff, (uint64_t)presentCount())
|
PROFILE_RANGE_EX(render_detail, "compositeOverlay", 0xff0077ff, (uint64_t)presentCount())
|
||||||
compositeOverlay();
|
// compositeOverlay();
|
||||||
}
|
}
|
||||||
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||||
if (compositorHelper->getReticleVisible()) {
|
if (compositorHelper->getReticleVisible()) {
|
||||||
|
|
|
@ -278,6 +278,7 @@ void OffscreenQmlSurface::cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::render() {
|
void OffscreenQmlSurface::render() {
|
||||||
|
return;
|
||||||
if (_paused) {
|
if (_paused) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include "skin_model_shadow_vert.h"
|
#include "skin_model_shadow_vert.h"
|
||||||
#include "skin_model_normal_map_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_frag.h"
|
||||||
#include "model_unlit_frag.h"
|
#include "model_unlit_frag.h"
|
||||||
#include "model_shadow_frag.h"
|
#include "model_shadow_frag.h"
|
||||||
|
@ -135,6 +139,7 @@ void initOverlay3DPipelines(ShapePlumber& plumber) {
|
||||||
|
|
||||||
void initDeferredPipelines(render::ShapePlumber& plumber) {
|
void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
// Vertex shaders
|
// Vertex shaders
|
||||||
|
auto simpleVertex = gpu::Shader::createVertex(std::string(simple_vert));
|
||||||
auto modelVertex = gpu::Shader::createVertex(std::string(model_vert));
|
auto modelVertex = gpu::Shader::createVertex(std::string(model_vert));
|
||||||
auto modelNormalMapVertex = gpu::Shader::createVertex(std::string(model_normal_map_vert));
|
auto modelNormalMapVertex = gpu::Shader::createVertex(std::string(model_normal_map_vert));
|
||||||
auto modelLightmapVertex = gpu::Shader::createVertex(std::string(model_lightmap_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));
|
auto skinModelShadowVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_vert));
|
||||||
|
|
||||||
// Pixel shaders
|
// 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 modelPixel = gpu::Shader::createPixel(std::string(model_frag));
|
||||||
auto modelUnlitPixel = gpu::Shader::createPixel(std::string(model_unlit_frag));
|
auto modelUnlitPixel = gpu::Shader::createPixel(std::string(model_unlit_frag));
|
||||||
auto modelNormalMapPixel = gpu::Shader::createPixel(std::string(model_normal_map_frag));
|
auto modelNormalMapPixel = gpu::Shader::createPixel(std::string(model_normal_map_frag));
|
||||||
|
@ -167,13 +174,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
modelVertex, modelPixel);
|
modelVertex, modelPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder(),
|
Key::Builder(),
|
||||||
modelVertex, modelPixel);
|
modelVertex, simplePixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withMaterial().withUnlit(),
|
Key::Builder().withMaterial().withUnlit(),
|
||||||
modelVertex, modelUnlitPixel);
|
modelVertex, modelUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withUnlit(),
|
Key::Builder().withUnlit(),
|
||||||
modelVertex, modelUnlitPixel);
|
modelVertex, simpleUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withMaterial().withTangents(),
|
Key::Builder().withMaterial().withTangents(),
|
||||||
modelNormalMapVertex, modelNormalMapPixel);
|
modelNormalMapVertex, modelNormalMapPixel);
|
||||||
|
@ -189,13 +196,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
modelVertex, modelTranslucentPixel);
|
modelVertex, modelTranslucentPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent(),
|
Key::Builder().withTranslucent(),
|
||||||
modelVertex, modelTranslucentPixel);
|
simpleVertex, simplePixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withMaterial().withTranslucent().withUnlit(),
|
Key::Builder().withMaterial().withTranslucent().withUnlit(),
|
||||||
modelVertex, modelTranslucentUnlitPixel);
|
modelVertex, modelTranslucentUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withTranslucent().withUnlit(),
|
Key::Builder().withTranslucent().withUnlit(),
|
||||||
modelVertex, modelTranslucentUnlitPixel);
|
simpleVertex, simpleUnlitPixel);
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withMaterial().withTranslucent().withTangents(),
|
Key::Builder().withMaterial().withTranslucent().withTangents(),
|
||||||
modelNormalMapVertex, modelTranslucentPixel);
|
modelNormalMapVertex, modelTranslucentPixel);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// simple.frag
|
// simple_textured_unlit.frag
|
||||||
// fragment shader
|
// fragment shader
|
||||||
//
|
//
|
||||||
// Created by Clément Brisset on 5/29/15.
|
// Created by Clément Brisset on 5/29/15.
|
||||||
|
@ -31,12 +31,22 @@ void main(void) {
|
||||||
|
|
||||||
const float ALPHA_THRESHOLD = 0.999;
|
const float ALPHA_THRESHOLD = 0.999;
|
||||||
if (_color.a * texel.a < ALPHA_THRESHOLD) {
|
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),
|
normalize(_normal),
|
||||||
_color.a * texel.a,
|
_color.a * texel.a,
|
||||||
_color.rgb * texel.rgb,
|
_color.rgb * texel.rgb,
|
||||||
DEFAULT_FRESNEL,
|
DEFAULT_FRESNEL,
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);*/
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragmentUnlit(
|
packDeferredFragmentUnlit(
|
||||||
normalize(_normal),
|
normalize(_normal),
|
||||||
|
|
36
libraries/render-utils/src/simple_transparent_textured.slf
Normal file
36
libraries/render-utils/src/simple_transparent_textured.slf
Normal 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);
|
||||||
|
}
|
Loading…
Reference in a new issue