mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
few shader updates.
This commit is contained in:
@@ -3,12 +3,10 @@ out vec4 FragColor;
|
||||
in vec3 WorldPos;
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
uniform float lod;
|
||||
|
||||
void main()
|
||||
{
|
||||
// vec3 envColor = textureLod(environmentMap, WorldPos, 1.0).rgb;
|
||||
vec3 envColor = textureLod(environmentMap, WorldPos, lod).rgb;
|
||||
vec3 envColor = textureLod(environmentMap, WorldPos, 0.0).rgb;
|
||||
|
||||
// HDR tonemap and gamma correct
|
||||
envColor = envColor / (envColor + vec3(1.0));
|
||||
|
||||
@@ -8,16 +8,11 @@ const float PI = 3.14159265359f;
|
||||
|
||||
void main()
|
||||
{
|
||||
// NOTE(Joey): the world vector acts as the normal of a tangent surface
|
||||
// from the origin, aligned to WorldPos. Given this normal, calculate all
|
||||
// incoming radiance of the environment. The result of this radiance
|
||||
// is the radiance of light coming from -Normal direction, which is what
|
||||
// we use in the PBR shader to sample irradiance.
|
||||
vec3 N = normalize(WorldPos);
|
||||
|
||||
vec3 irradiance = vec3(0.0);
|
||||
|
||||
// NOTE(Joey): tangent space calculation from origin point
|
||||
// tangent space calculation from origin point
|
||||
vec3 up = vec3(0.0, 1.0, 0.0);
|
||||
vec3 right = cross(up, N);
|
||||
up = cross(N, right);
|
||||
|
||||
Reference in New Issue
Block a user