mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
cleaning up fragment shaders
This commit is contained in:
parent
3d71dfc467
commit
09a6053044
35 changed files with 229 additions and 233 deletions
|
@ -30,6 +30,5 @@ void main(void) {
|
||||||
float(frontCondition) * interpolatedNormal,
|
float(frontCondition) * interpolatedNormal,
|
||||||
texel.a * varColor.a,
|
texel.a * varColor.a,
|
||||||
color * texel.rgb,
|
color * texel.rgb,
|
||||||
vec3(0.01, 0.01, 0.01),
|
|
||||||
10.0);
|
10.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,5 @@ void main(void) {
|
||||||
interpolatedNormal * float(frontCondition),
|
interpolatedNormal * float(frontCondition),
|
||||||
texel.a * varColor.a,
|
texel.a * varColor.a,
|
||||||
polyline.color * texel.rgb + fadeEmissive,
|
polyline.color * texel.rgb + fadeEmissive,
|
||||||
vec3(0.01, 0.01, 0.01),
|
|
||||||
10.0);
|
10.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -981,7 +981,7 @@ FBXGeometry::Pointer OBJReader::readOBJ(QByteArray& model, const QVariantHash& m
|
||||||
modelMaterial->setMetallic(ILLUMINATION_MODEL_APPLY_NON_METALLIC);
|
modelMaterial->setMetallic(ILLUMINATION_MODEL_APPLY_NON_METALLIC);
|
||||||
}
|
}
|
||||||
if (fresnelOn) {
|
if (fresnelOn) {
|
||||||
modelMaterial->setFresnel(glm::vec3(1.0f));
|
// TODO: how to turn fresnel on?
|
||||||
}
|
}
|
||||||
|
|
||||||
modelMaterial->setOpacity(fbxMaterial.opacity);
|
modelMaterial->setOpacity(fbxMaterial.opacity);
|
||||||
|
|
|
@ -70,7 +70,7 @@ Material& Material::operator= (const Material& material) {
|
||||||
Material::~Material() {
|
Material::~Material() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Material::setEmissive(const Color& emissive, bool isSRGB) {
|
void Material::setEmissive(const Color& emissive, bool isSRGB) {
|
||||||
_key.setEmissive(glm::any(glm::greaterThan(emissive, Color(0.0f))));
|
_key.setEmissive(glm::any(glm::greaterThan(emissive, Color(0.0f))));
|
||||||
_schemaBuffer.edit<Schema>()._key = (uint32) _key._flags.to_ulong();
|
_schemaBuffer.edit<Schema>()._key = (uint32) _key._flags.to_ulong();
|
||||||
_schemaBuffer.edit<Schema>()._emissive = (isSRGB ? ColorUtils::sRGBToLinearVec3(emissive) : emissive);
|
_schemaBuffer.edit<Schema>()._emissive = (isSRGB ? ColorUtils::sRGBToLinearVec3(emissive) : emissive);
|
||||||
|
@ -100,11 +100,6 @@ void Material::setRoughness(float roughness) {
|
||||||
_schemaBuffer.edit<Schema>()._roughness = roughness;
|
_schemaBuffer.edit<Schema>()._roughness = roughness;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Material::setFresnel(const Color& fresnel, bool isSRGB) {
|
|
||||||
//_key.setAlbedo(glm::any(glm::greaterThan(albedo, Color(0.0f))));
|
|
||||||
_schemaBuffer.edit<Schema>()._fresnel = (isSRGB ? ColorUtils::sRGBToLinearVec3(fresnel) : fresnel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Material::setMetallic(float metallic) {
|
void Material::setMetallic(float metallic) {
|
||||||
metallic = glm::clamp(metallic, 0.0f, 1.0f);
|
metallic = glm::clamp(metallic, 0.0f, 1.0f);
|
||||||
_key.setMetallic(metallic > 0.0f);
|
_key.setMetallic(metallic > 0.0f);
|
||||||
|
|
|
@ -291,9 +291,6 @@ public:
|
||||||
void setAlbedo(const Color& albedo, bool isSRGB = true);
|
void setAlbedo(const Color& albedo, bool isSRGB = true);
|
||||||
Color getAlbedo(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_schemaBuffer.get<Schema>()._albedo) : _schemaBuffer.get<Schema>()._albedo); }
|
Color getAlbedo(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_schemaBuffer.get<Schema>()._albedo) : _schemaBuffer.get<Schema>()._albedo); }
|
||||||
|
|
||||||
void setFresnel(const Color& fresnel, bool isSRGB = true);
|
|
||||||
Color getFresnel(bool SRGB = true) const { return (SRGB ? ColorUtils::tosRGBVec3(_schemaBuffer.get<Schema>()._fresnel) : _schemaBuffer.get<Schema>()._fresnel); }
|
|
||||||
|
|
||||||
void setMetallic(float metallic);
|
void setMetallic(float metallic);
|
||||||
float getMetallic() const { return _schemaBuffer.get<Schema>()._metallic; }
|
float getMetallic() const { return _schemaBuffer.get<Schema>()._metallic; }
|
||||||
|
|
||||||
|
@ -306,20 +303,18 @@ public:
|
||||||
// Schema to access the attribute values of the material
|
// Schema to access the attribute values of the material
|
||||||
class Schema {
|
class Schema {
|
||||||
public:
|
public:
|
||||||
glm::vec3 _emissive{ 0.0f }; // No Emissive
|
glm::vec3 _emissive { 0.0f }; // No Emissive
|
||||||
float _opacity{ 1.0f }; // Opacity = 1 => Not Transparent
|
float _opacity { 1.0f }; // Opacity = 1 => Not Transparent
|
||||||
|
|
||||||
glm::vec3 _albedo{ 0.5f }; // Grey albedo => isAlbedo
|
glm::vec3 _albedo { 0.5f }; // Grey albedo => isAlbedo
|
||||||
float _roughness{ 1.0f }; // Roughness = 1 => Not Glossy
|
float _roughness { 1.0f }; // Roughness = 1 => Not Glossy
|
||||||
|
|
||||||
glm::vec3 _fresnel{ 0.03f }; // Fresnel value for a default non metallic
|
float _metallic { 0.0f }; // Not Metallic
|
||||||
float _metallic{ 0.0f }; // Not Metallic
|
float _scattering { 0.0f }; // Scattering info
|
||||||
|
glm::vec2 _spare { 0.0f };
|
||||||
|
|
||||||
float _scattering{ 0.0f }; // Scattering info
|
uint32_t _key { 0 }; // a copy of the materialKey
|
||||||
|
glm::vec3 _spare2 { 0.0f };
|
||||||
glm::vec2 _spare{ 0.0f };
|
|
||||||
|
|
||||||
uint32_t _key{ 0 }; // a copy of the materialKey
|
|
||||||
|
|
||||||
// for alignment beauty, Material size == Mat4x4
|
// for alignment beauty, Material size == Mat4x4
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
struct Material {
|
struct Material {
|
||||||
vec4 _emissiveOpacity;
|
vec4 _emissiveOpacity;
|
||||||
vec4 _albedoRoughness;
|
vec4 _albedoRoughness;
|
||||||
vec4 _fresnelMetallic;
|
vec4 _metallicScatteringSpare2;
|
||||||
vec4 _scatteringSpare2Key;
|
vec4 _keySpare3;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(binding=GRAPHICS_BUFFER_MATERIAL) uniform materialBuffer {
|
layout(binding=GRAPHICS_BUFFER_MATERIAL) uniform materialBuffer {
|
||||||
|
@ -36,15 +36,12 @@ float getMaterialOpacity(Material m) { return m._emissiveOpacity.a; }
|
||||||
|
|
||||||
vec3 getMaterialAlbedo(Material m) { return m._albedoRoughness.rgb; }
|
vec3 getMaterialAlbedo(Material m) { return m._albedoRoughness.rgb; }
|
||||||
float getMaterialRoughness(Material m) { return m._albedoRoughness.a; }
|
float getMaterialRoughness(Material m) { return m._albedoRoughness.a; }
|
||||||
|
|
||||||
vec3 getMaterialFresnel(Material m) { return m._fresnelMetallic.rgb; }
|
|
||||||
float getMaterialMetallic(Material m) { return m._fresnelMetallic.a; }
|
|
||||||
|
|
||||||
float getMaterialShininess(Material m) { return 1.0 - getMaterialRoughness(m); }
|
float getMaterialShininess(Material m) { return 1.0 - getMaterialRoughness(m); }
|
||||||
|
|
||||||
float getMaterialScattering(Material m) { return m._scatteringSpare2Key.x; }
|
float getMaterialMetallic(Material m) { return m._metallicScatteringSpare2.x; }
|
||||||
|
float getMaterialScattering(Material m) { return m._metallicScatteringSpare2.y; }
|
||||||
|
|
||||||
BITFIELD getMaterialKey(Material m) { return floatBitsToInt(m._scatteringSpare2Key.w); }
|
BITFIELD getMaterialKey(Material m) { return floatBitsToInt(m._keySpare3.x); }
|
||||||
|
|
||||||
const BITFIELD EMISSIVE_VAL_BIT = 0x00000001;
|
const BITFIELD EMISSIVE_VAL_BIT = 0x00000001;
|
||||||
const BITFIELD UNLIT_VAL_BIT = 0x00000002;
|
const BITFIELD UNLIT_VAL_BIT = 0x00000002;
|
||||||
|
|
|
@ -204,12 +204,12 @@ float fetchScatteringMap(vec2 uv) {
|
||||||
<@endif@>
|
<@endif@>
|
||||||
<@endfunc@>
|
<@endfunc@>
|
||||||
|
|
||||||
<@func fetchMaterialTexturesCoord1(matKey, texcoord1, occlusion, lightmapVal)@>
|
<@func fetchMaterialTexturesCoord1(matKey, texcoord1, occlusion, lightmap)@>
|
||||||
<@if occlusion@>
|
<@if occlusion@>
|
||||||
float <$occlusion$> = (((<$matKey$> & OCCLUSION_MAP_BIT) != 0) ? fetchOcclusionMap(<$texcoord1$>) : 1.0);
|
float <$occlusion$> = (((<$matKey$> & OCCLUSION_MAP_BIT) != 0) ? fetchOcclusionMap(<$texcoord1$>) : 1.0);
|
||||||
<@endif@>
|
<@endif@>
|
||||||
<@if lightmapVal@>
|
<@if lightmapVal@>
|
||||||
vec3 <$lightmapVal$> = fetchLightmapMap(<$texcoord1$>);
|
vec3 <$lightmap$> = fetchLightmapMap(<$texcoord1$>);
|
||||||
<@endif@>
|
<@endif@>
|
||||||
<@endfunc@>
|
<@endfunc@>
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ layout(location=3) out vec4 _fragColor3; // emissive
|
||||||
|
|
||||||
// the alpha threshold
|
// the alpha threshold
|
||||||
const float alphaThreshold = 0.5;
|
const float alphaThreshold = 0.5;
|
||||||
|
// FIXME: is this correct?
|
||||||
float evalOpaqueFinalAlpha(float alpha, float mapAlpha) {
|
float evalOpaqueFinalAlpha(float alpha, float mapAlpha) {
|
||||||
return mix(alpha, 1.0 - alpha, step(mapAlpha, alphaThreshold));
|
return mix(alpha, 1.0 - alpha, step(mapAlpha, alphaThreshold));
|
||||||
}
|
}
|
||||||
|
@ -39,7 +40,7 @@ void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness
|
||||||
_fragColor3 = vec4(isEmissiveEnabled() * emissive, 1.0);
|
_fragColor3 = vec4(isEmissiveEnabled() * emissive, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 fresnel, vec3 lightmap) {
|
void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 lightmap) {
|
||||||
if (alpha != 1.0) {
|
if (alpha != 1.0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ void packDeferredFragmentUnlit(vec3 normal, float alpha, vec3 color) {
|
||||||
_fragColor3 = vec4(color, 1.0);
|
_fragColor3 = vec4(color, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, vec3 fresnel, float roughness) {
|
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, float roughness) {
|
||||||
if (alpha <= 0.0) {
|
if (alpha <= 0.0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Andrzej Kapolka on 5/6/14.
|
// Created by Andrzej Kapolka on 5/6/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -42,11 +40,14 @@ void main(void) {
|
||||||
float roughness = getMaterialRoughness(mat);
|
float roughness = getMaterialRoughness(mat);
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
float scattering = getMaterialScattering(mat);
|
float scattering = getMaterialScattering(mat);
|
||||||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||||
|
@ -58,6 +59,6 @@ void main(void) {
|
||||||
roughness,
|
roughness,
|
||||||
metallic,
|
metallic,
|
||||||
emissive,
|
emissive,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
scattering);
|
scattering);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -13,17 +11,15 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
|
@ -34,13 +30,12 @@ layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex, scatteringTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = 1.0;
|
float opacity = 1.0;
|
||||||
|
@ -54,13 +49,17 @@ void main(void) {
|
||||||
float roughness = getMaterialRoughness(mat);
|
float roughness = getMaterialRoughness(mat);
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float metallic = getMaterialMetallic(mat);
|
||||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
float scattering = getMaterialScattering(mat);
|
float scattering = getMaterialScattering(mat);
|
||||||
|
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||||
|
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
|
@ -68,7 +67,7 @@ void main(void) {
|
||||||
albedo,
|
albedo,
|
||||||
roughness,
|
roughness,
|
||||||
metallic,
|
metallic,
|
||||||
emissive+fadeEmissive,
|
emissive + fadeEmissive,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
scattering);
|
scattering);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_lightmap.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Samuel Gateau on 11/19/14.
|
// Created by Samuel Gateau on 11/19/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -20,7 +18,6 @@
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
|
||||||
<$declareMaterialLightmap()$>
|
<$declareMaterialLightmap()$>
|
||||||
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
#define _texCoord1 _texCoord01.zw
|
#define _texCoord1 _texCoord01.zw
|
||||||
|
@ -30,15 +27,24 @@ layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmap)$>
|
||||||
|
|
||||||
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
albedo *= _color.rgb;
|
||||||
|
|
||||||
|
float roughness = getMaterialRoughness(mat);
|
||||||
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||||
getMaterialAlbedo(mat) * albedo.rgb * _color.rgb,
|
albedo,
|
||||||
getMaterialRoughness(mat) * roughness,
|
roughness,
|
||||||
getMaterialMetallic(mat) * metallicTex,
|
metallic,
|
||||||
/*metallicTex, // no use of */getMaterialFresnel(mat),
|
lightmap);
|
||||||
lightmapVal);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_lightmap_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -13,18 +11,16 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC)$>
|
||||||
<$declareMaterialLightmap()$>
|
<$declareMaterialLightmap()$>
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
#define _texCoord1 _texCoord01.zw
|
#define _texCoord1 _texCoord01.zw
|
||||||
|
@ -35,21 +31,29 @@ layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, _SCRIBE_NULL, metallicTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmap)$>
|
||||||
|
|
||||||
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
albedo *= _color.rgb;
|
||||||
|
|
||||||
|
float roughness = getMaterialRoughness(mat);
|
||||||
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||||
getMaterialAlbedo(mat) * albedo.rgb * _color.rgb,
|
albedo,
|
||||||
getMaterialRoughness(mat) * roughness,
|
roughness,
|
||||||
getMaterialMetallic(mat) * metallicTex,
|
metallic,
|
||||||
/*metallicTex, // no use of */getMaterialFresnel(mat),
|
lightmap + fadeEmissive);
|
||||||
lightmapVal+fadeEmissive);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_lightmap_normal_map.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Samuel Gateau on 11/19/14.
|
// Created by Samuel Gateau on 11/19/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -31,18 +29,27 @@ layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmap)$>
|
||||||
|
|
||||||
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
albedo *= _color.rgb;
|
||||||
|
|
||||||
|
float roughness = getMaterialRoughness(mat);
|
||||||
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fragNormal;
|
vec3 fragNormal;
|
||||||
<$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
|
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormal)$>
|
||||||
|
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(fragNormal.xyz),
|
normalize(fragNormal),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||||
getMaterialAlbedo(mat) * albedo.rgb * _color.rgb,
|
albedo,
|
||||||
getMaterialRoughness(mat) * roughness,
|
roughness,
|
||||||
getMaterialMetallic(mat) * metallicTex,
|
metallic,
|
||||||
/*specular, // no use of */ getMaterialFresnel(mat),
|
lightmap);
|
||||||
lightmapVal);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_lightmap_normal_map_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -13,18 +11,17 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC)$>
|
||||||
<$declareMaterialLightmap()$>
|
<$declareMaterialLightmap()$>
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
|
@ -32,29 +29,36 @@ layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS;
|
layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_TANGENT_WS) in vec3 _tangentWS;
|
layout(location=RENDER_UTILS_ATTR_TANGENT_WS) in vec3 _tangentWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedo, roughness, normalTexel, metallicTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmapVal)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmap)$>
|
||||||
|
|
||||||
|
vec3 albedo = getMaterialAlbedo(mat);
|
||||||
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
|
albedo *= _color.rgb;
|
||||||
|
|
||||||
|
float roughness = getMaterialRoughness(mat);
|
||||||
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fragNormal;
|
vec3 fragNormal;
|
||||||
<$evalMaterialNormalLOD(_positionES, normalTexel, _normalWS, _tangentWS, fragNormal)$>
|
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormal)$>
|
||||||
|
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(fragNormal.xyz),
|
normalize(fragNormal),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
|
||||||
getMaterialAlbedo(mat) * albedo.rgb * _color.rgb,
|
albedo,
|
||||||
getMaterialRoughness(mat) * roughness,
|
roughness,
|
||||||
getMaterialMetallic(mat) * metallicTex,
|
metallic,
|
||||||
/*specular, // no use of */ getMaterialFresnel(mat),
|
lightmap + fadeEmissive);
|
||||||
lightmapVal+fadeEmissive);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_normal_map.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Andrzej Kapolka on 5/6/14.
|
// Created by Andrzej Kapolka on 5/6/14.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -44,25 +42,28 @@ void main(void) {
|
||||||
float roughness = getMaterialRoughness(mat);
|
float roughness = getMaterialRoughness(mat);
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
vec3 fragNormalWS;
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
|
||||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
|
||||||
|
|
||||||
float scattering = getMaterialScattering(mat);
|
float scattering = getMaterialScattering(mat);
|
||||||
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||||
|
|
||||||
|
vec3 fragNormalWS;
|
||||||
|
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
|
||||||
|
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(fragNormalWS.xyz),
|
normalize(fragNormalWS),
|
||||||
opacity,
|
opacity,
|
||||||
albedo,
|
albedo,
|
||||||
roughness,
|
roughness,
|
||||||
metallic,
|
metallic,
|
||||||
emissive,
|
emissive,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
scattering);
|
scattering);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_normal_map_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -16,10 +14,10 @@
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION, SCATTERING)$>
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$>
|
|
||||||
|
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
||||||
|
@ -34,13 +32,12 @@ layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex, scatteringTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = 1.0;
|
float opacity = 1.0;
|
||||||
|
@ -54,24 +51,28 @@ void main(void) {
|
||||||
float roughness = getMaterialRoughness(mat);
|
float roughness = getMaterialRoughness(mat);
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
|
float scattering = getMaterialScattering(mat);
|
||||||
|
<$evalMaterialScattering(scatteringTex, scattering, matKey, scattering)$>;
|
||||||
|
|
||||||
vec3 fragNormalWS;
|
vec3 fragNormalWS;
|
||||||
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
|
<$evalMaterialNormalLOD(_positionES, normalTex, _normalWS, _tangentWS, fragNormalWS)$>
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
|
||||||
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
|
||||||
|
|
||||||
float scattering = getMaterialScattering(mat);
|
|
||||||
|
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(fragNormalWS.xyz),
|
normalize(fragNormalWS),
|
||||||
opacity,
|
opacity,
|
||||||
albedo,
|
albedo,
|
||||||
roughness,
|
roughness,
|
||||||
metallic,
|
metallic,
|
||||||
emissive + fadeEmissive,
|
emissive + fadeEmissive,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
scattering);
|
scattering);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_shadow.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Andrzej Kapolka on 3/24/14.
|
// Created by Andrzej Kapolka on 3/24/14.
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_shadow_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,19 +10,17 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include Fade.slh@>
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
||||||
|
|
||||||
layout(location=0) out vec4 _fragColor;
|
layout(location=0) out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFadeClip(fadeParams, _positionWS.xyz);
|
applyFadeClip(fadeParams, _positionWS.xyz);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_translucent.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Sam Gateau on 2/15/2016.
|
// Created by Sam Gateau on 2/15/2016.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,19 +10,20 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include DefaultMaterials.slh@>
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
<@include LightLocal.slh@>
|
<@include LightLocal.slh@>
|
||||||
<@include ShadingModel.slh@>
|
|
||||||
<@include DeferredGlobalLight.slh@>
|
<@include DeferredGlobalLight.slh@>
|
||||||
|
|
||||||
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
||||||
|
|
||||||
|
<@include gpu/Transform.slh@>
|
||||||
<$declareStandardCameraTransform()$>
|
<$declareStandardCameraTransform()$>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
|
@ -39,7 +38,7 @@ layout(location=0) out vec4 _fragColor;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
|
@ -54,11 +53,16 @@ void main(void) {
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fresnel = getFresnelF0(metallic, albedo);
|
vec3 fresnel = getFresnelF0(metallic, albedo);
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
vec3 fragPositionES = _positionES.xyz;
|
vec3 fragPositionES = _positionES.xyz;
|
||||||
vec3 fragPositionWS = _positionWS.xyz;
|
vec3 fragPositionWS = _positionWS.xyz;
|
||||||
// Lighting is done in world space
|
// Lighting is done in world space
|
||||||
|
@ -70,7 +74,6 @@ void main(void) {
|
||||||
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
||||||
|
|
||||||
vec4 localLighting = vec4(0.0);
|
vec4 localLighting = vec4(0.0);
|
||||||
|
|
||||||
<$fetchClusterInfo(_positionWS)$>;
|
<$fetchClusterInfo(_positionWS)$>;
|
||||||
if (hasLocalLights(numLights, clusterPos, dims)) {
|
if (hasLocalLights(numLights, clusterPos, dims)) {
|
||||||
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
||||||
|
@ -81,7 +84,7 @@ void main(void) {
|
||||||
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||||
cam._viewInverse,
|
cam._viewInverse,
|
||||||
1.0,
|
1.0,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
fragPositionES,
|
fragPositionES,
|
||||||
fragPositionWS,
|
fragPositionWS,
|
||||||
albedo,
|
albedo,
|
||||||
|
|
|
@ -1,29 +1,33 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
// model_translucent_fade.frag
|
//
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
<@include DefaultMaterials.slh@>
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
<@include graphics/MaterialTextures.slh@>
|
||||||
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@include LightLocal.slh@>
|
||||||
<@include DeferredGlobalLight.slh@>
|
<@include DeferredGlobalLight.slh@>
|
||||||
|
|
||||||
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
||||||
|
|
||||||
<@include LightLocal.slh@>
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
<$declareStandardCameraTransform()$>
|
<$declareStandardCameraTransform()$>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
#define _texCoord1 _texCoord01.zw
|
#define _texCoord1 _texCoord01.zw
|
||||||
|
@ -37,13 +41,12 @@ layout(location=0) out vec4 _fragColor;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, _SCRIBE_NULL, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, _SCRIBE_NULL, metallicTex, emissiveTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
|
@ -58,11 +61,16 @@ void main(void) {
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fresnel = getFresnelF0(metallic, albedo);
|
vec3 fresnel = getFresnelF0(metallic, albedo);
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
vec3 fragPositionES = _positionES.xyz;
|
vec3 fragPositionES = _positionES.xyz;
|
||||||
vec3 fragPositionWS = _positionWS.xyz;
|
vec3 fragPositionWS = _positionWS.xyz;
|
||||||
// Lighting is done in world space
|
// Lighting is done in world space
|
||||||
|
@ -74,7 +82,6 @@ void main(void) {
|
||||||
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
||||||
|
|
||||||
vec4 localLighting = vec4(0.0);
|
vec4 localLighting = vec4(0.0);
|
||||||
|
|
||||||
<$fetchClusterInfo(_positionWS)$>;
|
<$fetchClusterInfo(_positionWS)$>;
|
||||||
if (hasLocalLights(numLights, clusterPos, dims)) {
|
if (hasLocalLights(numLights, clusterPos, dims)) {
|
||||||
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
||||||
|
@ -85,7 +92,7 @@ void main(void) {
|
||||||
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||||
cam._viewInverse,
|
cam._viewInverse,
|
||||||
1.0,
|
1.0,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
fragPositionES,
|
fragPositionES,
|
||||||
fragPositionWS,
|
fragPositionWS,
|
||||||
albedo,
|
albedo,
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_translucent_normal_map.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 23/01/2018.
|
// Created by Olivier Prat on 23/01/2018.
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,21 +10,20 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
<@include DefaultMaterials.slh@>
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
<@include graphics/MaterialTextures.slh@>
|
||||||
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@include LightLocal.slh@>
|
||||||
<@include DeferredGlobalLight.slh@>
|
<@include DeferredGlobalLight.slh@>
|
||||||
|
|
||||||
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
||||||
|
|
||||||
<@include LightLocal.slh@>
|
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
<$declareStandardCameraTransform()$>
|
<$declareStandardCameraTransform()$>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
|
@ -42,7 +39,7 @@ layout(location=0) out vec4 _fragColor;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
int matKey = getMaterialKey(mat);
|
int matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
|
@ -57,11 +54,16 @@ void main(void) {
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fresnel = getFresnelF0(metallic, albedo);
|
vec3 fresnel = getFresnelF0(metallic, albedo);
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
vec3 fragPositionES = _positionES.xyz;
|
vec3 fragPositionES = _positionES.xyz;
|
||||||
vec3 fragPositionWS = _positionWS.xyz;
|
vec3 fragPositionWS = _positionWS.xyz;
|
||||||
// Lighting is done in world space
|
// Lighting is done in world space
|
||||||
|
@ -71,10 +73,9 @@ void main(void) {
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
|
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
|
||||||
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
|
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
|
||||||
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
SurfaceData surfaceWS = initSurfaceData(roughness, normalize(fragNormalWS), fragToEyeDirWS);
|
||||||
|
|
||||||
vec4 localLighting = vec4(0.0);
|
vec4 localLighting = vec4(0.0);
|
||||||
|
|
||||||
<$fetchClusterInfo(_positionWS)$>;
|
<$fetchClusterInfo(_positionWS)$>;
|
||||||
if (hasLocalLights(numLights, clusterPos, dims)) {
|
if (hasLocalLights(numLights, clusterPos, dims)) {
|
||||||
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
||||||
|
@ -85,7 +86,7 @@ void main(void) {
|
||||||
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||||
cam._viewInverse,
|
cam._viewInverse,
|
||||||
1.0,
|
1.0,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
fragPositionES,
|
fragPositionES,
|
||||||
fragPositionWS,
|
fragPositionWS,
|
||||||
albedo,
|
albedo,
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_translucent_normal_map_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 23/01/18.
|
// Created by Olivier Prat on 23/01/18.
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,47 +10,44 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include DefaultMaterials.slh@>
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
<@include graphics/MaterialTextures.slh@>
|
||||||
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@include LightLocal.slh@>
|
||||||
<@include DeferredGlobalLight.slh@>
|
<@include DeferredGlobalLight.slh@>
|
||||||
|
|
||||||
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
||||||
|
|
||||||
<@include LightLocal.slh@>
|
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
<$declareStandardCameraTransform()$>
|
<$declareStandardCameraTransform()$>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, METALLIC, EMISSIVE, OCCLUSION)$>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, NORMAL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
#define _texCoord1 _texCoord01.zw
|
#define _texCoord1 _texCoord01.zw
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
layout(location=RENDER_UTILS_ATTR_POSITION_ES) in vec4 _positionES;
|
||||||
|
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS;
|
layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_TANGENT_WS) in vec3 _tangentWS;
|
layout(location=RENDER_UTILS_ATTR_TANGENT_WS) in vec3 _tangentWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
|
||||||
|
|
||||||
layout(location=0) out vec4 _fragColor;
|
layout(location=0) out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
int matKey = getMaterialKey(mat);
|
int matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, _SCRIBE_NULL, emissiveTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex, roughnessTex, normalTex, metallicTex, emissiveTex)$>
|
||||||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, occlusionTex)$>
|
||||||
|
|
||||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||||
|
@ -67,11 +62,16 @@ void main(void) {
|
||||||
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
<$evalMaterialRoughness(roughnessTex, roughness, matKey, roughness)$>;
|
||||||
|
|
||||||
float metallic = getMaterialMetallic(mat);
|
float metallic = getMaterialMetallic(mat);
|
||||||
|
<$evalMaterialMetallic(metallicTex, metallic, matKey, metallic)$>;
|
||||||
|
|
||||||
vec3 fresnel = getFresnelF0(metallic, albedo);
|
vec3 fresnel = getFresnelF0(metallic, albedo);
|
||||||
|
|
||||||
vec3 emissive = getMaterialEmissive(mat);
|
vec3 emissive = getMaterialEmissive(mat);
|
||||||
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
<$evalMaterialEmissive(emissiveTex, emissive, matKey, emissive)$>;
|
||||||
|
|
||||||
|
float occlusion = DEFAULT_OCCLUSION;
|
||||||
|
<$evalMaterialOcclusion(occlusionTex, matKey, occlusion)$>;
|
||||||
|
|
||||||
vec3 fragPositionES = _positionES.xyz;
|
vec3 fragPositionES = _positionES.xyz;
|
||||||
vec3 fragPositionWS = _positionWS.xyz;
|
vec3 fragPositionWS = _positionWS.xyz;
|
||||||
// Lighting is done in world space
|
// Lighting is done in world space
|
||||||
|
@ -81,10 +81,9 @@ void main(void) {
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
|
vec3 fragToEyeWS = cam._viewInverse[3].xyz - fragPositionWS;
|
||||||
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
|
vec3 fragToEyeDirWS = normalize(fragToEyeWS);
|
||||||
SurfaceData surfaceWS = initSurfaceData(roughness, fragNormalWS, fragToEyeDirWS);
|
SurfaceData surfaceWS = initSurfaceData(roughness, normalize(fragNormalWS), fragToEyeDirWS);
|
||||||
|
|
||||||
vec4 localLighting = vec4(0.0);
|
vec4 localLighting = vec4(0.0);
|
||||||
|
|
||||||
<$fetchClusterInfo(_positionWS)$>;
|
<$fetchClusterInfo(_positionWS)$>;
|
||||||
if (hasLocalLights(numLights, clusterPos, dims)) {
|
if (hasLocalLights(numLights, clusterPos, dims)) {
|
||||||
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
localLighting = evalLocalLighting(cluster, numLights, fragPositionWS, surfaceWS,
|
||||||
|
@ -95,7 +94,7 @@ void main(void) {
|
||||||
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
_fragColor = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
||||||
cam._viewInverse,
|
cam._viewInverse,
|
||||||
1.0,
|
1.0,
|
||||||
occlusionTex,
|
occlusion,
|
||||||
fragPositionES,
|
fragPositionES,
|
||||||
fragPositionWS,
|
fragPositionWS,
|
||||||
albedo,
|
albedo,
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_translucent_unlit.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Zach Pomerantz on 2/3/2016.
|
// Created by Zach Pomerantz on 2/3/2016.
|
||||||
// Copyright 2016 High Fidelity, Inc.
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -13,12 +11,12 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
<@include LightingModel.slh@>
|
<@include LightingModel.slh@>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<$declareMaterialTextures(ALBEDO)$>
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_translucent_unlit_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -13,16 +11,16 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
|
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
<@include LightingModel.slh@>
|
<@include LightingModel.slh@>
|
||||||
|
|
||||||
|
<$declareMaterialTextures(ALBEDO)$>
|
||||||
|
|
||||||
<@include Fade.slh@>
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<@include render-utils/ShaderConstants.h@>
|
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
#define _texCoord0 _texCoord01.xy
|
#define _texCoord0 _texCoord01.xy
|
||||||
#define _texCoord1 _texCoord01.zw
|
#define _texCoord1 _texCoord01.zw
|
||||||
|
@ -34,7 +32,6 @@ layout(location=0) out vec4 _fragColor;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
|
@ -50,5 +47,6 @@ void main(void) {
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
albedo *= _color.rgb;
|
albedo *= _color.rgb;
|
||||||
albedo += fadeEmissive;
|
albedo += fadeEmissive;
|
||||||
|
|
||||||
_fragColor = vec4(albedo * isUnlitEnabled(), opacity);
|
_fragColor = vec4(albedo * isUnlitEnabled(), opacity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// material_opaque_unlit.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Sam Gateau on 5/5/2016.
|
// Created by Sam Gateau on 5/5/2016.
|
||||||
// Copyright 2016 High Fidelity, Inc.
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,12 +10,13 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
|
||||||
<@include LightingModel.slh@>
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
|
|
||||||
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
<@include LightingModel.slh@>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO)$>
|
<$declareMaterialTextures(ALBEDO)$>
|
||||||
|
|
||||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
||||||
|
@ -27,7 +26,6 @@ layout(location=RENDER_UTILS_ATTR_NORMAL_WS) in vec3 _normalWS;
|
||||||
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
Material mat = getMaterial();
|
Material mat = getMaterial();
|
||||||
BITFIELD matKey = getMaterialKey(mat);
|
BITFIELD matKey = getMaterialKey(mat);
|
||||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex)$>
|
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex)$>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<@include gpu/Config.slh@>
|
<@include gpu/Config.slh@>
|
||||||
<$VERSION_HEADER$>
|
<$VERSION_HEADER$>
|
||||||
|
// <$_SCRIBE_FILENAME$>
|
||||||
// Generated on <$_SCRIBE_DATE$>
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
//
|
//
|
||||||
// model_unlit_fade.frag
|
|
||||||
// fragment shader
|
|
||||||
//
|
|
||||||
// Created by Olivier Prat on 06/05/17.
|
// Created by Olivier Prat on 06/05/17.
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -12,13 +10,14 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include DeferredBufferWrite.slh@>
|
|
||||||
<@include LightingModel.slh@>
|
|
||||||
<@include graphics/Material.slh@>
|
<@include graphics/Material.slh@>
|
||||||
<@include graphics/MaterialTextures.slh@>
|
<@include graphics/MaterialTextures.slh@>
|
||||||
<@include render-utils/ShaderConstants.h@>
|
<@include render-utils/ShaderConstants.h@>
|
||||||
<@include Fade.slh@>
|
|
||||||
|
|
||||||
|
<@include DeferredBufferWrite.slh@>
|
||||||
|
<@include LightingModel.slh@>
|
||||||
|
|
||||||
|
<@include Fade.slh@>
|
||||||
<$declareFadeFragment()$>
|
<$declareFadeFragment()$>
|
||||||
|
|
||||||
<$declareMaterialTextures(ALBEDO)$>
|
<$declareMaterialTextures(ALBEDO)$>
|
||||||
|
@ -33,7 +32,6 @@ layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec3 fadeEmissive;
|
vec3 fadeEmissive;
|
||||||
FadeObjectParams fadeParams;
|
FadeObjectParams fadeParams;
|
||||||
|
|
||||||
<$fetchFadeObjectParams(fadeParams)$>
|
<$fetchFadeObjectParams(fadeParams)$>
|
||||||
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
||||||
|
|
||||||
|
@ -49,6 +47,7 @@ void main(void) {
|
||||||
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
<$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>;
|
||||||
albedo *= _color.rgb;
|
albedo *= _color.rgb;
|
||||||
albedo += fadeEmissive;
|
albedo += fadeEmissive;
|
||||||
|
|
||||||
packDeferredFragmentUnlit(
|
packDeferredFragmentUnlit(
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
opacity,
|
opacity,
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
layout(location=0) in vec4 _color;
|
layout(location=0) in vec4 _color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), _color.a, _color.rgb, DEFAULT_FRESNEL, DEFAULT_ROUGHNESS);
|
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), _color.a, _color.rgb, DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,5 @@ void main() {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
a * params.color.a,
|
a * params.color.a,
|
||||||
params.color.rgb,
|
params.color.rgb,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
|
@ -65,7 +65,6 @@ void main(void) {
|
||||||
diffuse,
|
diffuse,
|
||||||
max(0.0, 1.0 - shininess / 128.0),
|
max(0.0, 1.0 - shininess / 128.0),
|
||||||
DEFAULT_METALLIC,
|
DEFAULT_METALLIC,
|
||||||
specular,
|
|
||||||
vec3(clamp(emissiveAmount, 0.0, 1.0)));
|
vec3(clamp(emissiveAmount, 0.0, 1.0)));
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
|
|
|
@ -75,14 +75,12 @@ void main(void) {
|
||||||
normal,
|
normal,
|
||||||
_color.a,
|
_color.a,
|
||||||
specular+fadeEmissive,
|
specular+fadeEmissive,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragmentTranslucent(
|
packDeferredFragmentTranslucent(
|
||||||
normal,
|
normal,
|
||||||
_color.a,
|
_color.a,
|
||||||
diffuse+fadeEmissive,
|
diffuse+fadeEmissive,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +91,6 @@ void main(void) {
|
||||||
diffuse+fadeEmissive,
|
diffuse+fadeEmissive,
|
||||||
max(0.0, 1.0 - shininess / 128.0),
|
max(0.0, 1.0 - shininess / 128.0),
|
||||||
DEFAULT_METALLIC,
|
DEFAULT_METALLIC,
|
||||||
specular,
|
|
||||||
specular);
|
specular);
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
|
|
|
@ -53,7 +53,6 @@ void main(void) {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
colorAlpha * texel.a,
|
colorAlpha * texel.a,
|
||||||
_color.rgb * texel.rgb + fadeEmissive,
|
_color.rgb * texel.rgb + fadeEmissive,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
|
|
|
@ -41,7 +41,6 @@ void main(void) {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
colorAlpha * texel.a,
|
colorAlpha * texel.a,
|
||||||
_color.rgb * texel.rgb,
|
_color.rgb * texel.rgb,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragmentUnlit(
|
packDeferredFragmentUnlit(
|
||||||
|
|
|
@ -53,7 +53,6 @@ void main(void) {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
colorAlpha * texel.a,
|
colorAlpha * texel.a,
|
||||||
_color.rgb * texel.rgb+fadeEmissive,
|
_color.rgb * texel.rgb+fadeEmissive,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
} else {
|
} else {
|
||||||
packDeferredFragmentUnlit(
|
packDeferredFragmentUnlit(
|
||||||
|
|
|
@ -34,6 +34,5 @@ void main(void) {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
colorAlpha,
|
colorAlpha,
|
||||||
_color.rgb * texel.rgb,
|
_color.rgb * texel.rgb,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
|
@ -34,6 +34,5 @@ void main(void) {
|
||||||
normalize(_normalWS),
|
normalize(_normalWS),
|
||||||
_color.a,
|
_color.a,
|
||||||
_color.rgb * texel.rgb,
|
_color.rgb * texel.rgb,
|
||||||
DEFAULT_FRESNEL,
|
|
||||||
DEFAULT_ROUGHNESS);
|
DEFAULT_ROUGHNESS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue