mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-25 14:50:09 +02:00
47 lines
1.3 KiB
Text
Executable file
47 lines
1.3 KiB
Text
Executable file
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// model_lightmap_normal_map.frag
|
|
// fragment shader
|
|
//
|
|
// Created by Samuel Gateau on 11/19/14.
|
|
// Copyright 2013 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 DeferredBufferWrite.slh@>
|
|
|
|
<@include model/Material.slh@>
|
|
|
|
<@include MaterialTextures.slh@>
|
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL)$>
|
|
<$declareMaterialLightmap()$>
|
|
|
|
in vec4 _position;
|
|
in vec2 _texCoord0;
|
|
in vec2 _texCoord1;
|
|
in vec3 _normal;
|
|
in vec3 _tangent;
|
|
in vec3 _color;
|
|
|
|
void main(void) {
|
|
Material mat = getMaterial();
|
|
int matKey = getMaterialKey(mat);
|
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel)$>
|
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
|
|
|
vec3 viewNormal;
|
|
<$tangentToViewSpace(normalTexel, _normal, _tangent, viewNormal)$>
|
|
|
|
packDeferredFragmentLightmap(
|
|
normalize(viewNormal.xyz),
|
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
|
getMaterialAlbedo(mat) * albedo.rgb * _color,
|
|
getMaterialRoughness(mat),
|
|
getMaterialMetallic(mat),
|
|
getMaterialFresnel(mat),
|
|
lightmapVal);
|
|
}
|