mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-16 08:50:54 +02:00
24 lines
532 B
GLSL
24 lines
532 B
GLSL
//
|
|
// Atmospheric scattering fragment shader
|
|
//
|
|
// Author: Sean O'Neil
|
|
//
|
|
// Copyright (c) 2004 Sean O'Neil
|
|
//
|
|
|
|
#version 120
|
|
|
|
uniform vec3 v3LightPos;
|
|
uniform float g;
|
|
uniform float g2;
|
|
|
|
varying vec3 v3Direction;
|
|
|
|
|
|
void main (void)
|
|
{
|
|
float fCos = dot(v3LightPos, v3Direction) / length(v3Direction);
|
|
float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos*fCos) / pow(1.0 + g2 - 2.0*g*fCos, 1.5);
|
|
gl_FragColor = gl_Color + fMiePhase * gl_SecondaryColor;
|
|
gl_FragColor.a = 1.0; // gl_FragColor.b;
|
|
}
|