mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:37:46 +02:00
Added shadow shader variants
This commit is contained in:
parent
08fcd6c357
commit
74bb3213e4
4 changed files with 107 additions and 3 deletions
|
@ -28,11 +28,12 @@
|
||||||
#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 "skin_model_fade_vert.h"
|
#include "model_shadow_fade_vert.h"
|
||||||
#include "skin_model_normal_map_fade_vert.h"
|
|
||||||
|
|
||||||
#include "model_lightmap_fade_vert.h"
|
#include "model_lightmap_fade_vert.h"
|
||||||
#include "model_lightmap_normal_map_fade_vert.h"
|
#include "model_lightmap_normal_map_fade_vert.h"
|
||||||
|
#include "skin_model_fade_vert.h"
|
||||||
|
#include "skin_model_shadow_fade_vert.h"
|
||||||
|
#include "skin_model_normal_map_fade_vert.h"
|
||||||
|
|
||||||
#include "simple_vert.h"
|
#include "simple_vert.h"
|
||||||
#include "simple_textured_frag.h"
|
#include "simple_textured_frag.h"
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
#include "model_normal_map_fade_vert.h"
|
#include "model_normal_map_fade_vert.h"
|
||||||
|
|
||||||
#include "model_fade_frag.h"
|
#include "model_fade_frag.h"
|
||||||
|
#include "model_shadow_fade_frag.h"
|
||||||
#include "model_unlit_fade_frag.h"
|
#include "model_unlit_fade_frag.h"
|
||||||
#include "model_normal_map_fade_frag.h"
|
#include "model_normal_map_fade_frag.h"
|
||||||
#include "model_normal_specular_map_fade_frag.h"
|
#include "model_normal_specular_map_fade_frag.h"
|
||||||
|
@ -183,6 +185,8 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
auto modelFadeVertex = gpu::Shader::createVertex(std::string(model_fade_vert));
|
auto modelFadeVertex = gpu::Shader::createVertex(std::string(model_fade_vert));
|
||||||
auto modelNormalMapFadeVertex = gpu::Shader::createVertex(std::string(model_normal_map_fade_vert));
|
auto modelNormalMapFadeVertex = gpu::Shader::createVertex(std::string(model_normal_map_fade_vert));
|
||||||
auto simpleFadeVertex = gpu::Shader::createVertex(std::string(simple_fade_vert));
|
auto simpleFadeVertex = gpu::Shader::createVertex(std::string(simple_fade_vert));
|
||||||
|
auto modelShadowFadeVertex = gpu::Shader::createVertex(std::string(model_shadow_fade_vert));
|
||||||
|
auto skinModelShadowFadeVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_fade_vert));
|
||||||
|
|
||||||
// Pixel shaders
|
// Pixel shaders
|
||||||
auto simplePixel = gpu::Shader::createPixel(std::string(simple_textured_frag));
|
auto simplePixel = gpu::Shader::createPixel(std::string(simple_textured_frag));
|
||||||
|
@ -211,6 +215,7 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
auto modelNormalMapFadePixel = gpu::Shader::createPixel(std::string(model_normal_map_fade_frag));
|
auto modelNormalMapFadePixel = gpu::Shader::createPixel(std::string(model_normal_map_fade_frag));
|
||||||
auto modelSpecularMapFadePixel = gpu::Shader::createPixel(std::string(model_specular_map_fade_frag));
|
auto modelSpecularMapFadePixel = gpu::Shader::createPixel(std::string(model_specular_map_fade_frag));
|
||||||
auto modelNormalSpecularMapFadePixel = gpu::Shader::createPixel(std::string(model_normal_specular_map_fade_frag));
|
auto modelNormalSpecularMapFadePixel = gpu::Shader::createPixel(std::string(model_normal_specular_map_fade_frag));
|
||||||
|
auto modelShadowFadePixel = gpu::Shader::createPixel(std::string(model_shadow_fade_frag));
|
||||||
auto simpleFadePixel = gpu::Shader::createPixel(std::string(simple_textured_fade_frag));
|
auto simpleFadePixel = gpu::Shader::createPixel(std::string(simple_textured_fade_frag));
|
||||||
auto simpleUnlitFadePixel = gpu::Shader::createPixel(std::string(simple_textured_unlit_fade_frag));
|
auto simpleUnlitFadePixel = gpu::Shader::createPixel(std::string(simple_textured_unlit_fade_frag));
|
||||||
|
|
||||||
|
@ -364,6 +369,13 @@ void initDeferredPipelines(render::ShapePlumber& plumber) {
|
||||||
addPipeline(
|
addPipeline(
|
||||||
Key::Builder().withSkinned().withDepthOnly(),
|
Key::Builder().withSkinned().withDepthOnly(),
|
||||||
skinModelShadowVertex, modelShadowPixel);
|
skinModelShadowVertex, modelShadowPixel);
|
||||||
|
// Same thing but with Fade on
|
||||||
|
addPipeline(
|
||||||
|
Key::Builder().withDepthOnly().withFade(),
|
||||||
|
modelShadowFadeVertex, modelShadowFadePixel);
|
||||||
|
addPipeline(
|
||||||
|
Key::Builder().withSkinned().withDepthOnly().withFade(),
|
||||||
|
skinModelShadowFadeVertex, modelShadowFadePixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initForwardPipelines(render::ShapePlumber& plumber) {
|
void initForwardPipelines(render::ShapePlumber& plumber) {
|
||||||
|
|
27
libraries/render-utils/src/model_shadow_fade.slf
Normal file
27
libraries/render-utils/src/model_shadow_fade.slf
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<@include gpu/Config.slh@>
|
||||||
|
<$VERSION_HEADER$>
|
||||||
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
|
//
|
||||||
|
// model_shadow_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 Fade.slh@>
|
||||||
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
|
layout(location = 0) out vec4 _fragColor;
|
||||||
|
|
||||||
|
in vec4 _worldFadePosition;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
applyFade(_worldFadePosition.xyz);
|
||||||
|
|
||||||
|
// pass-through to set z-buffer
|
||||||
|
_fragColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||||
|
}
|
31
libraries/render-utils/src/model_shadow_fade.slv
Normal file
31
libraries/render-utils/src/model_shadow_fade.slv
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<@include gpu/Config.slh@>
|
||||||
|
<$VERSION_HEADER$>
|
||||||
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
|
//
|
||||||
|
// model_shadow_fade.vert
|
||||||
|
// vertex shader
|
||||||
|
//
|
||||||
|
// Created by Olivier Prat on 06/045/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/Inputs.slh@>
|
||||||
|
|
||||||
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
|
<@include Fade.slh@>
|
||||||
|
|
||||||
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
|
out vec4 _worldFadePosition;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
// standard transform
|
||||||
|
TransformCamera cam = getTransformCamera();
|
||||||
|
TransformObject obj = getTransformObject();
|
||||||
|
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||||
|
<$transformModelToFadePos(obj, inPosition, _worldFadePosition)$>
|
||||||
|
}
|
34
libraries/render-utils/src/skin_model_shadow_fade.slv
Normal file
34
libraries/render-utils/src/skin_model_shadow_fade.slv
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<@include gpu/Config.slh@>
|
||||||
|
<$VERSION_HEADER$>
|
||||||
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
|
//
|
||||||
|
// skin_model_shadow_fade.vert
|
||||||
|
// vertex shader
|
||||||
|
//
|
||||||
|
// Created by Olivier Prat on 06/045/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/Inputs.slh@>
|
||||||
|
<@include gpu/Transform.slh@>
|
||||||
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
|
<@include Fade.slh@>
|
||||||
|
|
||||||
|
<@include Skinning.slh@>
|
||||||
|
|
||||||
|
out vec4 _worldFadePosition;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
skinPosition(inSkinClusterIndex, inSkinClusterWeight, inPosition, position);
|
||||||
|
|
||||||
|
// standard transform
|
||||||
|
TransformCamera cam = getTransformCamera();
|
||||||
|
TransformObject obj = getTransformObject();
|
||||||
|
<$transformModelToClipPos(cam, obj, position, gl_Position)$>
|
||||||
|
<$transformModelToFadePos(obj, inPosition, _worldFadePosition)$>
|
||||||
|
}
|
Loading…
Reference in a new issue