irajsb / UE4_Assimp

Assimp mesh importer for Unreal Engine
MIT License
136 stars 29 forks source link

How to process sub_model material of aiPrimitiveType_LINE in .ac model #31

Closed unsanedingding closed 1 year ago

unsanedingding commented 1 year ago

Question: I use .ac format model.

  1. 1.How to process sub_model material of aiPrimitiveType_LINE ? In .ac model ,have som axis (only have two vector3d vertices ),in this case, need material?
irajsb commented 1 year ago

Can you provide an example file so I can see for myself ?

irajsb commented 1 year ago

how do you plan to draw lines in unreal ? real time engine only draw triangles not lines . and a line will not have a face so it will not need a material to be drawn on the face.

irajsb commented 1 year ago

image You can apply scale like this image

SceneObject->SceneScale = 100.0f; is a readable variable not to be set by user

irajsb commented 1 year ago

Hi you can see the Blueprint in releases section of the github page.

irajsb commented 1 year ago

I've pushed an update to repo that fixes that issue Here is the release The model should have normals from modeling software but these can be also generated with assimp .

irajsb commented 1 year ago

when the mesh is imported try to preview its collision and see if its built correctly .(top left of 3D viewport change from lit to player collision )

irajsb commented 1 year ago

Num Collision primitives 0. collision is not generated for your mesh .

unsanedingding commented 1 year ago

So, how to config param of assimp for generate collision data, or ... I need generate collision by manual at runtime?

irajsb commented 1 year ago

assimp has nothing to do with collision at this use case . unreal is responsible for creating the collisions of the meshes . I've tried some other meshes and it seems like it generates a simple collision for them .
check the logs for any errors regarding creation of static mesh.

unsanedingding commented 1 year ago

Some error....

(n)LogAssimp: Error: This algorithm works on triangle meshes only

(n)LogStaticMesh: Warning: StaticMesh_0 has some nearly zero bi-normals which can create some issues. (Tolerance of 1E-4)

(n)LogStaticMesh: Warning: StaticMesh_0 has degenerate tangent bases which will result in incorrect shading. MikkTSpace relies on tangent bases and may result in mesh corruption, consider disabling this option.

So, I need set bRemoveDegenerates and bRecomputeNormals and bRecomputeTangents property on build setting and giveup use StaticMesh build, Change to use GetMeshDataForProceduralMesh and apply use these property? Right?

thank you.

irajsb commented 1 year ago

No I don't think those errors are collision related https://blueprintue.com/blueprint/inhg2zu3/ You can also try this method instead of creating static meshes

unsanedingding commented 1 year ago

Thank you I test GetMeshDataForProceduralMesh version:

Thanks a lot.

irajsb commented 1 year ago

can you provide the example model again? I think it was removed

unsanedingding commented 1 year ago

Thank you very much, thank you.

irajsb commented 1 year ago

image I can see a perfect collision here

irajsb commented 1 year ago

I'm using the release version nothing special.

unsanedingding commented 1 year ago

Thank you. 1.release version? Only can not work at editor mode ? So, it's means support LineTrace? 2.How to show this effect at editor mode?Or how to get this result (effect), by some setting on Editor? 3.Can hited by LineTrace in PIE? Maybe... LineTrace cannot use to generate meshed at runtime?

irajsb commented 1 year ago

image this is how to preview collisions as I mentioned before. line trace is working unless you are using wrong channels for tracing (tiny red square is where hit is happening when I use line trace single by channel)

image

unsanedingding commented 1 year ago

Thank you . Can you share your the showing project as before? Thank you.

irajsb commented 1 year ago

I don't understand the question

unsanedingding commented 1 year ago

I use line trace on fbx version of same mode, result is correct,when i change to assimp version of these model by same code, line trace hitd result alwasy false (invaild). So, i'm very confuse : ) BTW, I also have not config any Tag for all model. In assimp Imp version, I try to multi function of linetrace serices, all small button(switchs) allways can not be hited.

irajsb commented 1 year ago

Maybe you are using wrong collision channels when tracing ?
Also try to enable debug view for you traces .

irajsb commented 1 year ago

https://github.com/irajsb/UE4_Assimp/releases/tag/MajorBugFix here is the version that I'm using code is in level blueprint

unsanedingding commented 1 year ago

Oh, I think i had find some different...use your original test project of above the link (Thanks again)