forked from LeenkxTeam/LNXSDK
Update leenkx/Shaders/std/constants.glsl
This commit is contained in:
@ -1,13 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2024 Turánszki János
|
Copyright (c) 2024 Turánszki János
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
@ -23,25 +26,34 @@ const float SHADOW_CONE_APERTURE = radians(15.0);
|
|||||||
|
|
||||||
const float DIFFUSE_CONE_APERTURE = radians(50.0);
|
const float DIFFUSE_CONE_APERTURE = radians(50.0);
|
||||||
|
|
||||||
const vec3 DIFFUSE_CONE_DIRECTIONS[16] = vec3[](
|
const vec3 DIFFUSE_CONE_DIRECTIONS[DIFFUSE_CONE_COUNT] = vec3[](
|
||||||
vec3( 0.0000, 0.0000, 1.0000),
|
vec3(0.0, 0.0, 1.0), // center
|
||||||
vec3( 0.7236, 0.5257, 0.4472),
|
|
||||||
vec3(-0.2764, 0.8506, 0.4472),
|
vec3(0.0, 0.5, 0.866),
|
||||||
vec3(-0.8944, 0.0000, 0.4472),
|
vec3(0.5, 0.0, 0.866),
|
||||||
vec3(-0.2764, -0.8506, 0.4472),
|
vec3(0.0, -0.5, 0.866),
|
||||||
vec3( 0.7236, -0.5257, 0.4472),
|
vec3(-0.5, 0.0, 0.866),
|
||||||
vec3( 0.7236, 0.5257, -0.4472),
|
|
||||||
vec3(-0.2764, 0.8506, -0.4472),
|
vec3(0.353, 0.353, 0.866),
|
||||||
vec3(-0.8944, 0.0000, -0.4472),
|
vec3(0.353, -0.353, 0.866),
|
||||||
vec3(-0.2764, -0.8506, -0.4472),
|
vec3(-0.353, -0.353, 0.866),
|
||||||
vec3( 0.7236, -0.5257, -0.4472),
|
vec3(-0.353, 0.353, 0.866),
|
||||||
vec3( 0.2764, 0.8506, 0.4472),
|
|
||||||
vec3(-0.7236, 0.5257, 0.4472),
|
vec3(0.707, 0.0, 0.707),
|
||||||
vec3(-0.7236, -0.5257, 0.4472),
|
vec3(0.0, 0.707, 0.707),
|
||||||
vec3( 0.2764, -0.8506, 0.4472),
|
vec3(-0.707, 0.0, 0.707),
|
||||||
vec3( 0.0000, 0.0000, -1.0000)
|
vec3(0.0, -0.707, 0.707),
|
||||||
|
|
||||||
|
vec3(0.5, 0.5, 0.707),
|
||||||
|
vec3(-0.5, 0.5, 0.707),
|
||||||
|
vec3(-0.5, -0.5, 0.707)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mat3 makeTangentBasis(vec3 normal) {
|
||||||
|
vec3 tangent = normalize(abs(normal.y) < 0.999 ? cross(normal, vec3(0, 1, 0)) : cross(normal, vec3(1, 0, 0)));
|
||||||
|
vec3 bitangent = cross(normal, tangent);
|
||||||
|
return mat3(tangent, bitangent, normal);
|
||||||
|
}
|
||||||
|
|
||||||
const float BayerMatrix8[8][8] =
|
const float BayerMatrix8[8][8] =
|
||||||
{
|
{
|
||||||
@ -53,4 +65,4 @@ const float BayerMatrix8[8][8] =
|
|||||||
{ 35.0 / 65.0, 19.0 / 65.0, 47.0 / 65.0, 31.0 / 65.0, 34.0 / 65.0, 18.0 / 65.0, 46.0 / 65.0, 30.0 / 65.0 },
|
{ 35.0 / 65.0, 19.0 / 65.0, 47.0 / 65.0, 31.0 / 65.0, 34.0 / 65.0, 18.0 / 65.0, 46.0 / 65.0, 30.0 / 65.0 },
|
||||||
{ 11.0 / 65.0, 59.0 / 65.0, 7.0 / 65.0, 55.0 / 65.0, 10.0 / 65.0, 58.0 / 65.0, 6.0 / 65.0, 54.0 / 65.0 },
|
{ 11.0 / 65.0, 59.0 / 65.0, 7.0 / 65.0, 55.0 / 65.0, 10.0 / 65.0, 58.0 / 65.0, 6.0 / 65.0, 54.0 / 65.0 },
|
||||||
{ 43.0 / 65.0, 27.0 / 65.0, 39.0 / 65.0, 23.0 / 65.0, 42.0 / 65.0, 26.0 / 65.0, 38.0 / 65.0, 22.0 / 65.0 }
|
{ 43.0 / 65.0, 27.0 / 65.0, 39.0 / 65.0, 23.0 / 65.0, 42.0 / 65.0, 26.0 / 65.0, 38.0 / 65.0, 22.0 / 65.0 }
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user