David78

Members
  • Content Count

    19
  • Joined

  • Last visited

About David78

  • Rank
    Member

Recent Profile Visitors

538 profile views
  1. @gryff I appreciate the help. Upgrading to the blender 1.5.0 exporter fixed everything, so I suppose that was the cause of the missing faces. Thanks for the practical pointers on how to deal with the 4 bones issue and all using vertex groups.
  2. forgot to say, I cannot upload the character that didn't show at all, because I deleted it out of anger...but nonetheless, the question still stands, even though it is a strange question.
  3. Thanks to all for your swift responses. @gryff Yes, it is the same character, different texture. As you can see in my first post, I acknowledge this: And go on to cite instances where for one reason or another, one decides to rig the character by themselves. I rigged that character by myself and opted not to go with MH's gaming rig. The reason is, as I keep saying, I am learning both blender and Babylon.js (saying "BJS" sounds weird to me... ) and hence decided to give rigging a shot. The question is more practical than technical; I'm asking how to rig specifically for babylon.js; as far as I'm concerned, all I did was place the bones, do the automatic weight painting, brushed things up a bit, animated and then exported. I've attached the file,so you (or anyone who is also willing to) can show me where I went wrong, I greatly appreciate your help thus far. [Please link the texture in the zip file to the model in blender if you want to...] The question: During the rigging and weight-painting process, how would one do it so as to avoid exceeding the 4 bone influencers per vertex limit? Is there a way then to tell blender not to exceed it; or is there somewhere in blender where it is shown, before exporting? Yes it is reported in the log file, but it is already exported and only serves as a warning, not as a measure that could be taken to avoid the limit being exceeded and hence the error's existence. animation.zip
  4. Hi to all. There really isn't any issue here; as exporting animations to babylon from blender works fine, except for the "4 bone influencers per vertex" limitation. I understand that it is a browser thing: http://www.html5gamedevs.com/topic/10772-blender-export-issues/ http://www.html5gamedevs.com/topic/9560-rigging-rigify-blender-export-babylon/ My question is sort of strange, but I'll ask it anyways. I have no idea how to rig following this limitation in blender. How would one go about ensuring that this limit is not exceeded? Sure importing a MakeHUman model with the gaming rig, 32 bones I think, enabled would work, but when of the times when one is not rigging humanoid characters? Like sea monsters? Or giant insects? or something like that? And even if one is rigging a humanoid character, what of when the MH rig just doesn't do what you'd want and you have to do your own rig? So how would one make rigs ensuring that that limit is not exceeded? Any pointers on how to go about this would be appreciated. I also have one other question, would it possible to have babylon.js come with something like a visual editor for rigging? You import your static models and then rig them using it; it should guide the rigging process so that this "4 bone influencers per vertex" thing is not exceeded. (Please don't tell me to build it myself! ; at least not now!) Those are my questions. I attached a picture showing what happens when the limit is exceeded; the animation works but some areas are invisible. Other rigs I did did not show at all once exported to the .babylon format. Thanks in advance.
  5. Hi gryff and thank you so much for your extremely detailed help. This is a pretty amazing community, I must say, after a few hours the issue is solved. Yes I did get the mesh from MH, because it was taking me ages to finish a whole model from scratch (see attached for screenshot of masked-head) and I am still learning the ropes as I keep saying, so it made no point to go through all that just to see imported textures and animations in babylon.js. Sorry about the messed up .blend file, I'm also still learning how to use it, and I hope to get better with time. Again, I really appreciate you helping me, restarting the file and loading up the .003 and then re-applying the materials and textures cleared it all up.
  6. Hi there everyone. I've been learning modelling and animation in blender as part of establishing a working pipeline from blender->babylon. Currently, I'm working on exporting textured meshes. I made a mesh of a goblin-like creature and textured it and applied a pinkish material to it. I exported it to babylon and there seemed to be no issue, except that when running the script, it was blank. I did put the texture in the same directory as the .babylon file and used blender render as opposed to cycles render. Here is the code that executes the script: if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); scene = new BABYLON.Scene(engine);BABYLON.SceneLoader.ImportMesh("", "", "FACE.babylon", scene, function (newMeshes, particleSystems) // Wait for textures and shaders to be ready{ scene.executeWhenReady(function () { // Attach camera to canvas inputs //scene.activeCamera.attachControl(canvas); var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI, Math.PI / 8, 150, BABYLON.Vector3.Zero(), scene);camera.attachControl(canvas, true); light0 = new BABYLON.DirectionalLight("hemi", new BABYLON.Vector3(0, 1, 0), scene); scene.collisionsEnabled = true; // Material var matPlan = new BABYLON.StandardMaterial("matPlan1", scene); matPlan.backFaceCulling = false; matPlan.emissiveColor = new BABYLON.Color3(0.2, 1, 0.2); var plan1 = BABYLON.Mesh.CreatePlane("plane1", 20, scene); plan1.position = new BABYLON.Vector3(13, 0, 0); plan1.rotation.x = -Math.PI / 4;plan1.checkCollisions=true;// Once the scene is loaded, just register a render loop to render itengine.runRenderLoop(function() { scene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }As you can see, it's just like the example code. I've attached a zip that has the .blend and the .babylon and the textures used for the object. I would highly appreciate it if someone could view the .babylon or export the .blend to .babylon and help me see where exactly the issue is. I should mention that this is just for learning purposes, in the event that this leads to an actual game, then the poly count will be reduced to a reasonable number. Thanks in advance for your time. resources.zip
  7. I suppose the issue has been solved, it is the nature of the heightmap that is used. Even when using the heightmap that you've modified, everything still falls through, but not completely, only mid-way; however, upon walking, the character falls completely through. It's just increasing the grey-scale intensity of the image that fixes it completely, thanks for the help. I used a different heightmap I generated using this package here: http://nemesis.thewavelength.net/index.php?p=9 It's very good for generating different types of terrains. Using the new attached terrain works,well for example, the first one I just downloaded from the net. [with this small change to make the wall's elevation higher: Mur.position.y = 7.1; ] If I may ask, what are you using to generate or modify your heightmaps? Thanks.
  8. It seems Babylon doesn't like certain heightmaps... Changing the heightmap from the one I have, to the one you're using makes it work fine. However, using the attached heightmap inhibits the collision detection,everything just falls through. You can try and use it and see if you get the same results. Instead of: var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "map.jpg", 100, 100, 100, 0, 12, scene, true); try: var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "DoubleBasin_big/DoubleBasin_big.png", 100, 100, 100, 0, 12, scene, true); Using the first heightmap detects collision, however, using the second one does not. The second heightmap is attached. How can this issue be addressed?
  9. Thank you both for your replies, and thanks dad72 for the working demo. Well that part that you mention, is also implemented in the code. In fact, here is the whole exact code that I use, the same as dad72 uses: var canvas = document.getElementById("renderCanvas");var PlayAnnimation = false, PlayerCharger = false, skybox, scene, sceneCharger = false, meshPlayer, meshOctree, skeletonsPlayer = [], cameraArcRotative = [], octree, keys={letft:0,right:0,arriere:0,avancer:0}, VitessePerso = 5, forward, backwards;function animatActor(){ if(PlayAnnimation === false && (keys.avancer == 1 || keys.arriere == 1)) { totalFrame = skeletonsPlayer[0]._scene._activeSkeletons.data.length; start = 0; end = 100; VitesseAnim = parseFloat(100 / 100); scene.beginAnimation(skeletonsPlayer[0], (100*start)/totalFrame, (100*end)/totalFrame, true, VitesseAnim); meshPlayer.position = new BABYLON.Vector3(parseFloat(meshPlayer.position.x), parseFloat(meshPlayer.position.y), parseFloat(meshPlayer.position.z)); PlayAnnimation = true; } if (keys.avancer == 1){ // En avant forward = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(meshPlayer.rotation.y))) / VitessePerso, 0.5, parseFloat(Math.cos(parseFloat(meshPlayer.rotation.y))) / VitessePerso); forward = forward.negate(); meshPlayer.moveWithCollisions(forward); } else if (keys.arriere == 1) { // En arriere backwards = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(meshPlayer.rotation.y))) / VitessePerso, -0.5, parseFloat(Math.cos(parseFloat(meshPlayer.rotation.y))) / VitessePerso); meshPlayer.moveWithCollisions(backwards); } }// Cameras rotative qui suit l'acteur joueurfunction CameraFollowActor(){ meshPlayer.rotation.y = -4.69 - cameraArcRotative[0].alpha; cameraArcRotative[0].target.x = parseFloat(meshPlayer.position.x); cameraArcRotative[0].target.z = parseFloat(meshPlayer.position.z); }function createScene() { var engine = new BABYLON.Engine(canvas, true); engine.displayLoadingUI(); scene = new BABYLON.Scene(engine); //Active gravity and collision scene.gravity = new BABYLON.Vector3(0, -0.5, 0); scene.collisionsEnabled = true; // Light directional var LightDirectional = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(-2, -4, 2), scene); LightDirectional.diffuse = new BABYLON.Color3(1, 1, 1); LightDirectional.specular = new BABYLON.Color3(0, 0, 0); LightDirectional.position = new BABYLON.Vector3(250, 400, 0); LightDirectional.intensity = 1.8; // Camera 3 eme personne cameraArcRotative[0] = new BABYLON.ArcRotateCamera("CameraBaseRotate", -Math.PI/2, Math.PI/2.2, 12, new BABYLON.Vector3(0, 5.0, 0), scene); cameraArcRotative[0].wheelPrecision = 15; cameraArcRotative[0].lowerRadiusLimit = 2; cameraArcRotative[0].upperRadiusLimit = 22; cameraArcRotative[0].minZ = 0; cameraArcRotative[0].minX = 4096; scene.activeCamera = cameraArcRotative[0]; cameraArcRotative[0].attachControl(canvas); // Terrain var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "DoubleBasin_big/DoubleBasin_big.png", 100, 100, 100, 0, 12, scene, true); var groundMaterial = new BABYLON.StandardMaterial("groundMat", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("tiles-56/arroway.de_tiles-56_d100.jpg", scene); groundMaterial.diffuseTexture.uScale = 5.0; groundMaterial.diffuseTexture.vScale = 5.0; ground.material = groundMaterial; ground.checkCollisions = true; // Wall var Mur = BABYLON.Mesh.CreateBox("Mur", 1, scene); Mur.scaling = new BABYLON.Vector3(15, 6, 1); Mur.position.y = 3.1; Mur.position.z = 20; Mur.checkCollisions = true; // Character import BABYLON.SceneLoader.ImportMesh("him", "Dude/Dude/", "dude.babylon", scene, function (newMeshes, particleSystems, skeletons) { meshPlayer = newMeshes[0]; meshOctree = newMeshes; meshPlayer.scaling= new BABYLON.Vector3(0.05, 0.05, 0.05); meshPlayer.position = new BABYLON.Vector3(-5.168, 1.392, -7.463); meshPlayer.rotation = new BABYLON.Vector3(0, 3.9, 0); cameraArcRotative[0].alpha = -parseFloat(meshPlayer.rotation.y) + 4.69; skeletonsPlayer[0] = skeletons[0]; skeletonsPlayer.push(skeletons[0]); var totalFrame = skeletons[0]._scene._activeSkeletons.data.length; var start = 0; var end = 100; var vitesse = 100 / 100; scene.beginAnimation(skeletons[0], 100*start/totalFrame, 100*end/totalFrame, true, vitesse); meshPlayer.checkCollisions = true; meshPlayer.ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5); meshPlayer.ellipsoidOffset = new BABYLON.Vector3(0, 2, 0); meshPlayer.applyGravity = true; }); scene.registerBeforeRender(function(){ if(scene.isReady() && meshPlayer) { if(sceneCharger == false) { engine.hideLoadingUI(); sceneCharger = true; } animatActor(); } }); engine.runRenderLoop(function () { scene.render(); if(scene.isReady() && meshPlayer){ CameraFollowActor(); if(PlayerCharger == false) { scene.stopAnimation(skeletonsPlayer[0]); PlayerCharger = true; octree = scene.createOrUpdateSelectionOctree(); for(var i = 0; i < meshOctree.length; i++) { octree.dynamicContent.push(meshOctree[i]); } } } }); window.addEventListener("resize", function () { engine.resize();}); window.addEventListener("keydown", onKeyDown, false); window.addEventListener("keyup", onKeyUp, false);}// Gestion du clavier quand on presse une touchefunction onKeyDown(event) { var touche = event.keyCode; var ch = String.fromCharCode(touche); switch (touche) { case 16: // MAJ Le perso cours VitessePerso = 2.5; break; case 32: // ESPACE le perso saute keys.saut=1; break; } // Clavier AZERTY if (ch == "Z") keys.avancer=1; if (ch == "Q") keys.left=1; if (ch == "S") keys.arriere=1; if (ch == "D") keys.right=1;}// Gestion du clavier quand on relache une touchefunction onKeyUp(event){ var touche = event.keyCode; var ch = String.fromCharCode(touche); switch (touche) { case 16: // MAJ Le perso marche VitessePerso = 5; break; case 32: // ESPACE le perso ne saute plus keys.saut=0; break; } // Clavier AZERTY if (ch == "Z") keys.avancer=0; if (ch == "Q") keys.left=0; if (ch == "S") keys.arriere=0; if (ch == "D") keys.right=0; PlayAnnimation = false; scene.stopAnimation(skeletonsPlayer[0]);}As you can see, I have not changed a thing other than the heightmap and texture and path to the dude.babylon file, it even maintains the French! The part you mention, is also there: if (keys.avancer == 1){ // En avant forward = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(meshPlayer.rotation.y))) / VitessePerso, 0.5, parseFloat(Math.cos(parseFloat(meshPlayer.rotation.y))) / VitessePerso); forward = forward.negate(); meshPlayer.moveWithCollisions(forward); } else if (keys.arriere == 1) { // En arriere backwards = new BABYLON.Vector3(parseFloat(Math.sin(parseFloat(meshPlayer.rotation.y))) / VitessePerso, -0.5, parseFloat(Math.cos(parseFloat(meshPlayer.rotation.y))) / VitessePerso); meshPlayer.moveWithCollisions(backwards); }Even the wall mesh that does not move just falls right through the terrain when the scene has finished loading. Dad72, if it's not too much to ask, can you kindly produce a .zip file that has this demo; or could you please look at the above code and perhaps point out why when it is run in my local server, the wall mesh and the character mesh just fall through the terrain mesh, and in fact, no collision is detected anywhere in the scene, even between the wall and the character? Thanks in advance.
  10. Hi to all, This question regards collision-detection on a terrain and also on other meshes. Going through this example here: https://github.com/BabylonJS/Babylon.js/wiki/09-Cameras-collisions And playing with it in the playground and even on my local server, everything works as it should, collision detection is enabled and the camera does not fall through the mesh and it also hits the box. This is really good for an FPS. The issue comes when one uses this same technique without a camera, like so: scene.gravity = new BABYLON.Vector3(0, -0.5, 0); scene.collisionsEnabled = true; //terrain: var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "DoubleBasin_big/DoubleBasin_big.png", 100, 100, 100, 0, 12, scene, true); var groundMaterial = new BABYLON.StandardMaterial("groundMat", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("tiles-56/arroway.de_tiles-56_d100.jpg", scene); groundMaterial.diffuseTexture.uScale = 5.0; groundMaterial.diffuseTexture.vScale = 5.0; ground.material = groundMaterial; ground.checkCollisions = true;//wall:var Mur = BABYLON.Mesh.CreateBox("Mur", 1, scene);Mur.scaling = new BABYLON.Vector3(15, 6, 1);Mur.position.y = 3.1;Mur.position.z = 20;Mur.checkCollisions = true;//loaded character: meshPlayer.checkCollisions = true; meshPlayer.ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5); meshPlayer.ellipsoidOffset = new BABYLON.Vector3(0, 2, 0); meshPlayer.applyGravity = true; That would be good for a third person type of thing. The code is from dad72's demo here: http://www.castorengine.com/babylon/moveCharacter/ It works fine on that link, however when I downloaded the source and ran it on the local server, everything just falls through the terrain's mesh. The code is unchanged with the exception of using different materials and a different heightmap. Is there something missing somewhere on my part, once the code is run locally? There isn't any physics, just in-built babylon.js collision. This example from my perspective is extremely impressive, as it shows how easy it is to build a game. The only thing that's left is just adding a story-line with different characters, environments and so on! This is a really amazing engine! Thanks in advance.
  11. Thank you both for your answers. It makes sense that the mesh is slightly displaced from loading it from blender. I never thought that that would affect it however, it is rather meticulous! On the second question, yes I thought of using vertex deformation but before doing so was wondering if Babylon.js had an-in built way of handling this specific case.
  12. These are two simple questions, regarding parent-child relationships. It's not that I don't get this: " Any postion, rotation and scaling transformations made to the parent... prior to assigning it to children... will also be applied to the children when the parent is assigned. " What's happening rather is that when I load two meshes and make the first one the parent of the second or vice versa, there is an initial displacement in the child's position. On loading the meshes, this is the only line of code involving them, the rest sets up the camera, lights, etc: newMeshes[1].parent = newMeshes[0];Which results in newMeshes[1] being displaced. When newMeshes[0] is moved after this it works fine, whatever transformations are done on it are also done to newMeshes[1], the issue is this initial displacement. The second question is whether parent-child relationships can be defined between specific parts of a mesh and another mesh. For example, say a human-like mesh is loaded that has skeletal animation where one hand moves up and down, and I want a sphere or another mesh to also move based on the motion of this one hand and not of the entire body. (Without using sub-meshes) how can this be done? Can a mesh be attached to the motion of skeletal animation? Still a noobie learning the ropes... Thanks in advance.
  13. Thanks for the help. I need to manipulate the shape of the imported mesh and to also merge different meshes together, that's why I'd use VertexData as opposed to cloning.
  14. Here is a list of properties that I cannot access, even though in the file they are defined and they do have set values: useFlatShading. (in the file: "useFlatShading:" false) positions. (in the file: "positions:"-> a huge array with floats) normals.(in the file: "positions:"-> a huge array with floats) indices.(in the file: "positions:"-> a huge array with floats) uvs.(in the file: "positions:"-> a huge array with floats) It's weird that I can't access those values, yet the mesh is loaded properly and the flower and the vase are properly displaying. I saw that one can get the vertex data from a mesh using this: var ver_dat=new BABYLON.VertexData.ExtractFromGeometry(newMeshes[0]);trying to access the vertex data works fine when one writes: alert(vert_dat.positions) etc but not when one writes: alert(newMeshes[0].positions) I feel like it's something obvious that I'm not seeing somewhere (I am a newbie after all...)....anyways, another way would be to just use the extracted vertex data to form a new mesh, but I don't exactly know how to go about doing that. After getting the vertex data from mesh A, how would I use this to make a new mesh B, so that from mesh B I can access all the mesh properties that I currently cannot from the original mesh A? Thanks.
  15. That doesn't seem to be the case, displaying newMeshes[0].name alerts "vase", which is one of the two meshes I've imported from blender...I've attached the .babylon file but changed the extension to .txt so that I could upload it. I've attached it to my original post. If you look at it, you'll see that it does have the properties with set values that I'm trying to access.