Jump to content

Blender exporter UV problems


linkus
 Share

Recommended Posts

Hey yall,

 

I see there'd been some advancements with the blender exporter (which is great!), but I'm bumping into a serious problem. Tell me if this is only me and I'm doing something wrong or it's a bug of some sort.

 

Anyway, a typical workflow is:

1. Create a model.

2. UV Unwrap.

3. Create a material - > assign it to the mesh.

4. Bake lightmaps (cycles bake) to the texture node.

5. Link the texture image color output with the color input of my Diffuse BSDF node (so that the baked texture is the final output for my material).

6. Save (! important, as babylon exporter started crashing my blender since version 4).

7. Export to babylon.

 

Everything works fantastically, except when I export it to babylon, it somehow resets my UV coordinates, not only in the exported file, but in blender too.

 

To illustrate my issue I'm attaching two images. The first one is right before the export, next one is right after exporting to babylon. (notice the floor texture).

 

Anyone experiencing something similar? 

post-17227-0-68430600-1450785202_thumb.p

post-17227-0-43616800-1450785204_thumb.p

Link to comment
Share on other sites

        # you need UV on a mesh in order to bake image.  This is not reqd for procedural textures, so may not exist        # need to look if it might already be created, as for a mesh with multi-materials        uv = mesh.data.uv_textures[0] if len(mesh.data.uv_textures) > 0 else None        if uv == None:            mesh.data.uv_textures.new('BakingUV')            uv = mesh.data.uv_textures['BakingUV']        uv.active = True        uv.active_render = True        # UV unwrap operates on mesh in only edit mode        # select all verticies of mesh, since smart_project works only with selected verticies        bpy.ops.object.mode_set(mode='EDIT')        bpy.ops.mesh.select_all(action='SELECT')        bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True)

I think it has to do with row 1975:

bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True)

 

Even when an existing UV texture is found, it will be unwrapped again with the smart_project commando. (Smart UV project in blender). Clearing your existing UV texture.

Link to comment
Share on other sites

You could be right.  4.0 tried to let you use a UV, if you already had one, but it looks like 1973-1975 also needs to be moved after 1966.  I can not remember if baking needs to have mesh in edit mode with all verts selected.  If no, changing back may also need to be moved 2010-2014.  If yes,1973 & 1974 need moved up to 1959.

 

I mustered enough attention to get 4.0 out the door in Dec, but really slacked off recently.  Glad this was brought up though.  Would not like to over promise when I would do this.  It is just moving lines around.  If someone wants to do this before me, just remember to change the version # to 4.0.1

Link to comment
Share on other sites

Somehow it started working without me changing anything in the workflow. Might've been a bug in blender(?), but I deleted that object with the problematic UV coordinates and created a new one and it worked fine... Probably just a christmas miracle :D

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