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

refactor: 移除 TAA 算法后处理抗锯齿逻辑 #2448

Merged
merged 1 commit into from
May 9, 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
2 changes: 0 additions & 2 deletions packages/core/src/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import MultiPassRenderer from './services/renderer/passes/MultiPassRenderer';
import PixelPickingPass from './services/renderer/passes/PixelPickingPass';
import PostProcessor from './services/renderer/passes/PostProcessor';
import RenderPass from './services/renderer/passes/RenderPass';
import TAAPass from './services/renderer/passes/TAAPass';
import BloomPass from './services/renderer/passes/post-processing/BloomPass';
import BlurHPass from './services/renderer/passes/post-processing/BlurHPass';
import BlurVPass from './services/renderer/passes/post-processing/BlurVPass';
Expand Down Expand Up @@ -133,7 +132,6 @@ export function createSceneContainer(): L7Container {
clear: new ClearPass(),
pixelPicking: new PixelPickingPass(),
render: new RenderPass(),
taa: new TAAPass(shaderModuleService),
};
container.normalPassFactory = (named: string) => {
return normalPass[named];
Expand Down
40 changes: 2 additions & 38 deletions packages/core/src/services/camera/CameraService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ export default class CameraService implements ICameraService {
*/
private overridedViewProjectionMatrix: number[] | undefined;

/**
* 抖动后的 VP 矩阵
*/
private jitteredViewProjectionMatrix: number[] | undefined;

/**
* 抖动后的 Projection 矩阵
*/
private jitteredProjectionMatrix: number[] | undefined;

/**
* ViewMatrix 逆矩阵,用于计算相机位置
*/
Expand Down Expand Up @@ -56,8 +46,7 @@ export default class CameraService implements ICameraService {
}

public getProjectionMatrix(): number[] {
// 优先返回抖动后的 ProjectionMatrix
return this.jitteredProjectionMatrix || this.viewport.getProjectionMatrix();
return this.viewport.getProjectionMatrix();
}

public getModelMatrix(): number[] {
Expand All @@ -77,11 +66,7 @@ export default class CameraService implements ICameraService {
}

public getViewProjectionMatrix(): number[] {
return (
this.overridedViewProjectionMatrix ||
this.jitteredViewProjectionMatrix ||
this.viewport.getViewProjectionMatrix()
);
return this.overridedViewProjectionMatrix || this.viewport.getViewProjectionMatrix();
}

public getZoom(): number {
Expand Down Expand Up @@ -115,25 +100,4 @@ export default class CameraService implements ICameraService {
public setViewProjectionMatrix(viewProjectionMatrix: number[] | undefined) {
this.overridedViewProjectionMatrix = viewProjectionMatrix;
}

public jitterProjectionMatrix(x: number, y: number) {
const translation = mat4.fromTranslation(mat4.create(), [x, y, 0]);

this.jitteredProjectionMatrix = mat4.multiply(
mat4.create(),
translation,
this.viewport.getProjectionMatrix() as unknown as mat4,
) as unknown as number[];

this.jitteredViewProjectionMatrix = mat4.multiply(
mat4.create(),
this.jitteredProjectionMatrix as unknown as mat4,
this.viewport.getViewMatrix() as unknown as mat4,
) as unknown as number[];
}

public clearJitterProjectionMatrix() {
this.jitteredProjectionMatrix = undefined;
this.jitteredViewProjectionMatrix = undefined;
}
}
2 changes: 0 additions & 2 deletions packages/core/src/services/camera/ICameraService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ export interface ICameraService extends Omit<IViewport, 'syncWithMapCamera'> {
update(viewport: IViewport): void;
getCameraPosition(): number[];
setViewProjectionMatrix(viewProjectionMatrix: number[] | undefined): void;
jitterProjectionMatrix(x: number, y: number): void;
clearJitterProjectionMatrix(): void;
}
2 changes: 0 additions & 2 deletions packages/core/src/services/config/ConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const defaultLayerConfig: Partial<ILayerConfig> = {
activeMix: 0,
selectColor: 'blue',
selectMix: 0,
enableTAA: false,
jitterScale: 1,
enableLighting: false,
animateOption: {
enable: false,
Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/services/layer/ILayerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,6 @@ export interface ILayerConfig {
activeColor: string | number[];
activeMix?: number;
selectMix?: number;
/**
* 开启 TAA
*/
enableTAA: boolean;
/**
* 相机抖动程度
*/
jitterScale: number;
/**
* 开启光照
*/
Expand Down
Loading
Loading