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

Enable alpha test when using vertex alpha in some cases #15504

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion packages/dev/core/src/Materials/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1147,13 +1147,22 @@ export class Material implements IAnimatable, IClipPlanesHolder {
return false;
}

/**
* Specifies whether or not this material should be rendered in alpha test mode when used with the given mesh.
* @param mesh defines the mesh to check
* @returns a boolean specifying if an alpha test is needed.
*/
public needAlphaTestingForMesh(mesh: AbstractMesh): boolean {
bghgary marked this conversation as resolved.
Show resolved Hide resolved
return mesh.hasVertexAlpha || this.needAlphaTesting();
}

/**
* Specifies if material alpha testing should be turned on for the mesh
* @param mesh defines the mesh to check
* @returns a boolean specifying if alpha testing should be turned on for the mesh
*/
protected _shouldTurnAlphaTestOn(mesh: AbstractMesh): boolean {
return !this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting();
return !this.needAlphaBlendingForMesh(mesh) && this.needAlphaTestingForMesh(mesh);
}

/**
Expand Down