• Content Count

  • Joined

  • Last visited

About Stalker

  • Rank

Recent Profile Visitors

881 profile views
  1. @Temechon, thanks a lot for the update. But I'm experiencing two problems. 1. Alpha isn't working (but probably I'm doing something wrong): Code that I used: var material: BABYLON.GradientMaterial; material = new BABYLON.GradientMaterial("selection-material", this.scene); material.topColor = BABYLON.Color3.Red(); material.topColorAlpha = 0; material.bottomColor = BABYLON.Color3.Green(); material.bottomColorAlpha = 1; material.offset = 0; material.backFaceCulling = false; material.smoothness = 50.0; // var tube: BABYLON.Mesh; // tube = BABYLON.Mesh.CreateTube("selection", path, 1, 12, radiusFunc, 0, this.scene, false); var tube = BABYLON.Mesh.CreateCylinder("cy", 100, 1, 1, 12, 1, this.scene); tube.material = material; tube.isPickable = false;2. Don't really know how to explain, so I'll add an image. Colors transition isn't correct, it is only when mesh height is equal or greater than 100. Code is the same as the one above (alphas and smoothness properties were not set). Left is height 100, the right one is 20. @Stvsynrj, thanks! Your solution is quite similiar to the Wingnut's. I'd like to avoid additional images (and top edge) so I'll go with this option as a last resort .
  2. @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.
  3. 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?
  4. 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 .
  5. Instead of waiting I created the build myself and it works ! Thanks a lot!
  6. Thanks a lot! I blindly believed that clone clones entire structure. Is there any simple way of creating deep clone for material (including all submaterials)? Or is a loop the way?
  7. 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.
  8. 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: 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.
  9. 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.
  10. Didn't really thought using it like this. Smart! Thanks, it works !
  11. 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:
  12. 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 === "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.
  13. You have a space at the end of the link, causing 404 error.
  14. 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.
  15. @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!