diff --git a/src/Engine3D.ts b/src/Engine3D.ts index de6a82c0..26143bff 100644 --- a/src/Engine3D.ts +++ b/src/Engine3D.ts @@ -193,8 +193,9 @@ export class Engine3D { enable: false, blurX: 4, blurY: 4, - intensity: 0.25, - brightness: 1.3, + strength: 0.25, + radius: 1.3, + luminosityThreshold: 0.98, debug: false, }, fxaa: { diff --git a/src/gfx/renderJob/post/HDRBloomPost.ts b/src/gfx/renderJob/post/HDRBloomPost.ts index c75e78ca..6016ffb9 100644 --- a/src/gfx/renderJob/post/HDRBloomPost.ts +++ b/src/gfx/renderJob/post/HDRBloomPost.ts @@ -28,10 +28,12 @@ export class HDRBloomPost extends PostBase { public blurY: number = 1; constructor() { super(); - Engine3D.setting.render.postProcessing.bloom.enable = true; + const bloomSetting = Engine3D.setting.render.postProcessing.bloom; + + bloomSetting.enable = true; - this.blurX = Engine3D.setting.render.postProcessing.bloom.blurX; - this.blurY = Engine3D.setting.render.postProcessing.bloom.blurY; + this.blurX = bloomSetting.blurX; + this.blurY = bloomSetting.blurY; let presentationSize = webGPUContext.presentationSize; let outTextures = this.createRTTexture('HDRBloomPost-outTextures', presentationSize[0], presentationSize[1], GPUTextureFormat.rgba16float, false); @@ -41,7 +43,7 @@ export class HDRBloomPost extends PostBase { let brightnessTextures = this.createRTTexture('brightnessTextures', presentationSize[0], presentationSize[1], GPUTextureFormat.rgba16float, false); this.brightnessView = this.createViewQuad(`brightnessView`, `Bloom_Brightness_frag_wgsl`, brightnessTextures, { - luminosityThreshold: new UniformNode(Engine3D.setting.render.postProcessing.bloom.brightness), + luminosityThreshold: new UniformNode(bloomSetting.luminosityThreshold), }); } @@ -78,7 +80,7 @@ export class HDRBloomPost extends PostBase { { this.compositeView = this.createViewQuad(`compositeView`, `Bloom_composite_frag_wgsl`, outTextures, { - bloomStrength: new UniformNode(Engine3D.setting.render.postProcessing.bloom.intensity), + bloomStrength: new UniformNode(bloomSetting.strength), bloomRadius: new UniformNode(1), }); } @@ -94,19 +96,19 @@ export class HDRBloomPost extends PostBase { public debug() { } - public get bloomStrength() { + public get strength() { return this.compositeView.uniforms['bloomStrength'].value; } - public set bloomStrength(value: number) { + public set strength(value: number) { this.compositeView.uniforms['bloomStrength'].value = value; } - public get bloomRadius() { + public get radius() { return this.compositeView.uniforms['bloomRadius'].value; } - public set bloomRadius(value: number) { + public set radius(value: number) { this.compositeView.uniforms['bloomRadius'].value = value; } diff --git a/src/setting/post/BloomSetting.ts b/src/setting/post/BloomSetting.ts index c04b25f4..fcfa94c5 100644 --- a/src/setting/post/BloomSetting.ts +++ b/src/setting/post/BloomSetting.ts @@ -19,11 +19,15 @@ export type BloomSetting = { /** * Strength setting */ - intensity: number; + strength: number; /** - * Brightness setting + * Radius setting */ - brightness: number; + radius: number; + /** + * Luminosity threshold + */ + luminosityThreshold: number; /** * use debug or not */