Browse Source

Tonemap, Gbuffer fix.

master
Palash Bansal 2 years ago
parent
commit
833fa3e7c6
No account linked to committer's email address

+ 2
- 1
src/plugins/pipeline/DepthBufferPlugin.ts View File

this.target = this._viewer.renderManager.createTarget<DepthBufferPluginTarget>( this.target = this._viewer.renderManager.createTarget<DepthBufferPluginTarget>(
{ {
depthBuffer: true, depthBuffer: true,
samples: this._viewer.renderManager.composerTarget.samples || 0,
samples: this._viewer.renderManager.zPrepass && this.isPrimaryGBuffer ? // requirement for zPrepass
this._viewer.renderManager.composerTarget.samples || 0 : 0,
type: this.bufferType, type: this.bufferType,
// magFilter: NearestFilter, // magFilter: NearestFilter,
// minFilter: NearestFilter, // minFilter: NearestFilter,

+ 5
- 1
src/plugins/pipeline/GBufferPlugin.ts View File

import { import {
BufferGeometry, BufferGeometry,
Camera, Camera,
ClampToEdgeWrapping,
Color, Color,
DepthTexture, DepthTexture,
DoubleSide, DoubleSide,
this.target = this._viewer.renderManager.createTarget<GBufferPluginTarget>( this.target = this._viewer.renderManager.createTarget<GBufferPluginTarget>(
{ {
depthBuffer: true, depthBuffer: true,
samples: this._viewer.renderManager.composerTarget.samples || 0,
samples: this._viewer.renderManager.zPrepass && this.isPrimaryGBuffer ? // requirement for zPrepass
this._viewer.renderManager.composerTarget.samples || 0 : 0,
type: this.bufferType, type: this.bufferType,
textureCount: useMultiple ? 2 : 1, textureCount: useMultiple ? 2 : 1,
depthTexture: this.renderDepthTexture, depthTexture: this.renderDepthTexture,
// minFilter: NearestFilter, // minFilter: NearestFilter,
// generateMipmaps: false, // generateMipmaps: false,
// encoding: LinearEncoding, // encoding: LinearEncoding,
wrapS: ClampToEdgeWrapping,
wrapT: ClampToEdgeWrapping,
}) })
if (Array.isArray(this.target.texture)) { if (Array.isArray(this.target.texture)) {
this.target.texture[0].name = 'gbufferDepthNormal' this.target.texture[0].name = 'gbufferDepthNormal'

+ 3
- 1
src/plugins/postprocessing/shaders/TonemapPlugin.patch.glsl View File

bool doTonemap = true; bool doTonemap = true;
#ifdef HAS_GBUFFER #ifdef HAS_GBUFFER
#ifdef GBUFFER_HAS_FLAGS
doTonemap = getToneMapBit(getGBufferFlags(vUv).a) > 0; doTonemap = getToneMapBit(getGBufferFlags(vUv).a) > 0;
#endif
#if TONEMAP_BACKGROUND < 1 #if TONEMAP_BACKGROUND < 1
if(isBackground) doTonemap = false;
if(isBackground) doTonemap = false; // isBackground defined in ScreenPass
#endif #endif
#endif #endif
if(doTonemap) diffuseColor = ToneMapping(diffuseColor); if(doTonemap) diffuseColor = ToneMapping(diffuseColor);

Loading…
Cancel
Save