Adding procedural models to the engine

How to add new meshes in the engine so that it is addable in a scene ? Not with .obj and so on, I mean to add a procedural model

Hello,

I wanted to add new meshes, but not with .obj files, and so on, which would not allow me to modify them in a scene of a project.
So I already have the basical meshes like Cylinder or Sphere, but I would like for example to add an EmptyCylinder piece, and be able to modify the internal radius while being into a scene, like we can do here for example with the position, the rotation and the scale:



You can see on those 2 pictures that I added a piece named “Cycylinder” (I also modified the code to have Cycylinder everywhere) (I didn’t delete the Cylinder files btw)
I’m almost sure I didn’t need to add all of theses files, and I’m also sure that I didn’t add all the files I needed or I didn’t modify them correctly -> the HashCode is probably the answer

I also modified other files, but the modifications are reversed when I launch the engine
xenko\sources\editor\Xenko.Assets.Presentation\obj\Debug/Xenko.Assets.Presentation.3.1.0.1-beta02.nuspec

or the files are even getting deleted

What I would like to know is how I should proceed to add a new procedural model correctly.
If anyone knows, that would make my day ^^
I think that the problems comes from the fact that my HashCodes are not good as I don’t know how to generate new ones.


Here you can see that the only difference between Cylinder and Cycylinder is the B at the end of the hashcode, I’m sure I’m not supposed to modify this file by hand, so I looked for a file that would generate this one: ProceduralModels.cd but I could not find anything, which would have also allowed me to find the function that generates new HashCodes.

“How add new meshes”: that is the question.

Best regards =)
Beefr

have a look at this thread, there is a good example with link to the repo:

1 Like

oh yes my bad I didn’t check this thread! =X
I saw many interesting things that I’ll need later, but my point now is to add models in the editor => I’d like to see them in the asset view after loading a random project

EDIT:

well, I managed to do it…


I now have my Cycylinder

it was really simple
only 3 files to add:
.nuget\packages\xenko.assets.presentation\3.1.0.1-beta02\xenko\Templates\Assets.xktpl\ColliderCycylinder.png

.nuget\packages\xenko.assets.presentation\3.1.0.1-beta02\xenko\Templates\Assets.xktpl\ProceduralCycylinder.png

.nuget\packages\xenko.assets.presentation\3.1.0.1-beta02\xenko\Templates\Assets\Models\ProceduralCycylinder.xktpl

I’m sure I already added thoses files in the past without any effect in the asset view
And I saw that all the added files were deleted if either the png or the .xktpl are missing (but not each time --’ )
So I probably added the .png or the .xktpl, then launched, then added the other which did nothing…

it feels like my thread is useless =’(

1 Like