Rendering Issue with Dynamic Entities

Hi folks,

I would like to share some observations and issues I have encountered while using this fork: PlayCanvas 3D HTML5 Game Engine

During my usage of this project, I experienced a weird behavior.
When I dynamically uploaded a GLB and then switched to the launched page, the added GLB appears to penetrate the plane.

I’ve created a simplified version for reproduction purposes. Please take a look: Editor Demo
I’ve discovered that after setting up the plane,

const material = new pc.StandardMaterial();
material.depthWrite = true;
material.redWrite = false;
material.greenWrite = false;
material.blueWrite = false;
material.alphaWrite = false;
material.blendType = pc.BLEND_NONE;
material.opacity = 0;

the upcoming new material

AddNewMaterial.prototype.initialize = function() {
  // Create new material after plane material created
  setTimeout(() => {
    console.log("Create New Material.")
  }, 1000);

AddNewMaterial.prototype.createNewMaterial = function() {
  const material = new pc.StandardMaterial();
  material.diffuse = new pc.Color().fromString('#0015ff');
  this.entity.render.material = material;

will cause the penetration issue to occur.

Your assistance in addressing this matter would be greatly appreciated. :pray:

Hey @Chasm, I encountered the exact same issue with the GLB models integrating in the YouTube demo project. Unfortunately, we don’t have the support for that 3D YouTube demo and hence it was taken down from the tutorials.
In my case, it was only penetrating when the video was paused and didn’t penetrate if the video was playing so for the workaround, I simply added the overlay screen above it when videos were not working, and that solved my issue.

Hello saif,

I’ve tried your workaround before, but not work. Would you mind sharing your code ?
My simple demo just used setTimeout to load new entity, and then found out maybe not related to Youtube demo project but all dynamic loaded entity issue.


Hey, I don’t have access to that project, unfortunately!

So is there anything I misunderstand for reproducing this issue ?