Search the Community
Showing results for tags 'decal'.
-
Hey everybody, I feel like this one will be easy for you! I have one transparent mesh and I apply a decal on it. I want the decal to be visible even from the other side of the mesh. I try to set the backFaceCulling property to true on both mesh and decal material but it doesn't work : https://www.babylonjs-playground.com/#1BAPRM#164 Bye, Pichou
-
What is the correct image format to use your own decal texture? I tried a lot of different images in my project but none have worked so far except the babylon one. I guess the image must be png and black on white? Here is a playground with one image test : http://www.babylonjs-playground.com/#1BAPRM#159
-
With this cat, if I add the decal then it works fine, but if I rotate the cat then add the decal it will not show. How can I transform the decal so it would fit on the rotated cat? http://www.babylonjs-playground.com/#1BAPRM#100 In general, if I rotate and translate a mesh, what do I need to do to the decal position and normal to fit the rotated/translated mesh? I'm using decals on specific areas, like on a person's heart or bellybutton and I want to be able to apply that decal anytime after the mesh has moved.
-
Hi, dear programmers! I am making a decal blood like in this example http://www.babylonjs-playground.com/#1BAPRM#81 All works fine if my mesh is static, but when my mesh is animating then the decal take first frame and that all. I set skeleton for the decal, but does not metter, decal don't animates. Like on the screenshot, the left pic is when I shooted and the right pic is one sec after the shot: How I can do implement an animating decals?
-
I'm currently testing things with decals, however my entire stage in on a widen out sphere with `.scaling = new BABYLON.Vector3(25, 1, 25)`. But it seems as if decals are being treated like my sphere was never scaled; they wrap around a round sphere instead of the stretched one. I confirmed the behavior that if you select the box, the decal goes beneath the sphere: http://www.babylonjs-playground.com/#PSKRF#8 So basically do you have any suggestions on how I can tackle my issue? I have considered these approaches: * Replace the sphere with a very similar heightMap. heightMaps can be scaled and decals respect that. However I would prefer not using heightMap for a sphere issue as of now. * Maybe I need to make Babylon get that I scaled the sphere more than just setting .scaling? * Try some wonky texture placing on sphere which I think will be a lot of work Could be something I'm missing as of now which I would gladly get told.
-
Hello Babylonians, I hope everyone is having a great weekend, and not working like me. I have a scene where I'm drawing on objects with textures using decal. I was drawing on objects using multiple canvas' onto a dynamic texture - however, since this is a real-time multiple user app, I'm not able to create additional canvas' for each user who is on the session to allow unique colors (textures) to be drawn from remote events (the example below is single user and just a basic drawing function and minimal elements.) The issue is of course an expected problem with this new draw function: as I add texture color to my scene objects, it is using memory and decreasing my framerate to the pont where it becomes not a useful tool. Is there a way for me to use a dynamic texture in this script using the same function (decal), or to instance the textures in a way to avoid memory usage for each pick point (draw)? I would really like to use a dynamic texture so that I could save out each object's texture image. However, I was doing this initially, and I have many, many colors (textures), as well as many users drawing together in real time on any object. This doesn't allow for me to use the canvas to pass color information (textures) to a dynamic texture on each object, as I require multiple canvas' for each remote user. The following is a scene to be copied into the playground. Unfortunately, it is too many lines to save as a playground scene. But just copy and paste, and it will run. var createScene = function () {var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI/2, 1.1, 10, new BABYLON.Vector3(2, 0, 0), scene);//camera.attachControl(canvas, true); var hemilight = new BABYLON.HemisphericLight("hemi", new BABYLON.Vector3(0, 1, 0), scene);hemilight.groundColor = BABYLON.Color3.Gray();hemilight.specular = BABYLON.Color3.Black(); var face = BABYLON.Mesh.CreateSphere("sphere", 3.0, 3.0, scene);face.scaling = new BABYLON.Vector3(1.0,1.3,1.0);face.rotation = new BABYLON.Vector3(Math.PI / 2, Math.PI / 5, Math.PI / 2);face.material = new BABYLON.StandardMaterial("sMat", scene);face.material.diffuseTexture = new BABYLON.Texture("http://i75.photobucket.com/albums/i309/Athox/Scared_face.jpg", scene);face.material.diffuseTexture.hasAlpha = false;face.position = new BABYLON.Vector3(2, 0, 0);face.material.diffuseTexture.uOffset = 1.0;face.material.diffuseTexture.vOffset = 1.85;face.material.diffuseTexture.uScale = 1.1;face.material.diffuseTexture.vScale = -1.0; var hat = new BABYLON.Mesh.CreateCylinder("cylinder", 4, 3, 3, 5, scene);hat.scaling = new BABYLON.Vector3(0.4, 0.5, 0.4);hat.rotation = new BABYLON.Vector3(Math.PI/4,Math.PI/9,-Math.PI/27);hat.material = new BABYLON.StandardMaterial("Mat", scene);hat.material.diffuseTexture = new BABYLON.Texture("http://st.depositphotos.com/1000635/3769/i/950/depositphotos_37695355-Seamless-yellow-sponge-texture-background..jpg", scene);hat.position = new BABYLON.Vector3(2.7, 1.5, 0.9);hat.setEnabled(true); var draw_mat = new BABYLON.StandardMaterial("draw_mat", scene);draw_mat.diffuseTexture = new BABYLON.Texture("http://i.imgur.com/f1ARb.png", scene);draw_mat.diffuseTexture.hasAlpha = true;draw_mat.zOffset = -.5; var isDown = false; var onPointerDown = function (evt) {if (evt.button !== 0) {return;} isDown = true;var pickInfo = scene.pick(scene.pointerX, scene.pointerY);if (pickInfo.hit) {console.log(pickInfo.pickedMesh.name);var decalSize = new BABYLON.Vector3(.1, .1, .1);var newDecal = BABYLON.Mesh.CreateDecal("decal", pickInfo.pickedMesh, pickInfo.pickedPoint, pickInfo.getNormal(true), decalSize);newDecal.material = dmat;}} var onPointerUp = function() { isDown = false; } var onPointerMove = function (evt) {if (evt.button !== 0) {return;} var pickInfo = scene.pick(scene.pointerX, scene.pointerY);if(isDown) {console.log(pickInfo.pickedMesh.name);var brush = new BABYLON.Vector3(.1, .1, .1);var idraw = BABYLON.Mesh.CreateDecal("decal", pickInfo.pickedMesh, pickInfo.pickedPoint, pickInfo.getNormal(true), brush);idraw.material = draw_mat;}} canvas.addEventListener("pointerdown", onPointerDown, false); canvas.addEventListener("pointerup", onPointerUp, false); canvas.addEventListener("pointermove", onPointerMove, false); scene.onDispose = function () { canvas.removeEventListener("pointerdown", onPointerDown); canvas.removeEventListener("pointerup", onPointerUp); canvas.removeEventListener("pointermove", onPointerMove);} return scene;}; Hey DK - is there any way we might increase the # of characters to save a playground scene? Who might have control over this? Thanks, DB
-
Hi again, here an over problem I don't understand. In my projet (a strategy game) when I construct a new building I put on the floor a decal, but this decal look's like very dark when normal vector is positive, and when is negative no shadow cast on it... Here the code : I put in attachment a picture to be more clear. have a nice day