Skip to content

Commit

Permalink
revert changes during pipeline replacing (#17597)
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Sep 3, 2024
1 parent a900c7c commit 3a5898d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
30 changes: 11 additions & 19 deletions editor/assets/effects/pipeline/post-process/color-grading.effect
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ CCEffect %{
pass: color-grading-nx1
rasterizerState: &rasterizerState
cullMode: none
blendState: &blendState
targets:
- blend: false
blendSrc: one
blendDst: zero
depthStencilState: &depthStencilState
depthTest: false
depthWrite: false
Expand All @@ -16,6 +21,7 @@ CCEffect %{
pass: color-grading-8x8
rasterizerState: *rasterizerState
depthStencilState: *depthStencilState
blendState: *blendState
}%

CCProgram ubo %{
Expand All @@ -35,8 +41,6 @@ CCProgram color-grading-vs %{

CCProgram color-grading-nx1-fs %{
precision highp float;
#include <common/color/gamma>
#include <common/color/tone-mapping>
#include <ubo>
in vec2 v_uv;

Expand All @@ -58,44 +62,32 @@ CCProgram color-grading-nx1-fs %{
layout(location = 0) out vec4 fragColor;
void main () {
vec4 sceneColor = texture(sceneColorMap, v_uv);
// (Tone mapping + gamma correction) + Color grading
#if CC_USE_FLOAT_OUTPUT
sceneColor.rgb = HDRToLDR(sceneColor.rgb);
sceneColor.rgb = LinearToSRGB(sceneColor.rgb);
#endif
vec3 gradeColor = ColorGrading(colorGradingMap, sceneColor.rgb);
fragColor = mix(sceneColor, vec4(gradeColor, sceneColor.a), contribute);
fragColor = mix(sceneColor, vec4(gradeColor, 1.0), contribute);
}
}%

CCProgram color-grading-8x8-fs %{
precision highp float;
#include <common/color/gamma>
#include <common/color/tone-mapping>
#include <ubo>
in vec2 v_uv;
#define EPS 0.000001
#define TOTAL 64.0
#define SIZE 512.0
layout(location = 0) out vec4 fragColor;
void main () {
vec4 origColor = texture(sceneColorMap, v_uv);
// (Tone mapping + gamma correction) + Color grading
#if CC_USE_FLOAT_OUTPUT
origColor.rgb = HDRToLDR(origColor.rgb);
origColor.rgb = LinearToSRGB(origColor.rgb);
#endif
float bValue = (origColor.b * 255.0) / 4.0;
vec3 orgColor = texture(sceneColorMap, v_uv).rgb;
float bValue = (orgColor.b * 255.0) / 4.0;
vec2 mulB = clamp(floor(bValue) + vec2(0.0, 1.0), 0.0, 63.0);
vec2 row = floor(mulB / 8.0 + EPS);
vec4 row_col = vec4(row, mulB - row * 8.0);
vec4 lookup = origColor.ggrr * (63.0 / SIZE) + row_col * (TOTAL / SIZE) + (0.5 / SIZE);
vec4 lookup = orgColor.ggrr * (63.0 / SIZE) + row_col * (TOTAL / SIZE) + (0.5 / SIZE);

float b1w = bValue - mulB.x;

vec3 sampled1 = texture(colorGradingMap, lookup.zx).rgb;
vec3 sampled2 = texture(colorGradingMap, lookup.wy).rgb;

fragColor = vec4(mix(origColor.rgb, mix(sampled1, sampled2, b1w), contribute), origColor.a);
fragColor = vec4(mix(orgColor, mix(sampled1, sampled2, b1w), contribute), 1.0);
}
}%
10 changes: 10 additions & 0 deletions editor/assets/effects/pipeline/post-process/fsr.effect
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ CCEffect %{
depthStencilState:
depthTest: false
depthWrite: false
blendState:
targets:
- blend: true
blendSrc: one
blendDst: zero
- vert: vs
frag: fs-rcas
pass: post-process
Expand All @@ -19,6 +24,11 @@ CCEffect %{
depthStencilState:
depthTest: false
depthWrite: false
blendState:
targets:
- blend: true
blendSrc: one
blendDst: zero
}%


Expand Down

0 comments on commit 3a5898d

Please sign in to comment.