Jump to content

Blender Exporter & Multimaterials


primesoftware
 Share

Recommended Posts

I have the latest Blender exporter (4.6.1) and I am trying to export a model that has some faces textured via UV Unwrap and other faces are just a plain old color. When I export the model it only exports a single material for the textured faces and applies that texture to the non-unwrapped faces as well. The material with just a color does not get exported. I was considering getting the face indexes from Blender and trying to sub-mesh this thing, but the indexes are not nice ranges and Babylon doesn't seem to have a function that would take an array of faces to submesh. Any ideas? I think this worked in a previous version (its been awhile since I've used Babylon last).

Link to comment
Share on other sites

@primesoftware : Hi prime, welcome to the forum :)

I ran a quick test with Blender 2.76 and BE 4.6.1. I created a cone object and divided the sides into two so I had a top and bottom area. I deleted the base. Now I gave the bottom and top materials - Material1 and Material2. I UV unwrapped the bottom area and added a texture to its material.  Usual stuff - nothing fancy.

I exported to babylon and viewed it in the sandbox - see image below. Looks fine.

I suspect there is more to your problem than the exporter.

Can you post your model somewhere?

cheers, gryff :)

 

2materials1.png

Link to comment
Share on other sites

And here is a zip file containing my .blend, .babylon and the texture files. (The texture is packed into the .blend file so you should not need the texture file.)

If you check the babylon file you will see this for the materials:

"materials":[{"name":"mat.Material1","id":"mat.Material1","ambient":[0.8,0.8,0.8],"diffuse":[0.64,0.64,0.64],"specular":[0.5,0.5,0.5],"emissive":[0,0,0],"specularPower":50,"alpha":1,"backFaceCulling":true,
"checkReadyOnlyOnce":false, "diffuseTexture":{"name":"grid1.png","level":1,"hasAlpha":1,"coordinatesMode":0,"uOffset":0,"vOffset":0,"uScale":1,"vScale":1,"uAng":0,"vAng":0,"wAng":0,"wrapU":1,"wrapV":1,"coordinatesIndex":0}},

{"name":"mat.Material2","id":"mat.Material2","ambient":[0.8,0.8,0.8],"diffuse":[0.64,0.64,0.64],"specular":[0.5,0.5,0.5],"emissive":[0,0,0],"specularPower":50,"alpha":1,"backFaceCulling":true,"checkReadyOnlyOnce":false}],

"multiMaterials":[{"name":"mat.Multimaterial#0","id":"mat.Multimaterial#0","materials":["mat.Material1","mat.Material2"]}],

cheers, gryff :)

Link to comment
Share on other sites

@primesoftware Morning prime :)

So I looked at your file and the first thing I did was export it to BJS and look at the result and got what you describe

23 hours ago, primesoftware said:

a single material for the textured faces and applies that texture to the non-unwrapped faces as well

I looked at the log file and see only this:

processing begun of baked material:  CounterCard
			Internal baking texture, type: TEXTURE, mapped using: UVMap
			Internal baking texture, type: NORMALS, mapped using: UVMap

and just two textures in a .jpg format. The Blender Exporter is going into bake mode. The reason is the material (LEDTrim) and texture (Blender procedural Texture : "clouds") you are applying to the card. So I deleted that clouds texture, saved the file, reloaded it and then exported again.  Now I see your texture files and the baking process stops. If I want to use a procedural texture - I would bake it out manually, then, replace that prodedural texture with the image you have just baked.

But there are still some issues.

1. When I export I get 16 warnings due to the fact that the "segments" of the two "eights" have no material applied.

2. I do not see the display due to the fact that there is an object "CounterHitBox" covering it. In the Scene Graph Outliner, for this CounterHitBox object,  click the little eye and camera so that they are both greyed out (you can also move that to another layer and not export that layer).

So try the above and let me know what you get.

cheers, gryff :)

Link to comment
Share on other sites

@gyrff AWESOME!!! That LEDTrim material was downloaded from somewhere so I didn't even realize it was procedural. I put the hit box there for clicking purposes....I usually set it as invisible when loaded in BJS. The 8's I set dynamically since the material changes as I cycle the digits. You really saved me here! I appreciate it!

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