Jump to content

Create instance issue on android


Hersir
 Share

Recommended Posts

Hi,

I have issue that elements created with createInstance sometimes don't show up on screen but exist in memory.

I managed to make small PG to show issue. There 2 objects are initialised on click. On first click both instances appear but on next one only second instance appear, after many clicks all instances appear. Sometimes helps to change camera angle to see all meshes.

Device: Galaxy S4

OS: Android 4.4.2

Browser: Chrome 59.0.3071.125

I have seen similar issue also on desktop devices, that instanced meshes disappear and appear back on camera rotation, but that I couldn't reproduce in PG yet.

Link to comment
Share on other sites

@Deltakosh

It  looks like some rendering issue with instances, as if I start to rotate camera (arcrotate camera), these invisible meshes start to appear and disappear randomly (probably depending on camera viewport). So they are created correctly  but just are not rendered always. could be some check in renderer that prevents update ?

Link to comment
Share on other sites

@Deltakosh

Ok found something new PG, on click on grey box 2 objects should be added, but after second click only red cylinders are added, but if I zoom camera so that meshes leave camera viewport and than zoom back , all meshes are visible, 

What happens when mesh leaves camera viewport and come back? is there some revalidation happening? could be so that at point it is added something is not ready yet ?

Link to comment
Share on other sites

@Deltakosh

Found something but probably I am of road, but

Inside Mesh class in method _renderWithInstances there is check

if (!instancesBuffer || currentInstancesBufferSize != this._instancesBufferSize) {
                
 if (instancesBuffer) {
   instancesBuffer.dispose();
 }

 instancesBuffer = new Buffer(engine, this._instancesData, true, 16, false, true);
 this._instancesBuffer = instancesBuffer;

 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world0", 0, 4));
 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world1", 4, 4));
 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world2", 8, 4));
 this.setVerticesBuffer(instancesBuffer.createVertexBuffer("world3", 12, 4));
 } else {
      instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
 }

Normally on first call it goes in first block and after in in second till buffer changes.

looks like if this.setVerticesBuffer is called in else block it fixes the issue (need just 1 call , any 1 of 4);

For example:

else {
   this.setVerticesBuffer(this._instancesBuffer.createVertexBuffer("world0", 0, 4));
   instancesBuffer.updateDirectly(this._instancesData, 0, instancesCount);
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...