FIxing the bug for image3D overlay drawn in scene

This commit is contained in:
samcake 2017-04-04 12:56:43 -07:00
parent b18d82bd19
commit 6385a702cd
3 changed files with 34 additions and 10 deletions

View file

@ -178,13 +178,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
modelVertex, modelPixel);
addPipeline(
Key::Builder(),
modelVertex, simplePixel);
simpleVertex, simplePixel);
addPipeline(
Key::Builder().withMaterial().withUnlit(),
modelVertex, modelUnlitPixel);
addPipeline(
Key::Builder().withUnlit(),
modelVertex, simpleUnlitPixel);
simpleVertex, simpleUnlitPixel);
addPipeline(
Key::Builder().withMaterial().withTangents(),
modelNormalMapVertex, modelNormalMapPixel);

View file

@ -13,29 +13,50 @@
//
<@include gpu/Color.slh@>
<@include DeferredBufferWrite.slh@>
<@include model/Material.slh@>
<@include DeferredGlobalLight.slh@>
<$declareEvalGlobalLightingAlphaBlended()$>
<@include gpu/Transform.slh@>
<$declareStandardCameraTransform()$>
// the albedo texture
uniform sampler2D originalTexture;
// the interpolated normal
in vec4 _position;
in vec3 _normal;
in vec4 _color;
in vec2 _texCoord0;
void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st);
float colorAlpha = _color.a;
float opacity = _color.a;
if (_color.a <= 0.0) {
texel = colorToLinearRGBA(texel);
colorAlpha = -_color.a;
opacity = -_color.a;
}
opacity *= texel.a;
vec3 albedo = _color.rgb * texel.rgb;
packDeferredFragmentTranslucent(
normalize(_normal),
colorAlpha,
_color.rgb * texel.rgb,
vec3 fragPosition = _position.xyz;
vec3 fragNormal = normalize(_normal);
TransformCamera cam = getTransformCamera();
_fragColor0 = vec4(evalGlobalLightingAlphaBlended(
cam._viewInverse,
1.0,
1.0,
fragPosition,
fragNormal,
albedo,
DEFAULT_FRESNEL,
DEFAULT_ROUGHNESS);
0.0,
vec3(0.0f),
DEFAULT_ROUGHNESS,
opacity),
opacity);
}

View file

@ -22,6 +22,9 @@ in vec3 _normal;
in vec4 _color;
in vec2 _texCoord0;
layout(location = 0) out vec4 _fragColor0;
void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st);
float colorAlpha = _color.a;