mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
cleanup and fixing some issues
This commit is contained in:
parent
6111c8a108
commit
476f0ed012
5 changed files with 26 additions and 14 deletions
|
@ -122,7 +122,7 @@ void GridEntityRenderer::doRender(RenderArgs* args) {
|
|||
forward = _renderLayer != RenderLayer::WORLD || args->_renderMethod == Args::RenderMethod::FORWARD;
|
||||
});
|
||||
|
||||
if (!_visible) {
|
||||
if (!_visible || color.a == 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void main(void) {
|
|||
DEFAULT_METALLIC,
|
||||
DEFAULT_EMISSIVE
|
||||
<@if HIFI_USE_FADE@>
|
||||
+ fadeEmissive
|
||||
+ fadeEmissive
|
||||
<@endif@>
|
||||
,
|
||||
DEFAULT_OCCLUSION,
|
||||
|
|
|
@ -33,21 +33,20 @@ layout(location=GPU_ATTR_TEXCOORD0) in vec2 varTexCoord0;
|
|||
layout(location=GPU_ATTR_COLOR) in vec4 varColor;
|
||||
|
||||
void main(void) {
|
||||
float alpha = mix(paintGridMajorMinor(varTexCoord0, grid.offset, grid.period, grid.edge),
|
||||
float gridLine = mix(paintGridMajorMinor(varTexCoord0, grid.offset, grid.period, grid.edge),
|
||||
paintGrid(varTexCoord0, grid.offset.xy, grid.period.xy, grid.edge.xy),
|
||||
float(grid.edge.z == 0.0));
|
||||
if (gridLine <= 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
<@if not HIFI_USE_FORWARD@>
|
||||
<@if not HIFI_USE_TRANSLUCENT@>
|
||||
packDeferredFragmentUnlit(vec3(1.0, 0.0, 0.0), alpha, varColor.rgb);
|
||||
packDeferredFragmentUnlit(vec3(1.0, 0.0, 0.0), 1.0, varColor.rgb);
|
||||
<@else@>
|
||||
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), alpha, varColor.rgb, DEFAULT_ROUGHNESS);
|
||||
packDeferredFragmentTranslucent(vec3(1.0, 0.0, 0.0), varColor.a, varColor.rgb, DEFAULT_ROUGHNESS);
|
||||
<@endif@>
|
||||
<@else@>
|
||||
const float EPSILON = 0.0001;
|
||||
if (alpha < EPSILON) {
|
||||
discard;
|
||||
}
|
||||
_fragColor0 = vec4(varColor.rgb, alpha);
|
||||
_fragColor0 = varColor;
|
||||
<@endif@>
|
||||
}
|
||||
|
|
|
@ -104,7 +104,11 @@ void main(void) {
|
|||
<@if HIFI_USE_SHADOW or HIFI_USE_UNLIT@>
|
||||
<$fetchMaterialTexturesCoord0(matKey, _texCoord0, albedoTex)$>
|
||||
|
||||
<@if HIFI_USE_TRANSLUCENT@>
|
||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||
<@else@>
|
||||
float opacity = 1.0;
|
||||
<@endif@>
|
||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||
<@if HIFI_USE_TRANSLUCENT@>
|
||||
<$discardInvisible(opacity)$>;
|
||||
|
@ -152,7 +156,11 @@ void main(void) {
|
|||
<$fetchMaterialTexturesCoord1(matKey, _texCoord1, _SCRIBE_NULL, lightmap)$>
|
||||
<@endif@>
|
||||
|
||||
<@if HIFI_USE_TRANSLUCENT@>
|
||||
float opacity = getMaterialOpacity(mat) * _color.a;
|
||||
<@else@>
|
||||
float opacity = 1.0;
|
||||
<@endif@>
|
||||
<$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)$>;
|
||||
<@if HIFI_USE_TRANSLUCENT@>
|
||||
<$discardInvisible(opacity)$>;
|
||||
|
@ -301,7 +309,7 @@ void main(void) {
|
|||
metallic,
|
||||
emissive
|
||||
<@if HIFI_USE_FADE@>
|
||||
+ fadeEmissive
|
||||
+ fadeEmissive
|
||||
<@endif@>
|
||||
,
|
||||
surfaceWS, opacity, localLighting.rgb),
|
||||
|
|
|
@ -17,14 +17,18 @@
|
|||
|
||||
<@include render-utils/ShaderConstants.h@>
|
||||
|
||||
<@if HIFI_USE_FADE@>
|
||||
<@include Fade.slh@>
|
||||
<$declareFadeVertexInstanced()$>
|
||||
|
||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS;
|
||||
<@endif@>
|
||||
|
||||
<@if not HIFI_USE_UNLIT@>
|
||||
<@if HIFI_USE_FORWARD or HIFI_USE_TRANSLUCENT@>
|
||||
layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES;
|
||||
<@endif@>
|
||||
<@endif@>
|
||||
<@if HIFI_USE_FADE@>
|
||||
layout(location=RENDER_UTILS_ATTR_POSITION_WS) out vec4 _positionWS;
|
||||
<@endif@>
|
||||
layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS;
|
||||
layout(location=RENDER_UTILS_ATTR_COLOR) out vec4 _color;
|
||||
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01;
|
||||
|
@ -47,6 +51,7 @@ void main(void) {
|
|||
|
||||
<@if HIFI_USE_FADE@>
|
||||
<$transformModelToWorldPos(obj, inPosition, _positionWS)$>
|
||||
<$passThroughFadeObjectParams()$>
|
||||
<@endif@>
|
||||
<$transformModelToWorldDir(cam, obj, inNormal.xyz, _normalWS)$>
|
||||
}
|
Loading…
Reference in a new issue