Jump to content

Issue exporting textured model from blender


David78
 Share

Recommended Posts

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

Link to comment
Share on other sites

Hi David, I took a look at your .blend file and to be honest it is a bit messy - it seems to have four scenes in it - three of which seem to be duplicates. Not sure how the exporter handles that situation but looking at your babylon file it does seem to contain all the materials you have defined in all the scenes.

 

Final Creature

 

Anyway, I created a clean blend file and then imported the .003 body - I still could not see your character in the exported .babylon file but could see a simple textured cylinder that I added to the scene. Looking at your material/textures, I found 5-6 materials that were not assigned to any parts of the mesh - so I deleted all those. Still could not see the character. So I deleted the one remaining material and texture and created a new one. It worked. :) (See above)

 

Somewhere in your material/texture settings you seem to have a setting I think which is making the whole mesh transparent.

 

By they way, the model looks like it came from MakeHuman (poly count and UVmap). If you use MH, I prefer the "game rig".

 

cheers, gryff :)

Link to comment
Share on other sites

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.  :D

 

post-11887-0-40609500-1420141601.jpg

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...