Files
cocos4/editor/assets/effects/pipeline/post-process.effect
T
jk20012001 3cf9aaee4e arrange chunks (#11551)
* arrange chunks

* update compiled shaders

* code style
2022-06-16 22:14:09 +08:00

78 lines
2.1 KiB
Plaintext

// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
CCEffect %{
techniques:
- passes:
- vert: post-process-vs
frag: post-process-fs
phase: post-process
depthStencilState:
depthTest: false
depthWrite: false
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
}%
CCProgram post-process-vs %{
precision highp float;
#include <legacy/input-standard>
#include <builtin/uniforms/cc-global>
#include <common/common-define>
out vec2 v_uv;
void main () {
StandardVertInput In;
CCVertInput(In);
CC_HANDLE_GET_CLIP_FLIP(In.position.xy);
gl_Position = In.position;
gl_Position.y = gl_Position.y;
v_uv = a_texCoord;
}
}%
CCProgram post-process-fs %{
precision highp float;
#include <builtin/uniforms/cc-global>
#include <post-process/anti-aliasing>
in vec2 v_uv;
layout(binding = 0) uniform sampler2D outputResultMap;
layout(location = 0) out vec4 fragColor;
void texcoords(vec2 fragCoord, vec2 resolution,
out vec2 v_rgbNW, out vec2 v_rgbNE,
out vec2 v_rgbSW, out vec2 v_rgbSE,
out vec2 v_rgbM) {
vec2 inverseVP = 1.0 / resolution.xy;
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
v_rgbM = vec2(fragCoord * inverseVP);
}
void main () {
mediump vec2 v_rgbNW;
mediump vec2 v_rgbNE;
mediump vec2 v_rgbSW;
mediump vec2 v_rgbSE;
mediump vec2 v_rgbM;
#if ANTIALIAS_TYPE == 1
vec2 resolution = cc_screenSize.xy;
vec2 fragCoord = v_uv * resolution;
texcoords(fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
fragColor = fxaa(outputResultMap, fragCoord, resolution, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
#else
fragColor = texture(outputResultMap, v_uv);
#endif
}
}%