MasterK Posted November 16, 2015 Share Posted November 16, 2015 I want to add name label to character in the 3d scene. the label should always orient to the camera and not cover by other object. how can i make it ? Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 and castorGUI can't fit this. i want the label move with the 3d character. and GUI move is not convenient... Quote Link to comment Share on other sites More sharing options...
jerome Posted November 16, 2015 Share Posted November 16, 2015 you can use the sprites with a dynamic texture containing a textor simply a plane mesh set in billboard mode Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 you can use the sprites with a dynamic texture containing a textor simply a plane mesh set in billboard mode i am using dynamicTexture with context drawed text. as opacityMaterialTexture. and attach to a plane mesh...and i should update the mesh's rotation according to camera alpha and beta...i think it's not a good way. i'll try 'billboard'. maybe it's the final solution? Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 you can use the sprites with a dynamic texture containing a textor simply a plane mesh set in billboard mode o....sprites with dynamic texture. i'll try too... thanks!!!!! Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 this.nameMesh.billboardMode = BABYLON.AbstractMesh._BILLBOARDMODE_ALL; it's fine, and i needn't set rotation myself. but it'll be covered by other object. the sprites: should use spriteManager but function SpriteManager(name, imgUrl, capacity, cellSize, scene, epsilon, samplingMode) it's also not convenient... Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 16, 2015 Author Share Posted November 16, 2015 ps, sprite also will be covered... Quote Link to comment Share on other sites More sharing options...
iiceman Posted November 16, 2015 Share Posted November 16, 2015 You can add it to another rendering group by setting renderingGroupId = 1, then it won't get covered anymore. http://doc.babylonjs.com/classes/2.2/AbstractMesh#renderinggroupid-number Quote Link to comment Share on other sites More sharing options...
adam Posted November 16, 2015 Share Posted November 16, 2015 Here is an example: http://www.babylonjs-playground.com/#3HQSB#4 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 16, 2015 Share Posted November 16, 2015 There are probably many ways to do this. Billboard always faces the camera. Moving with the Mesh in 3D can be compelling. Sprites are for pussies. This is done by adding a registerAfterWorldMatrixUpdate() to the mesh you wish to track. Every time the tracked mesh moves the label moves. https://googledrive.com/host/0B6-s6ZjHyEwUfkRGTUVVTUxaT01UZUlieGdCODF1blFZZHJFMnRJUHBpcG1KcnBjUVluYXcin <head> add <script src="dialog.1.1.js"></script> <script src="Font2D.js"></script>...DIALOG.DialogSys.initialize(scene);// want emissive color, so does not change under lighting, backface culling off for wooshvar alwaysWhite = new BABYLON.StandardMaterial("alwaysWhite", scene);alwaysWhite.checkReadyOnlyOnce = true;alwaysWhite.emissiveColor = new BABYLON.Color3(1,1,1);alwaysWhite.backFaceCulling = false;var offAway = new DIALOG.Label("Off & Away","Font2D", alwaysWhite);offAway.layout();offAway.unfreezeWorldMatrixTree();offAway.rotation.y = -3.14 / 2;cloth.registerAfterWorldMatrixUpdate( function(){ offAway.position.x = cloth.position.x; offAway.position.y = cloth.position.y + 3; offAway.position.z = cloth.position.z; }); Quote Link to comment Share on other sites More sharing options...
MasterK Posted November 18, 2015 Author Share Posted November 18, 2015 you're all good people... renderingGroupID is OK for me. @adam Your dynamicTexture code is better. i leaned. @jcplamer new way, i marked... Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 18, 2015 Share Posted November 18, 2015 Hi, I don't want open a new topic so I will ask here.For sprites, it's posible to make them look at camera only on y rotation of camera, and nothing happen when I look at sprite from above. Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted November 18, 2015 Share Posted November 18, 2015 I think (to be checked) that the sprites always look at the camera. If you want a different behavior in term of orientation, you might use some textured planes (quads) and set up their billboard mode what can be ALL, X, Y or Z axed. Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 18, 2015 Share Posted November 18, 2015 Ok, thank you jerome, i'll try. Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 18, 2015 Share Posted November 18, 2015 If I use planes with billboard, my fps decreased a lot.But....I think I will download sprites shaders, and spriteManager.js and I'll try to modify it.That's why I love this framework. Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 18, 2015 Share Posted November 18, 2015 Ok, I create 1m.500k sprites and my scene still have around 60 fps. It's amazing. But it take a lot to calculate all positions, and if I add more my browser crash ) http://prntscr.com/945urwhttp://prntscr.com/945vaz Quote Link to comment Share on other sites More sharing options...
jerome Posted November 18, 2015 Share Posted November 18, 2015 If you are using planes and if they are all the same, just create instances of this plane instead of 1,5M planes GameMonetize 1 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.