Urho3D/bin/CoreData/Shaders/GLSL/Skybox.glsl
gleblebedev 609f7de618
New PBR techniques. New PBR terrain shader. Skybox shader fixed. (#2655)
* New PBR techniques. New PBR terrain shader. Skybox shader fixed.

* Bug fix in original terrain and missing techniques.

* PR cleanup

* Skybox.glsl cleanup

* Terrain added to PBR sample
2020-07-02 11:19:43 +03:00

32 lines
827 B
GLSL

#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
varying vec3 vTexCoord;
void VS()
{
#ifdef IGNORENODETRANSFORM
mat4 modelMatrix = transpose(mat4(
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
transpose(cViewInv)[3]));
#else
mat4 modelMatrix = iModelMatrix;
#endif
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
gl_Position.z = gl_Position.w;
vTexCoord = iPos.xyz;
}
void PS()
{
vec4 sky = cMatDiffColor * textureCube(sDiffCubeMap, vTexCoord);
#ifdef HDRSCALE
sky = pow(sky + clamp((cAmbientColor.a - 1.0) * 0.1, 0.0, 0.25), max(vec4(cAmbientColor.a), 1.0)) * clamp(cAmbientColor.a, 0.0, 1.0);
#endif
gl_FragColor = sky;
}