Skip to content

Commit

Permalink
Merge pull request virtual-cast#103 from horyu/stop-support-prepass
Browse files Browse the repository at this point in the history
fix(prepass): stop prepass support
  • Loading branch information
il-masaru-yamagishi authored Aug 12, 2022
2 parents a585912 + 6ba0197 commit b5172ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ These are not covered.

- Specular
- Vertex Color
- PrePass

## Usage

Expand Down
18 changes: 16 additions & 2 deletions src/mtoon-material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { VertexBuffer } from '@babylonjs/core/Buffers/buffer';
import { SubMesh } from '@babylonjs/core/Meshes/subMesh';
import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh';
import { Mesh } from '@babylonjs/core/Meshes/mesh';
// import { PrePassConfiguration } from "./prePassConfiguration";

import { ImageProcessingConfiguration } from '@babylonjs/core/Materials/imageProcessingConfiguration';
import { ColorCurves } from '@babylonjs/core/Materials/colorCurves';
Expand Down Expand Up @@ -413,11 +414,18 @@ export class MToonMaterial extends PushMaterial {
}
}

// /**
// * Defines additional PrePass parameters for the material.
// */
// public readonly prePassConfiguration: PrePassConfiguration;

/**
* Can this material render to prepass
* No support for PrePass
*/
public get isPrePassCapable(): boolean {
return !this.disableDepthWrite;
// return !this.disableDepthWrite;
return false;
}

/**
Expand Down Expand Up @@ -824,6 +832,7 @@ export class MToonMaterial extends PushMaterial {

// Setup the default processing configuration to the scene.
this._attachImageProcessingConfiguration(null);
// this.prePassConfiguration = new PrePassConfiguration();

this.getRenderTargetTextures = (): SmartArray<RenderTargetTexture> => {
this._renderTargets.reset();
Expand Down Expand Up @@ -997,7 +1006,7 @@ export class MToonMaterial extends PushMaterial {

// PrePass
const oit = this.needAlphaBlendingForMesh(mesh) && (scene as any).useOrderIndependentTransparency;
MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT && !oit);
// MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT && !oit);

// Order independant transparency
MaterialHelper.PrepareDefinesForOIT(scene, defines, oit);
Expand Down Expand Up @@ -1246,6 +1255,9 @@ export class MToonMaterial extends PushMaterial {
this._eventInfo.customCode = undefined;
this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);

// PrePassConfiguration.AddUniforms(uniforms);
// PrePassConfiguration.AddSamplers(samplers);

if (ImageProcessingConfiguration) {
ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
ImageProcessingConfiguration.PrepareSamplers(samplers, defines);
Expand Down Expand Up @@ -1412,6 +1424,8 @@ export class MToonMaterial extends PushMaterial {
// Binding unconditionally
this._uniformBuffer.bindToEffect(effect, "Material");

// this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);

this._eventInfo.subMesh = subMesh;
this._callbackPluginEventHardBindForSubMesh(this._eventInfo);

Expand Down

0 comments on commit b5172ba

Please sign in to comment.