mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
d5f172b782
* Fix fog accumulated error with multiple local lights * add standard exposure value for lightmap
55 lines
3.3 KiB
Plaintext
55 lines
3.3 KiB
Plaintext
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
|
|
|
#include <shading-standard-base>
|
|
#include <output-standard>
|
|
#include <cc-fog-fs>
|
|
#include <cc-shadow-map-fs>
|
|
|
|
|
|
#pragma define CC_STANDARD_SURFACE_ENTRY() \
|
|
#if CC_FORWARD_ADD \
|
|
#include <shading-standard-additive> \
|
|
#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1 \
|
|
#include <shading-cluster-additive> \
|
|
#endif \
|
|
\
|
|
layout(location = 0) out vec4 fragColorX; \
|
|
\
|
|
void main () { \
|
|
StandardSurface s; surf(s); \
|
|
#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1 \
|
|
vec4 color = CCClusterShadingAdditive(s, CC_SHADOW_POSITION); \
|
|
#else \
|
|
vec4 color = CCStandardShadingAdditive(s, CC_SHADOW_POSITION); \
|
|
#endif \
|
|
fragColorX = CCFragOutput(color); \
|
|
} \
|
|
\
|
|
#elif (CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_FORWARD || CC_FORCE_FORWARD_SHADING) \
|
|
\
|
|
layout(location = 0) out vec4 fragColorX; \
|
|
\
|
|
void main () { \
|
|
StandardSurface s; surf(s); \
|
|
vec4 color = CCStandardShadingBase(s, CC_SHADOW_POSITION); \
|
|
CC_APPLY_FOG(color, s.position.xyz); \
|
|
fragColorX = CCFragOutput(color); \
|
|
} \
|
|
\
|
|
#elif CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_DEFERRED \
|
|
#include <octahedron-transform> \
|
|
\
|
|
layout(location = 0) out vec4 fragColor0; \
|
|
layout(location = 1) out vec4 fragColor1; \
|
|
layout(location = 2) out vec4 fragColor2; \
|
|
\
|
|
void main () { \
|
|
StandardSurface s; surf(s); \
|
|
fragColor0 = s.albedo; \
|
|
fragColor1 = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic); \
|
|
fragColor2 = vec4(s.emissive, s.occlusion); \
|
|
} \
|
|
\
|
|
#endif \
|
|
#pragma // empty pragma trick to get rid of trailing semicolons at effect compile time
|