@Convergence - I did not find opacity texture channel, it will certainly make thing easier (was searching for transparency and alpha, opacity synonym slipped my mind). @Wingnut - Awesome, like it already . I'm gonna use your code as a starting point. I also enabled backface culling on the material, but I don't know yet about about that top rim. Perhaps unwrapping a model and creating an UV image, but I'm positive there is an easier way.

Hi! I'd like to create material with gradient and transparency effect as show on the image bellow (green, yellow and aqua color circles, everything else is irrelevant). After some searching I found gradient material, but it uses BABYLON.Color3 which doesn't support transparency. How can I achieve desired effect?

Hi! There always are other options , just that I haven't found any nice. One is definitely ordinary div element with absolute position and set width, height, left and right css properties (which is pretty straight forward). I was also thinking of doing everything inside BJS, but by my rough assessment it was way to complicated. Drawing a plane, parenting it to camera (depends on what kind of selection do you need), creating a render group so it's render above everything, and (probably) translating mouse coordinates to world and doing some sort of transformations so it's orthogonal to camera, keeping word coordinates after transformations... There might be a better way to do this, but didn't find it at the time. (All this is for a specific selection described at my first post). I went with another canvas because I will use it for additional 2D drawing, but it is possible that I will rewrite that part using an ordinary HTML elements. P.S.: I like what you've done so far, can't wait to see more .

Instance checking is per frustum I believe. And the problem is a little beyond just mesh and instance, because everything (also ground and other completely unrelated things) are missing . I attached an image to original post, where exact scene is rendered with bounding boxes on and off.

Hi! I'm trying to create various units for different players, each player can have multiple units, all from the same model. Because materials can't be per instance, only per mesh (WebGL limitation if I know correctly), I create a clone of a model for each player, change the material and afterwards I'm doing instancing from those clones. My problem is, that when I do this everything disappears (first it flickers and completely blank scene afterwards). Everything is visible again if bounding boxes are turned back on, but instances from clones aren't shown, only bounding boxes are at correct locations (attached first image). What am I doing wrong that this happens or is a bug? A minimal example on plunkr: http://plnkr.co/edit/yOaBtmu9NaOQpoULo6pv?p=preview EDIT: Example uses BJS version 2.2, but 2.3 suffers for the same problem. EDIT2: Added second image that renders exactly the same scene, the only difference is checked option for bounding boxed in debug layer.

If I may bug you for one more thing regarding this... After searching through the forum (problem about rotation), I found out that Bone is presented like a point, so there isn't really any direction in which is facing. I used the code bellow to get rotation, scale and translation. var l = this._laser.clone("l");var s = BABYLON.Vector3.Zero();var r = new BABYLON.Quaternion();var t = BABYLON.Vector3.Zero();this._bone.getWorldMatrix().decompose(s, r, t);l.position.copyFrom(e.position.add(t));l.rotationQuaternion = r.clone();Right is the result in BJS (red thing is added), and left how bone looks like in Blender. In BJS it should be rotated ~90deg by Y axis, so that it's parallel to the gun barrel. That bone is the last one, so I can't use next descendant to calculate direction vector.

Hi! I added water material (latest from Github repo) to my BJS (2.3 alpha) scene, showed it to my friend and got back print screen below. It also flickers from time to time. Graphics card is Nvidia Geforce 550 Ti, with latest drivers (updated today) Issue can be reproduced on BJS Playground in the materials section for water: http://www.babylonjs-playground.com/#1SLLOJ#17

Hi! In my scene I have multiple instanced robots with single skeleton. When two of them get near enough each they should start shooting lasers. Skeleton has a bone named "Arm.Gun L", its position and orientation already define the origin from where the laser is shot and its direction vector, the problem is that I can't find a way how to access the data. It need to be accessed and copied only once. Find the bone: this._bone = skeletons[0].bones.filter((b: BABYLON.Bone) => { return b.name === "Arm.Gun L";})[0];And when firing: var l = this._laser.createInstance("l");l.position = ? // this._bone.?l.rotation = ? // this._bone.?After looking through the docs for Bone and InstancedMesh (together with its base classes Mesh and Node) the only useful thing I found are local and globalMatrix methods on bones (if I could apply localMatrix to laser would probably do what I want with some minor fixes), but haven't found any efficient way of applying to a laser.

At the end I did it as I wrote in my last post. 2D Canvas overlaying 3D canvas where rectangle is drawn. The performance (frame time, render time, and potential FPS weren't affected), but the frame rate was slightly decreased (55-60fps) when rectangle was visible.All corners are then translated to 3D world coordinates (scene.pick method) (done when mouse button is released)All visible meshes (scene.getActiveMeshes) are stored into an array and filtered by:Name (to avoid skybox and ground)Checked if mesh is inside an rectangle using this. I'm sure the entire process can be speed up (a lot), but it will do for now.

@DK and JCPalmer, what I wanted was really the third options on my image which is a mix of both. (updated to make my question clearer for future readers) @G'kar, Thanks for the explanation! I tried exporting my model and normals weren't set as they should (that's why I came here). Tried again with a new exported Blender file (in a BJS Sandbox) and it works. Looks like I'll need to double check my code and Blend file. Thanks to all!

Hi! I'm trying to figure out how to set part of the mesh shading as smooth and part of it as flat. A quick sample on an image bellow rendered with Blender (from left to right): Mesh with smooth shadingMesh with flat shadingMesh with mixed shading (achieved with edge split modifier) <- what I wantIdeally shading type could be set per vertex group or per material.

I can try and shed some light on this "glitch", based on my understanding (I might be completely wrong). It's isn't a glitch at all, it would happen anywhere because of floating point format IEEE 754, a quick and rough explanation (with error estimation formula) is also at StackOverflow. In general, increasing the value of floating point number decrees the precision causing glitches like you've found. A quick look through Babylon.js source code, you can see that it uses Float32Array (single precision). The same issue was addressed also in Ogre3D engine some time ago (slides 130 and a few on, the main emphasis in the presentation is memory cache). The problem was visible already at coordinates around 6000. That's why some engines move the entire world around the camera instead of camera itself (will back with some material as soon as I find it again).

Hi Jaskar! 2. I came to a similar idea and after some exploring found an example from user gwenael. He has two canvases one over another, bottom one for 3D graphics and top one for 2D, where he draws rectangles and lines. It's a cool idea, just haven't found any information yet about performance penalty, if it's negligible or not. 3. Also came across my mind, but goal is to have somewhere around 1k - 5k objects and would like to have quick access. Number isn't that big at all, but JavaScript isn't exactly known for speed. A hybrid way of using Octree would probably be using getVisibleObjects (or something similar I found somewhere in the docs) and filtering afterwards. I'll proceed in this direction and let you know with what I came up in the next few days (and I'm also open for countless of other suggestions, bad and good ones). Thank you very much for your help !

Hi! The problem is that you only called FreeCamera method with the same arguments as for the ArcRotate camera. This is how you should create your FreeCamera. var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 1, -15), scene); And more reading material : https://github.com/BabylonJS/Babylon.js/wiki/05-Cameras

Hi! I'm trying to create unit (mesh) selection as it is in various strategy games(AoE, CnC (attached image) ...). After some exploring, I've came to the following, but there are a couple of steps I don't know how to do: 1. Hook to events (OK - trivial) 2. Draw lines using BABYLON.Mesh.CreateLines - at what position? Set LineMesh parent to camera? How to translate mouse position (scene.pointerX and Y) to world coordinates? Just draw rectangle and and set transformation matrix to identity (4x4)? Canvas 2d and 3d context can't be used together. 3. Once that is known, visible meshes are selected with octree (frustum plane is created and used for selection via octree.select method). But frustum plane can be very small and very close, or very big and far away (but this it's probably solved at step 2) I haven't really got to point 3. (got stuck at 2) so it's only my speculation. I'm open to suggestions if there are any better options . Explanation for attached image for non strategy game players: Green rectangle was drawn simply clicking in one corner and dragging. It's always orthogonal to camera view and at the same position (also based on camera) even if camera is moved or rotated. Its rendered above everything and every unit inside is selected. Thanks!

I recall a few thing back from my Blender days, but I forgot most of it. A couple of bugs in a model, flickering right arm, a couple of things could be better, a few normals to fix etc... small things, nothing Babylon related. I really don't know how I missed that...

I tested it out and it works! I currently went only through the first two steps (didn't bake the frames and left IK as it is). Works without any problems! Of course you can, I attached the full model if you want it (a friend of mine helped me with rigging, that's why it looks cool IMHO). In attached model curves are used as a handles (to control IK), which are perfect because they aren't exported leaving all of the clutter in blender file (or they can be moved to another layer). There are also a couple of bugs left, but I'll get there soon. A big thanks! I couldn't have asked for more help. Robot.zip

Hi gryff, Not offended at all, a lot of info is quite welcome (I'm not really a Blender expert) and your detailed explanation might help save some desperate souls . That leg it is indeed part of a bigger mesh, it can be seen in this thread, but I removed most of it because all that moving everywhere it was just hilarious, sad and confusing. While recreating my animation (a couple of posts back) I managed to successfully export it with Inverse Kinematics (no need to bake), I'll see if I can succeed again following your steps with IK. I'll try first thing in the morning! Thanks for all of the help ! Look like you really put a lot of effort into it.

Blend4Web looks like a cool project, but I share my opinion with Delkatosh - seems like a different goal (not primary game oriented). After a day figuring out what the problem might be I found out that the problem is in Blender as the "bug" can be recreated in it. I recreated all of the handles, linked to Inverse Kinematics bone modifiers, reanimated and it works (for now). But am still interested what went front the first time, because I did everything exactly the same (not exactly I guess).