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

Smoothing or normal looks strange after importing to UE5 #207

Open
tanakawatanabe opened this issue Jan 1, 2025 · 22 comments
Open

Smoothing or normal looks strange after importing to UE5 #207

tanakawatanabe opened this issue Jan 1, 2025 · 22 comments
Labels
R Fixed! This is fixed. R Major Annoying but non-blocking issue or bug.

Comments

@tanakawatanabe
Copy link

tanakawatanabe commented Jan 1, 2025

I'm using this plugin to export my gun (with armature so as skeletal mesh) from Blender to UE5.
Normal FBX export and import on UE5 couldn't fix axis right so this plugin helped me a lot.
But there's one issue.

compare1
This is comparison of Normal Export and Plugin Export.
Both has the same material.
When I zoom up...

compare2
It's hard to describe exactly what's going on,
but some sort of triangulation or smoothing or normal is different between them.
What's causing this difference?

Here's normal FBX export settings of Blender.
normalexportsettings
Gun mesh has no modifiers except Armature (for gun mechanical).

I couldn't find any settings about smoothing on BlenderForUE plugin.

Blender: 4.3.2
Plugin: 4.3.10
UE: 5.5.0

Thanks.

@xavier150
Copy link
Owner

Hey @tanakawatanabe
By default normal smooth export using Face, it is I think the best to have the same results.

image-9.png

image-10.png

If you don't have the same results as in Blender maybe a shape key or a modifier breaks it, you can check?

@tanakawatanabe
Copy link
Author

There's no shape key on my gun model.
The only modifier I have is Armature, which is needed for animation (like slideup, slidedown).
image

@tanakawatanabe
Copy link
Author

https://drive.google.com/file/d/1cZkK9v6tEVjaIGfMOVMitNgYhArj-5Ry/view?usp=sharing

I uploaded my gun model on G drive,
If you've some time please look into it.

@xavier150
Copy link
Owner

Thanks! I will try to look about soon

@xavier150
Copy link
Owner

I checked, you have many potential error that can be fixed.
Once fixed with the Armature I have exacly the same result when I export with the plugin or with the native FBX export.

image

At the export with FBX you need to set Face as smoothing type in Geometry.
And when you import you need use Import Normal and Tangents at Normal Import Method.

image

Look like this value is not set by default in the last versions of Unreal Engine.
I will update the doc and you can found details here https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/How-import-assets

@tanakawatanabe
Copy link
Author

Could you send that fixed .blend file to me?
I'm trying hard to get gun mesh to SkeletalMesh but it doesn't work, it tries to export as static mesh.

@xavier150
Copy link
Owner

I can't for te moment, I will look about later.
Please check you set the armature as exportable and not the mesh. If the mesh is set as "export recursive" it will export it as Static Mesh. You have more details here: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Skeletal-Meshs-‐-Quick-Start

@tanakawatanabe
Copy link
Author

tanakawatanabe commented Jan 5, 2025

Okay thx.

By the way the FBX Import setting screenshot you posted above is the old one.
In 5.5 this new Import system pops out by default.
image
I can fallback to old import system by sending command "Interchange.FeatureFlags.Import.FBX False", should I do so?
I want to import under the same conditions as you as much as possible.

Actually toggling this new Import System gives me quite different results on importing from Blender addon (creates .ueasset, not .fbx)
With this on the gun is imported as SkelMesh, but with this off it's split by Armature and StaticMesh gun.
Well anyway I gonna wait your blend file while reading manual again and thinking what's I'm misunderstanding.

@xavier150
Copy link
Owner

xavier150 commented Jan 6, 2025

Please read the docs: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Skeletal-Meshs-‐-Quick-Start
You set the mesh as exportable but you need only set the armature as exportable.

For all other issues you can click on "Check Potential Errors"
image

I fixed the issues to test, export type, root bones, weight and rescale the assets, here the file:
https://www.dropbox.com/scl/fi/nawxbkbwyci04j3ux6bbf/Type20RifleModel.blend?rlkey=46m9twycj03kmuogjd8wl2pg8&st=dou4yyac&dl=0
(I will removed it next month)

I will look about the 5.5 import now

Edit: I just notice you check "Override Export Preset" It for a specific use ?

@xavier150
Copy link
Owner

Ok I found.
With Unreal Engine 5.5 and the interchange Pipline for Static mesh and Skeletal mesh assets you need untick Recompute Normals and Recompute Tangents.

I added details here with the steps for manural import: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/How-import-assets

NewInterchangePipline

I also notice the import script don't do it by default, I will fix that now.

@xavier150 xavier150 added R Major Annoying but non-blocking issue or bug. R Fixed! This is fixed. labels Jan 6, 2025
@xavier150
Copy link
Owner

All should work now, I fixed the import script for Unreal Engine 5.5

  • Fixed: Import script don't import Blender Normals in Unreal 5.5 (Interchange Pipline)
    I updated the Dev Branch.

@tanakawatanabe
Copy link
Author

Thanks a lot! But how can I get that Dev Branch?
Couldn't find in your latest activity.
And you said "fixed the script for UE5.5"...are you one of UE development team?
You fixed UnrealEngine not Blender plugin?
So all I should do is hit Update of UE5.5.0?

@xavier150
Copy link
Owner

Just follow the steps here for the Dev Branch: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Download-And-Installation-From-Dev-Branch

No I don't work at Unreal Engine. I speak about the import script. If you manually import this will change nothing in your case.
More details: https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/How-import-assets

@tanakawatanabe
Copy link
Author

Thanks, and sorry for my pretty bad English reading skills.

Installed Dev Branch 4.3.11,
From the blend file that you configurated, exported by python method and imported into blank 5.5.1 project.
(I should not have updated mine to 5.5.1 because the conditions would not be exactly the same,
but as I mentioned above I was quick to assume you had updated UnrealEngine,
and did so before waiting for your reply.)
image

I don't know why textures are not included but anyway,
it looks like some faces still have problem to me.

So I wondered what's gonna be on normal FBX import and tested in Interchange Pipline method,
following How import assets page you posted above.

LogInterchangeEngine: Error: [Failure] Import Failed

It didn't tell me what was exactly wrong but it just failed.

Probably something I'm messing in Blender export settings,
Could you send me the screenshots of your python method setting, and FBX export settings?

@xavier150
Copy link
Owner

The material and textures import are not supported by my addon currently.

On your screenshot the material use a non normal map texture as a normal. Please remove the material to check then re-create your material directly in Unreal Engine

@xavier150
Copy link
Owner

About "LogInterchangeEngine: Error: [Failure] Import Failed"

You import using the import script? You can give me the consol logs?

@tanakawatanabe
Copy link
Author

tanakawatanabe commented Jan 9, 2025

The material and textures import are not supported by my addon currently.

On your screenshot the material use a non normal map texture as a normal. Please remove the material to check then re-create your material directly in Unreal Engine

Gonna re-create material and check it, hold on...

About "LogInterchangeEngine: Error: [Failure] Import Failed"

You import using the import script? You can give me the consol logs?

Not import script (you mean python method right?), exported as FBX,
drag and drop it and imported by "Interchange Pipeline" menu.

I tried to reproduce the error but it came out another strange situation.
image
There's no Armature in FBX. "SK_Armature_Skeleton" was created when I tried python script method so this is not appropriate to apply.
So I want to know your FBX export option in Blender.

@xavier150
Copy link
Owner

If you import the skeletal mesh for the first time it will automatically create a skeleton.

You need select a skeleton only if you want two skeletal mesh use the same skeleton.
Or for importing animations of course.

I don't understand what you need about the export settings.

Here the command used:

            filepath=fullpath,
            check_existing=False,
            use_selection=True,
            use_active_collection=False,
            apply_unit_scale=True,
            global_scale=bfu_utils.GetObjExportScale(active),
            apply_scale_options='FBX_SCALE_NONE',
            object_types={
                'ARMATURE',
                'EMPTY',
                'CAMERA',
                'LIGHT',
                'MESH',
                'OTHER'},
            colors_type=bfu_vertex_color.bfu_vertex_color_utils.get_export_colors_type(active),
            use_custom_props=active.bfu_export_with_custom_props,
            mesh_smooth_type="FACE",
            add_leaf_bones=False,
            use_armature_deform_only=active.bfu_export_deform_only,
            armature_nodetype='NULL',
            bake_anim=False,
            path_mode='AUTO',
            embed_textures=False,
            batch_mode='OFF',
            use_batch_own_dir=True,
            use_metadata=active.bfu_export_with_meta_data,
            primary_bone_axis=bfu_export_utils.get_final_export_primary_bone_axis(active),
            secondary_bone_axis=bfu_export_utils.get_final_export_secondary_bone_axis(active),
            use_space_transform=bfu_export_utils.get_skeleton_export_use_space_transform(active),
            axis_forward=bfu_export_utils.get_skeleton_export_axis_forward(active),
            axis_up=bfu_export_utils.get_skeleton_export_axis_up(active),
            bake_space_transform=False
            )

Check the file bfu_export_single_skeletal_mesh.py if you need more details

@tanakawatanabe
Copy link
Author

I re-created material and attached it to the SkelMesh Imported by python script method.
image
Bravo! Finally it rendered just like in Blender!

...But there's one problem,
I'm using "Override Export Preset" and setting Forward and Up axis manually.
image
As it's shown in Blender, this gun's muzzle is pointed toward Y-, and Z+ is up.
In Unreal Engine forward axis is X+, so I have to tell addon which axis is supposed to be forward by myself.
So I set "Axis Forward" to "-Y Forward" and "Axis Up" to "Z Up", and exported by script.
But the result is this:
image
At least last week, I was able to set muzzle to X+ properly in UE,
by setting Axis Forward to X- in addon(that's strange though, this gun's forward is Y- in Blender).
So I tested X- and X+, but both came out same this result:
image
Is this same on your side?

If this is building or something stationary asset I don't mind I just rotate 90 degrees,
but this gun armature is used as equipment and stick to character's hand,
and when aim rotate toward certain direction, and launch physical projectile as bullet.
So I really don't want this SkelMesh to be bent 90 degrees from the start.

@tanakawatanabe
Copy link
Author

tanakawatanabe commented Jan 9, 2025

If you import the skeletal mesh for the first time it will automatically create a skeleton.

You need select a skeleton only if you want two skeletal mesh use the same skeleton. Or for importing animations of course.

Oh sorry, this SkelMesh also has animations(like aaaDefault, SlideUp, SlideDown)
so I thought I have to follow both "SkelMesh" and "Animation" settings.
image
OK now FBX is imported properly.

Only remaining problem is axis settings I posted above.

@xavier150
Copy link
Owner

I will look at this axis issue tomorrow when I'm back home.

I'm used to never touch the override option. Maybe the results change about the axis in the Interchange Pipeline.

@xavier150
Copy link
Owner

I just try and I get exacly the same result about axis in the old FBX Pipeline and the Interchange Pipeline, Blender native export and the plugin export.

If you use "Override Export Preset" you need be carful and also check the bone Axis.
Blender and Unreal don't manage the unit in the same way.
Y location in Blender is inversed in Unreal, and Y, Z Rotation in Blender is inversed in Unreal.

I recommand to not use "Override Export Preset".
Also I think you don't need to turn your weapon which already points forward by default without the override.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R Fixed! This is fixed. R Major Annoying but non-blocking issue or bug.
Projects
None yet
Development

No branches or pull requests

2 participants