Files
cocos4/editor/assets/chunks/packing.chunk
T
jk20012001 a6dfddc780 Fix spotlight shadow formerge (#9177)
* fix spotlight shadow matrix, lineardepth, selfbias error (#8483)

* Spotlight shadows: Added depthbias in viewspace units

* Remove now unnecessary UBO constants

* Add support for directional lights

* fix spotlight shadow matrix, lineardepth, selfbias error (#8483)

* Fix Spotlight light leaking in backface and compiling error

* fix dirlightview matrix error

* more accuracy for spotlight shadow bias

* Fix face normal bias

* Fix DirLight Soft/Soft2X

* improve performance for ShadowUBO divid op

* remove spotshadow linear mode(can't work with new shadow bias), fix spotshadow linear mode

* fix spot shadow linear mode

* directional light packing mode and disable linear mode

* compiled effects

Co-authored-by: Jamie Anthony Morris <Jamie.Morris@cocos.com>
2021-08-16 14:50:41 +08:00

12 lines
333 B
Plaintext

// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
vec4 packDepthToRGBA (float depth) {
vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;
ret = fract(ret);
ret -= vec4(ret.yzw, 0.0) / 255.0;
return ret;
}
#define unpackRGBAToDepth(color)
dot(color, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0))