Hersir Posted August 17, 2017 Share Posted August 17, 2017 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. Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 17, 2017 Author Share Posted August 17, 2017 In my project instances that were added also were not re-rendered (position and rotation was changed but visually it was the same) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 17, 2017 Share Posted August 17, 2017 Unfortunately I cannot reproduce the issue Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 18, 2017 Author Share Posted August 18, 2017 Yes it can be reproduced with some older android devices. webgl version : {vendor: "Qualcomm", renderer: "Adreno (TM) 320", version: "WebGL 1.0 (OpenGL ES 2.0 Chromium)"} Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 18, 2017 Author Share Posted August 18, 2017 @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 ? Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 18, 2017 Author Share Posted August 18, 2017 @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 ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 18, 2017 Share Posted August 18, 2017 I'm really sorry but I cannot reproduce it at all Can you reproduce it on your computer? Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 18, 2017 Author Share Posted August 18, 2017 @Deltakosh No only on that android device Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 18, 2017 Share Posted August 18, 2017 Ok..can you try to turn hardware instance off with engine.getCaps().instancedArrays = false? Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 21, 2017 Author Share Posted August 21, 2017 @Deltakosh I changed hardwareInstancedRendering inside Mesh.prototype.render to false and objects appeared as they should. Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 21, 2017 Author Share Posted August 21, 2017 @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); } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 21, 2017 Share Posted August 21, 2017 we cannot create a new vertex buffer on every call unfortunately. This really looks like a weird browser bug to me Quote Link to comment Share on other sites More sharing options...
Hersir Posted August 22, 2017 Author Share Posted August 22, 2017 OK will leave it for now, if someone finds why it is not refreshed, before mesh leaves viewport, feel free to report here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.