Skip to content

Commit

Permalink
Prefilter fix (engine v1) (playcanvas#6893)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck authored Aug 28, 2024
1 parent 2002df4 commit 04847c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
7 changes: 0 additions & 7 deletions src/scene/graphics/reproject-texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,10 @@ function reprojectTexture(source, target, options = {}) {

const params = [
0,
specularPower,
source.fixCubemapSeams ? 1.0 / source.width : 0.0, // source seam scale
target.fixCubemapSeams ? 1.0 / target.width : 0.0 // target seam scale
];

const params2 = [
target.width * target.height * (target.cubemap ? 6 : 1),
source.width * source.height * (source.cubemap ? 6 : 1)
];

if (prefilterSamples) {
// set or generate the pre-calculated samples data
const sourceTotalPixels = source.width * source.height * (source.cubemap ? 6 : 1);
Expand All @@ -530,7 +524,6 @@ function reprojectTexture(source, target, options = {}) {
});
params[0] = f;
constantParams.setValue(params);
constantParams2.setValue(params2);

drawQuadWithShader(device, renderTarget, shader, options?.rect);

Expand Down
20 changes: 5 additions & 15 deletions src/scene/shader-lib/chunks/common/frag/reproject.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,13 @@ varying vec2 vUv0;
// params:
// x - target cubemap face 0..6
// y - specular power (when prefiltering)
// z - source cubemap seam scale (0 to disable)
// w - target cubemap size for seam calc (0 to disable)
uniform vec4 params;
// params2:
// x - target image total pixels
// y - source cubemap size
uniform vec2 params2;
// y - source cubemap seam scale (0 to disable)
// z - target cubemap size for seam calc (0 to disable)
uniform vec3 params;
float targetFace() { return params.x; }
float specularPower() { return params.y; }
float sourceCubeSeamScale() { return params.z; }
float targetCubeSeamScale() { return params.w; }
float targetTotalPixels() { return params2.x; }
float sourceTotalPixels() { return params2.y; }
float sourceCubeSeamScale() { return params.y; }
float targetCubeSeamScale() { return params.z; }
float PI = 3.141592653589793;
Expand Down

0 comments on commit 04847c6

Please sign in to comment.