mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
Polishing the scope shaders
This commit is contained in:
parent
966afa1e4a
commit
5edcc38eba
7 changed files with 122 additions and 101 deletions
|
@ -25,6 +25,8 @@ typedef glm::vec3 Color;
|
||||||
|
|
||||||
class Skybox {
|
class Skybox {
|
||||||
public:
|
public:
|
||||||
|
typedef gpu::BufferView UniformBufferView;
|
||||||
|
|
||||||
Skybox();
|
Skybox();
|
||||||
Skybox& operator= (const Skybox& skybox);
|
Skybox& operator= (const Skybox& skybox);
|
||||||
virtual ~Skybox() {};
|
virtual ~Skybox() {};
|
||||||
|
@ -43,6 +45,8 @@ public:
|
||||||
|
|
||||||
static void render(gpu::Batch& batch, const ViewFrustum& frustum, const Skybox& skybox);
|
static void render(gpu::Batch& batch, const ViewFrustum& frustum, const Skybox& skybox);
|
||||||
|
|
||||||
|
const UniformBufferView& getSchemaBuffer() const { return _schemaBuffer; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int SKYBOX_SKYMAP_SLOT { 0 };
|
static const int SKYBOX_SKYMAP_SLOT { 0 };
|
||||||
static const int SKYBOX_CONSTANTS_SLOT { 0 };
|
static const int SKYBOX_CONSTANTS_SLOT { 0 };
|
||||||
|
|
|
@ -62,21 +62,21 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
||||||
|
|
||||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||||
if (!_keyLightPipeline) {
|
if (!_keyLightPipeline) {
|
||||||
auto vs = gpu::StandardShaderLib::getDrawTransformUnitQuadVS();
|
auto vs = gpu::StandardShaderLib::getDrawTransformUnitQuadVS();
|
||||||
auto ps = gpu::Shader::createPixel(std::string(zone_drawKeyLight_frag));
|
auto ps = gpu::Shader::createPixel(std::string(zone_drawKeyLight_frag));
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps);
|
gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps);
|
||||||
|
|
||||||
gpu::Shader::BindingSet slotBindings;
|
gpu::Shader::BindingSet slotBindings;
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
|
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), ZONE_KEYLIGHT_BUFFER));
|
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), ZONE_KEYLIGHT_BUFFER));
|
||||||
|
|
||||||
gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||||
|
|
||||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||||
_keyLightPipeline = gpu::Pipeline::create(program, state);
|
_keyLightPipeline = gpu::Pipeline::create(program, state);
|
||||||
}
|
}
|
||||||
return _keyLightPipeline;
|
return _keyLightPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ const gpu::PipelinePointer& DebugZoneLighting::getBackgroundPipeline() {
|
||||||
gpu::Shader::BindingSet slotBindings;
|
gpu::Shader::BindingSet slotBindings;
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
|
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), ZONE_SKYBOX_MAP));
|
slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), ZONE_SKYBOX_MAP));
|
||||||
|
slotBindings.insert(gpu::Shader::Binding(std::string("skyboxBuffer"), ZONE_SKYBOX_BUFFER));
|
||||||
|
|
||||||
gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||||
|
@ -126,13 +127,13 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
|
||||||
auto deferredTransform = inputs;
|
auto deferredTransform = inputs;
|
||||||
|
|
||||||
auto lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage();
|
auto lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage();
|
||||||
model::LightPointer keyLight;
|
model::LightPointer keyLight;
|
||||||
if (lightStage && lightStage->_currentFrame._sunLights.size()) {
|
if (lightStage && lightStage->_currentFrame._sunLights.size()) {
|
||||||
keyLight = lightStage->getLight(lightStage->_currentFrame._sunLights.front());
|
keyLight = lightStage->getLight(lightStage->_currentFrame._sunLights.front());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
keyLight = DependencyManager::get<DeferredLightingEffect>()->getGlobalLight();
|
keyLight = DependencyManager::get<DeferredLightingEffect>()->getGlobalLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
model::LightPointer keyAmbiLight;
|
model::LightPointer keyAmbiLight;
|
||||||
if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
|
if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
|
||||||
|
@ -163,17 +164,17 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
|
||||||
|
|
||||||
batch.setUniformBuffer(ZONE_DEFERRED_TRANSFORM_BUFFER, deferredTransform->getFrameTransformBuffer());
|
batch.setUniformBuffer(ZONE_DEFERRED_TRANSFORM_BUFFER, deferredTransform->getFrameTransformBuffer());
|
||||||
|
|
||||||
batch.setPipeline(getKeyLightPipeline());
|
batch.setPipeline(getKeyLightPipeline());
|
||||||
model.setTranslation(glm::vec3(-4.0, -3.0, -10.0));
|
model.setTranslation(glm::vec3(-4.0, -3.0, -10.0));
|
||||||
batch.setModelTransform(model);
|
batch.setModelTransform(model);
|
||||||
if (keyLight) {
|
if (keyLight) {
|
||||||
batch.setUniformBuffer(ZONE_KEYLIGHT_BUFFER, keyLight->getLightSchemaBuffer());
|
batch.setUniformBuffer(ZONE_KEYLIGHT_BUFFER, keyLight->getLightSchemaBuffer());
|
||||||
}
|
}
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
|
|
||||||
batch.setPipeline(getAmbientPipeline());
|
batch.setPipeline(getAmbientPipeline());
|
||||||
model.setTranslation(glm::vec3(-4.0, 0.0, -10.0));
|
model.setTranslation(glm::vec3(-4.0, 0.0, -10.0));
|
||||||
batch.setModelTransform(model);
|
batch.setModelTransform(model);
|
||||||
if (keyAmbiLight) {
|
if (keyAmbiLight) {
|
||||||
batch.setUniformBuffer(ZONE_AMBIENT_BUFFER, keyAmbiLight->getAmbientSchemaBuffer());
|
batch.setUniformBuffer(ZONE_AMBIENT_BUFFER, keyAmbiLight->getAmbientSchemaBuffer());
|
||||||
|
|
||||||
|
@ -188,6 +189,7 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
|
||||||
batch.setModelTransform(model);
|
batch.setModelTransform(model);
|
||||||
if (skybox) {
|
if (skybox) {
|
||||||
batch.setResourceTexture(ZONE_SKYBOX_MAP, skybox->getCubemap());
|
batch.setResourceTexture(ZONE_SKYBOX_MAP, skybox->getCubemap());
|
||||||
|
batch.setUniformBuffer(ZONE_SKYBOX_BUFFER, skybox->getSchemaBuffer());
|
||||||
}
|
}
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,10 @@ protected:
|
||||||
|
|
||||||
enum Slots {
|
enum Slots {
|
||||||
ZONE_DEFERRED_TRANSFORM_BUFFER = 0,
|
ZONE_DEFERRED_TRANSFORM_BUFFER = 0,
|
||||||
ZONE_KEYLIGHT_BUFFER,
|
ZONE_KEYLIGHT_BUFFER,
|
||||||
ZONE_AMBIENT_BUFFER,
|
ZONE_AMBIENT_BUFFER,
|
||||||
ZONE_AMBIENT_MAP,
|
ZONE_AMBIENT_MAP,
|
||||||
|
ZONE_SKYBOX_BUFFER,
|
||||||
ZONE_SKYBOX_MAP,
|
ZONE_SKYBOX_MAP,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
37
libraries/render-utils/src/zone_draw.slh
Normal file
37
libraries/render-utils/src/zone_draw.slh
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
// Generated on <$_SCRIBE_DATE$>
|
||||||
|
//
|
||||||
|
// Created by Sam Gateau on 5/17/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 DeferredTransform.slh@>
|
||||||
|
<$declareDeferredFrameTransform()$>
|
||||||
|
|
||||||
|
<@func evalGlobeWidget()@>
|
||||||
|
const float SCOPE_RADIUS = 1.0;
|
||||||
|
const float SCOPE_RADIUS2 = SCOPE_RADIUS * SCOPE_RADIUS;
|
||||||
|
const float EDGE_HALFWIDTH = 0.025;
|
||||||
|
const float EDGE_HALFWIDTH2 = EDGE_HALFWIDTH * EDGE_HALFWIDTH;
|
||||||
|
const float OUT_RADIUS = SCOPE_RADIUS + EDGE_HALFWIDTH;
|
||||||
|
|
||||||
|
vec2 sphereUV = (varTexCoord0.xy * 2.0 - vec2(1.0)) * OUT_RADIUS;
|
||||||
|
float sphereR2 = dot(sphereUV.xy, sphereUV.xy);
|
||||||
|
if (sphereR2 > OUT_RADIUS * OUT_RADIUS) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
float sphereR = sqrt(sphereR2);
|
||||||
|
|
||||||
|
float edgeFalloff = (SCOPE_RADIUS - sphereR) / (EDGE_HALFWIDTH);
|
||||||
|
float edgeFalloff2 = min(1.0, edgeFalloff * edgeFalloff);
|
||||||
|
|
||||||
|
vec4 base = vec4(0.0, 0.0, 0.0, 1.0 - edgeFalloff2);
|
||||||
|
if (sphereR2 > SCOPE_RADIUS2) {
|
||||||
|
_fragColor = base;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<@endfunc@>
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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 zone_draw.slh@>
|
||||||
<@include DeferredTransform.slh@>
|
|
||||||
<$declareDeferredFrameTransform()$>
|
|
||||||
|
|
||||||
<@include model/Light.slh@>
|
<@include model/Light.slh@>
|
||||||
|
|
||||||
|
@ -26,20 +24,8 @@ out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
const float INNER_RADIUS = 1.0;
|
<$evalGlobeWidget()$>
|
||||||
const float INNER_RADIUS2 = INNER_RADIUS * INNER_RADIUS;
|
|
||||||
const float OUTER_RADIUS = 1.05;
|
|
||||||
const float OUTER_RADIUS2 = OUTER_RADIUS * OUTER_RADIUS;
|
|
||||||
vec2 sphereUV = (varTexCoord0.xy * 2.0 - vec2(1.0)) * OUTER_RADIUS;
|
|
||||||
float sphereR2 = dot(sphereUV.xy, sphereUV.xy);
|
|
||||||
if (sphereR2 > OUTER_RADIUS * OUTER_RADIUS) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
if (sphereR2 > INNER_RADIUS2) {
|
|
||||||
float falloff = (sphereR2 - OUTER_RADIUS2) / (OUTER_RADIUS2 - INNER_RADIUS2);
|
|
||||||
_fragColor = vec4(0.0, 0.0, 0.0, falloff * falloff);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vec3 spherePos = normalize(vec3(sphereUV, sqrt(1.0 - sphereR2)));
|
vec3 spherePos = normalize(vec3(sphereUV, sqrt(1.0 - sphereR2)));
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,10 +44,11 @@ void main(void) {
|
||||||
// vec3 ambient = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
|
// vec3 ambient = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
|
||||||
// _fragColor = vec4( 0.5 * (fragNormal + vec3(1.0)), 1.0);
|
// _fragColor = vec4( 0.5 * (fragNormal + vec3(1.0)), 1.0);
|
||||||
|
|
||||||
vec3 ambient = (sphereUV.x > 0 ? ambientMap : ambientSH);
|
vec3 color = (sphereUV.x > 0 ? ambientMap : ambientSH);
|
||||||
|
|
||||||
|
color = color * 1.0 - base.w + base.xyz * base.w;
|
||||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||||
_fragColor = vec4(pow(ambient, vec3(INV_GAMMA_22)), 1.0);
|
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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 zone_draw.slh@>
|
||||||
<@include DeferredTransform.slh@>
|
|
||||||
<$declareDeferredFrameTransform()$>
|
|
||||||
|
|
||||||
<@include model/Light.slh@>
|
<@include model/Light.slh@>
|
||||||
|
|
||||||
|
@ -25,33 +23,31 @@ out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
const float INNER_RADIUS = 1.0;
|
<$evalGlobeWidget()$>
|
||||||
const float INNER_RADIUS2 = INNER_RADIUS * INNER_RADIUS;
|
|
||||||
const float OUTER_RADIUS = 1.05;
|
|
||||||
const float OUTER_RADIUS2 = OUTER_RADIUS * OUTER_RADIUS;
|
|
||||||
vec2 sphereUV = (varTexCoord0.xy * 2.0 - vec2(1.0)) * OUTER_RADIUS;
|
|
||||||
float sphereR2 = dot(sphereUV.xy, sphereUV.xy);
|
|
||||||
if (sphereR2 > OUTER_RADIUS * OUTER_RADIUS) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
if (sphereR2 > INNER_RADIUS2) {
|
|
||||||
float falloff = (sphereR2 - OUTER_RADIUS2) / (OUTER_RADIUS2 - INNER_RADIUS2);
|
|
||||||
_fragColor = vec4(0.0, 0.0, 0.0, falloff * falloff);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vec3 spherePos = normalize(vec3(sphereUV, sqrt(1.0 - sphereR2)));
|
|
||||||
|
|
||||||
|
|
||||||
vec3 fragNormal = vec3(getViewInverse() * vec4(spherePos, 0.0));
|
|
||||||
|
|
||||||
|
|
||||||
Light light = getLight();
|
Light light = getLight();
|
||||||
|
vec3 lightDirection = getLightDirection(light);
|
||||||
vec3 lightDirection = getLightDirection(light);
|
|
||||||
vec3 lightIrradiance = getLightIrradiance(light);
|
vec3 lightIrradiance = getLightIrradiance(light);
|
||||||
|
vec3 color = vec3(0.0);
|
||||||
|
|
||||||
|
const float INOUT_RATIO = 0.4;
|
||||||
|
const float SUN_THRESHOLD = 0.99;
|
||||||
|
|
||||||
vec3 color = lightIrradiance;
|
vec3 outSpherePos = normalize(vec3(sphereUV, -sqrt(1.0 - sphereR2)));
|
||||||
|
vec3 outNormal = vec3(getViewInverse() * vec4(outSpherePos, 0.0));
|
||||||
|
float val = step(SUN_THRESHOLD, dot(-lightDirection, outNormal));
|
||||||
|
|
||||||
|
color = lightIrradiance * vec3(val);
|
||||||
|
|
||||||
|
if (sphereR2 < INOUT_RATIO * INOUT_RATIO * SCOPE_RADIUS2) {
|
||||||
|
vec2 inSphereUV = sphereUV / INOUT_RATIO;
|
||||||
|
vec3 inSpherePos = normalize(vec3(inSphereUV, sqrt(1.0 - dot(inSphereUV.xy, inSphereUV.xy))));
|
||||||
|
vec3 inNormal = vec3(getViewInverse() * vec4(inSpherePos, 0.0));
|
||||||
|
|
||||||
|
color += lightIrradiance * vec3(dot(-lightDirection, inNormal));
|
||||||
|
}
|
||||||
|
|
||||||
|
color = color * 1.0 - base.w + base.xyz * base.w;
|
||||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||||
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,47 +8,41 @@
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// 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 zone_draw.slh@>
|
||||||
|
|
||||||
<@include DeferredTransform.slh@>
|
|
||||||
<$declareDeferredFrameTransform()$>
|
|
||||||
|
|
||||||
// declareSkyboxMap
|
|
||||||
uniform samplerCube skyboxMap;
|
uniform samplerCube skyboxMap;
|
||||||
|
|
||||||
vec4 evalSkyboxLight(vec3 direction, float lod) {
|
struct Skybox {
|
||||||
// textureQueryLevels is not available until #430, so we require explicit lod
|
vec4 color;
|
||||||
// float mipmapLevel = lod * textureQueryLevels(skyboxMap);
|
};
|
||||||
return textureLod(skyboxMap, direction, lod);
|
|
||||||
}
|
uniform skyboxBuffer {
|
||||||
|
Skybox skybox;
|
||||||
|
};
|
||||||
|
|
||||||
in vec2 varTexCoord0;
|
in vec2 varTexCoord0;
|
||||||
out vec4 _fragColor;
|
out vec4 _fragColor;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
<$evalGlobeWidget()$>
|
||||||
|
|
||||||
const float INNER_RADIUS = 1.0;
|
|
||||||
const float INNER_RADIUS2 = INNER_RADIUS * INNER_RADIUS;
|
|
||||||
const float OUTER_RADIUS = 1.05;
|
|
||||||
const float OUTER_RADIUS2 = OUTER_RADIUS * OUTER_RADIUS;
|
|
||||||
vec2 sphereUV = (varTexCoord0.xy * 2.0 - vec2(1.0)) * OUTER_RADIUS;
|
|
||||||
float sphereR2 = dot(sphereUV.xy, sphereUV.xy);
|
|
||||||
if (sphereR2 > OUTER_RADIUS * OUTER_RADIUS) {
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
if (sphereR2 > INNER_RADIUS2) {
|
|
||||||
float falloff = (sphereR2 - OUTER_RADIUS2) / (OUTER_RADIUS2 - INNER_RADIUS2);
|
|
||||||
_fragColor = vec4(0.0, 0.0, 0.0, falloff * falloff);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vec3 spherePos = normalize(vec3(sphereUV, -sqrt(1.0 - sphereR2)));
|
vec3 spherePos = normalize(vec3(sphereUV, -sqrt(1.0 - sphereR2)));
|
||||||
|
|
||||||
vec3 fragNormal = vec3(getViewInverse() * vec4(spherePos, 0.0));
|
vec3 direction = vec3(getViewInverse() * vec4(spherePos, 0.0));
|
||||||
|
|
||||||
float lod = 0;
|
vec3 color = skybox.color.rgb;
|
||||||
vec3 ambient = evalSkyboxLight(fragNormal, lod).xyz;
|
|
||||||
|
|
||||||
|
// blend is only set if there is a cubemap
|
||||||
|
if (skybox.color.a > 0.0) {
|
||||||
|
color = texture(skyboxMap, direction).rgb;
|
||||||
|
if (skybox.color.a < 1.0) {
|
||||||
|
color *= skybox.color.rgb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color = color * 1.0 - base.w + base.xyz * base.w;
|
||||||
const float INV_GAMMA_22 = 1.0 / 2.2;
|
const float INV_GAMMA_22 = 1.0 / 2.2;
|
||||||
_fragColor = vec4(pow(ambient, vec3(INV_GAMMA_22)), 1.0);
|
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue