Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export smoothed model messes with UVs #3

Open
plsmsphr opened this issue Apr 27, 2016 · 4 comments
Open

Export smoothed model messes with UVs #3

plsmsphr opened this issue Apr 27, 2016 · 4 comments

Comments

@plsmsphr
Copy link

Hi,

when exporting a smoothed model without sharp edges the UVs get messed up. So I'm forced to split the edges along the seams.
This looks bad on a model with a normal map which is baked from a high poly mesh.

Is this a restriction from md3 format or can this be fixed in the export script?

@neumond
Copy link
Owner

neumond commented Apr 27, 2016

Hi, I think I understand what is your problem. MD3 requires vertices to have hard-binded values of normal and UV, if you need same position, but with different normal or UV, you have to duplicate vertices. Script does detect cases where you have different normal values for same vertex and duplicates them automatically, but it doesn't consider UV coords.

@neumond
Copy link
Owner

neumond commented Apr 27, 2016

I'm not sure whether I fixed it, but try this: https://github.com/neumond/blender-md3/tree/uvfix

@plsmsphr
Copy link
Author

Thanks for the quick fix, the UVs are left untouched now, though there are still those sharp edges left.

I can manually create an object with split edges and still keep its normals smooth:

  • copy the object without sharp edges
  • split the seamed edges on the export object manually, now they are sharp
  • add DataTransfer modifier to the export object and transfer custom normals from the copied smooth object, so the normals are smooth again
  • now when I export the model the exporter applies edgesplit again so the model ends up having sharp edges.

Maybe an option to export meshes without automatic edge splitting could solve this.

Btw, an option to export only selected meshes would be nice, so it wouldn't be necessary to create separate files for each model.

@neumond
Copy link
Owner

neumond commented Apr 28, 2016

Oh my blender is little bit outdated, but let me guess
https://www.blender.org/manual/modeling/modifiers/modify/data_transfer.html

First key thing to keep in mind when using this modifier is that it will not create destination data layers. Generate Data Layers button shall always be used for this purpose, once set of source data to transfer is selected. It should also be well understood that creating those data layers on destination mesh is not part of the modifier stack, which means e.g. that they will remain even once the modifier is deleted, or if source data selection is modified.

I think export script reads original normal data from the model, without data transfer applied.

My code for to_mesh conversion is pretty standard:

obj.to_mesh(bpy.context.scene, True, 'PREVIEW')

Here apply_modifiers=True. But DataTransfer seems to be slightly unusual modifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants