forked from LeenkxTeam/LNXSDK
Math fixes, SSR enhancements, improved precision and image sharpness, moved envmap into its own shader to improve SSR realism. Various improvements.
This commit is contained in:
@ -7,6 +7,12 @@ float hash(const vec2 p) {
|
||||
return fract(sin(h) * 43758.5453123);
|
||||
}
|
||||
|
||||
float hash12(vec2 p) {
|
||||
vec3 p3 = fract(vec3(p.xyx) * 0.1031);
|
||||
p3 += dot(p3, p3.yzx + 33.33);
|
||||
return fract((p3.x + p3.y) * p3.z);
|
||||
}
|
||||
|
||||
vec2 envMapEquirect(const vec3 normal) {
|
||||
const float PI = 3.1415926535;
|
||||
const float PI2 = PI * 2.0;
|
||||
@ -27,9 +33,9 @@ vec2 rand2(const vec2 coord) {
|
||||
return vec2(noiseX, noiseY);
|
||||
}
|
||||
|
||||
float linearize(const float depth, vec2 cameraProj) {
|
||||
// to viewz
|
||||
return cameraProj.y / (depth - cameraProj.x);
|
||||
float linearize(float depth, vec2 cameraProj) {
|
||||
depth = depth * 2.0 - 1.0;
|
||||
return cameraProj.y / (cameraProj.x - depth);
|
||||
}
|
||||
|
||||
float attenuate(const float dist) {
|
||||
|
Reference in New Issue
Block a user