Skip to content

Commit

Permalink
fix: refraction mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhhkrx committed Dec 26, 2024
1 parent 36c994c commit 2928dcc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/material/PBRMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,17 @@ export class PBRMaterial extends PBRBaseMaterial {
override set isTransparent(value: boolean) {
super.isTransparent = value;
this._lastRenderQueueType = this.renderState.renderQueueType;
if (this.refractionMode !== RefractionMode.None) {
if (this.transmission > 0) {
// If transmission enabled, always use transparent queue to ensure get correct opaque texture
this.renderState.renderQueueType = RenderQueueType.Transparent;
}
}

override set alphaCutoff(value: number) {
super.alphaCutoff = value;
this._lastRenderQueueType = this.renderState.renderQueueType;
if (this.refractionMode !== RefractionMode.None) {
if (this.transmission > 0) {
// If transmission enabled, always use transparent queue to ensure get correct opaque texture
this.renderState.renderQueueType = RenderQueueType.Transparent;
}
}
Expand All @@ -355,6 +357,7 @@ export class PBRMaterial extends PBRBaseMaterial {
if (!!this.shaderData.getFloat(PBRMaterial._transmissionProp) !== !!value) {
if (value > 0) {
this.shaderData.enableMacro(PBRMaterial._transmissionMacro);
this.renderState.renderQueueType = RenderQueueType.Transparent;
} else {
this.shaderData.disableMacro(PBRMaterial._transmissionMacro);
}
Expand Down

0 comments on commit 2928dcc

Please sign in to comment.