Dad72 Posted June 5, 2014 Share Posted June 5, 2014 Hi, I try to paint the grass with the instance and pick system. When I pick the first time, my grass is displayed, but the second time, it disappears.I have my number of active models increases but no grass showing on the scene. What am I doing wrong? I also get this error in the console:[.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElementsInstancedANGLE: attempt to access out of range vertices in attribute 2 var currentPosition, that = this, pickInfo, this.instanceGrass = 0; this._onBeforeRender = function () { if (!currentPosition) return; var pickTerrain = that._ground.getScene(), posX = currentPosition.x , posY = currentPosition.y; pickInfo = pickTerrain.pick(posX, posY); switch(that.MODE_CONTROLE) { case WORLDCASTOR.ElevationControl.MODE_CONTROLE_GRASS: if(pickInfo.pickedMesh == that._ground) { if(that.instanceGrass == 0) { that.Grass = BABYLON.Mesh.CreatePlane("grass", 0.4, scene); that.Grass.position = new BABYLON.Vector3(pickInfo.pickedPoint.x, parseFloat(pickInfo.pickedPoint.y+0.31), pickInfo.pickedPoint.z); that.Grass.material = that.materialGrass; that.instanceGrass = 1; } else { var instance_Grass = that.Grass.createInstance("grass"+ that.instanceGrass); instance_Grass.position = new BABYLON.Vector3(pickInfo.pickedPoint.x, parseFloat(pickInfo.pickedPoint.y+0.31), pickInfo.pickedPoint.z); that.instanceGrass++; } } break; } };Thank you for help Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 5, 2014 Share Posted June 5, 2014 How many instances do you have? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 5, 2014 Author Share Posted June 5, 2014 I is not number instance defined. it is a pick(), when I click on the stage. As raise vertex on worlmonger, but here, I painted grass. This does not pass through a loop for(), but loop onBeforeRender() Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 5, 2014 Share Posted June 5, 2014 need to see it live as usual Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 5, 2014 Author Share Posted June 5, 2014 OK. I used woldmonger and I add a button Grass. Zoom in on the ground (to see what happens) Select the button grass and click once, the grass appears for a while and disappears immediately. I have the same error in the console. index.html Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 6, 2014 Share Posted June 6, 2014 Huhu just use a material with backFaceCulling = false and you will see your grass Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 6, 2014 Author Share Posted June 6, 2014 Not this changes nothing. have look you on my demo. look near the ground when you add from the grass, it appears correctly and disappears immediately. the problem isn't that the face is hide, it is that it is remove from the scene once add. If I comment the part instance, my grass is display and does not disappear. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 6, 2014 Share Posted June 6, 2014 Ok my bad, I had a big awful bug I fixed it and published it to github:) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 6, 2014 Author Share Posted June 6, 2014 Yes they are display, but if I put 20 plane, has 40 active objects (the double) on the scene. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 6, 2014 Share Posted June 6, 2014 How do you evaluate the active objects? Do you have a mirror? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 6, 2014 Author Share Posted June 6, 2014 With: mydiv.innerHTML = scene._activeMeshes.length; Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 6, 2014 Author Share Posted June 6, 2014 in fact it is not double, because I've put 7 plan on the ground and it displays me 148 active mesh.and FPS are down with 7 plan displays. [edited] in fact the displays are random. instances that create well but most are invisible on the stage.So what you have fix, a partially solved the problem. Even the screen: Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2014 Share Posted June 7, 2014 You are using a miror for the water which increment the number of active mesh COuld you check the list of activeNesh using debugger to see names of active meshes ? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 7, 2014 Author Share Posted June 7, 2014 I made this comparison. When I put 10 mesh, only 2-5 are visible (randomly). so I have good numbers with scene._activeMeshes, but the wrong number of what is on the visible scene. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 9, 2014 Share Posted June 9, 2014 do you think you can create a small repro without all the world around? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 9, 2014 Author Share Posted June 9, 2014 With your woldmonger demo. I put a day babylon with the previous correction. index.html Vous remarquerez que le nombre de modèle actif augmente ( a coté de FPS j'ai ajouter Active en haut a droite), mais pas le nombre visible sur la scène. ou en continuant de peindre de l'herbe, avec un gros temps de retard, il apparaisse, mais le nombre ne correspond pas. Le seule fichier que j'ai modifier de plus important c’est dans "elevationControl.js" a partir de la ligne 71 et ainsi que dans le constructeur pour initialiser les materiaux.Je charge le premier modeles a la ligne 74 et je créer les instance a la ligne 82. a la ligne 81 j'ai ajouter un petit sleep pour faire un petit temps de pause léger quand on peint l'herbes. Voila j’espère que cela aide. PS: j'ai pris la demo de worldmonger car c’est ce que j'utilise sur mon projet pour peindre de l'herbes. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 9, 2014 Share Posted June 9, 2014 Il me faudrait juste l'herbe sur un plan en fait. parce que la avec tous les shaders actifs c'est la mort a debugger Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 9, 2014 Author Share Posted June 9, 2014 Ah ok, je vais essayer de faire ça dans la soirer ou pour demain Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 9, 2014 Author Share Posted June 9, 2014 Voila je vous est fait une scène toute simple. La camera est fixe mais orienter vers le sol pour que vous puissiez voir l'herbes que vous peignez. je vous est mis dans le title de la fenêtres les FPS et le nombres de mesh actif. Vous avez juste a cliquer sur le sol pour peindre de l'herbes. le premier plan d'herbes pas de problème c'est instantanée, mais des que l'on arrive sur les instances, ça s'affiche avec un enorme temps de retard et le nombres afficher n'est pas celui du nombre actif. Il faut peindre de façons a arriver entre 30 et 40 mesh actif pour que enfin on en voie apparaître 10 a 20 plan d'un coup, mais une partie reste invisible ou en mémoire peut être et le nombre de non afficher est aléatoire. index.html Merci Deltakosh Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 9, 2014 Share Posted June 9, 2014 This is perfect dad72! thanks to you I found this massive bug should be good now Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 9, 2014 Author Share Posted June 9, 2014 Yes, this fixe. thanks Dk Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 9, 2014 Author Share Posted June 9, 2014 [edite] If this is fixed, this is what I used this: if(scene._activeMeshes.length > 10) scene.createOrUpdateSelectionOctree(); I had to update octree that is displayed in real time with the same line each plan to create more on stage. 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.