Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefilter fix (engine v1) #6893

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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