Skip to content

Commit

Permalink
reflection probe use skybox by default (cocos#13833)
Browse files Browse the repository at this point in the history
* set default envmap

* envmap
  • Loading branch information
xubing0906 authored Dec 16, 2022
1 parent f6854cd commit 65fc325
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cocos/3d/framework/mesh-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,11 @@ export class MeshRenderer extends ModelRenderer {
}
this.bakeSettings._probeCubemap = cubeMap;
if (this.model !== null) {
this.model.updateReflctionProbeCubemap(this.bakeSettings._probeCubemap);
let cubeMap = this.bakeSettings._probeCubemap;
if (!cubeMap && this.node.scene) {
cubeMap = this.node.scene._globals.skybox.envmap;
}
this.model.updateReflctionProbeCubemap(cubeMap);
}
}
public updateProbePlanarMap (planarMap: Texture | null) {
Expand All @@ -672,7 +676,11 @@ export class MeshRenderer extends ModelRenderer {
protected _updateReflectionProbeTexture () {
if (this.model === null) return;
if (this.bakeSettings.reflectionProbe === ReflectionProbeType.BAKED_CUBEMAP) {
this.model.updateReflctionProbeCubemap(this.bakeSettings._probeCubemap);
let cubeMap = this.bakeSettings._probeCubemap;
if (!cubeMap && this.node.scene) {
cubeMap = this.node.scene._globals.skybox.envmap;
}
this.model.updateReflctionProbeCubemap(cubeMap);
this.model.updateReflctionProbePlanarMap(null);
} else if (this.bakeSettings.reflectionProbe === ReflectionProbeType.PLANAR_REFLECTION) {
this.model.updateReflctionProbePlanarMap(this.bakeSettings._probePlanarmap);
Expand Down

0 comments on commit 65fc325

Please sign in to comment.