mirror of
https://github.com/overte-org/overte.git
synced 2025-07-15 04:56:46 +02:00
55 lines
1.6 KiB
Text
55 lines
1.6 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// Created by Sam Gateau on 5/16/17.
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
// Copyright 2024 Overte e.V.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
<@include zone_draw.slh@>
|
|
|
|
<@include graphics/Light.slh@>
|
|
|
|
<@include LightingModel.slh@>
|
|
<$declareLightAmbientBuffer()$>
|
|
|
|
<@include LightAmbient.slh@>
|
|
|
|
<$declareLightingAmbient(_SCRIBE_NULL, 1, _SCRIBE_NULL, _SCRIBE_NULL)$>
|
|
|
|
layout(location=0) in vec2 varTexCoord0;
|
|
layout(location=0) out vec4 _fragColor;
|
|
|
|
void main(void) {
|
|
|
|
<$evalGlobeWidget()$>
|
|
|
|
vec3 spherePos = normalize(vec3(sphereUV, sqrt(1.0 - sphereR2)));
|
|
|
|
|
|
vec3 fragNormal = vec3(getViewInverse(getStereoSideFromFragCoord()) * vec4(spherePos, 0.0));
|
|
|
|
|
|
LightAmbient lightAmbient = getLightAmbient();
|
|
|
|
|
|
float roughness = 0.1;
|
|
float levels = getLightAmbientMapNumMips(lightAmbient);
|
|
float lod = min(((roughness)* levels), levels);
|
|
vec3 ambientMap = evalSkyboxLight(fragNormal, lod).xyz;
|
|
vec3 ambientSH = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
|
|
|
|
// _fragColor = vec4( 0.5 * (fragNormal + vec3(1.0)), 1.0);
|
|
|
|
vec3 color = mix(ambientSH, ambientMap, float(sphereUV.x > 0.0));
|
|
color = applySkyboxColorMix(color, getLightAmbientColor(lightAmbient), getLightAmbientBlend(lightAmbient));
|
|
|
|
color = color * 1.0 - base.w + base.xyz * base.w;
|
|
const float INV_GAMMA_22 = 1.0 / 2.2;
|
|
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
|
}
|
|
|
|
|