Seamless models - harder than it looks

Finally got finished on all of the pipeline work needed to start to use static meshes as part of the level design. Turns out it is far harder than it looks to make seamless models

But it's a start. Was a lot involved in getting to this point, so for a first attempt I'm happy. Need to figure out exactly what is going on with the normals there and figure out a solution.

But to get this working, I had to first of all delve into my (horrendous and unusable) level editor to add support for adding static meshes.

It really is a pig to use, but too much work to start a new one right at this moment so it will have to do for now.

The editor works in a sort of ECS way - level entities are just a collection of properties and it is quite easy to compose a new type of entity, but the actual interface is pretty appalling to use.

The exporter produces a file in the format my game accepts. Basically it is a binary file with a list of entities in, each started with a string tag. I added "externalmesh" type which loads a mesh from a file in the assets directory, then used the existing "staticmeshinstance" tag to define the rotation and position of the meshes that were added to the editor. The file format is pretty good really, just need to write a better editor at some point.

Anyway, just pictures really this week. Thanks for dropping by.

[EDIT]

Managed to slightly improve the tiling here.

The corners are still not matching up with the edges right, but the edges seem to be tiling more seamlessly now.

The problem is the way that my model editor works out shared normals, leading to different normals at the edges of shapes to those buried inside them.

What I've done is added an optional fixed normal to each vertex in the model editor. I can now extrude the edges of the geometry with some fake faces, then select the vertices and choose a Fix Normals option, which populates the vertex manual normals with the calculated normals, then delete the fake faces from the edges.

This then preserves the normals calculated as per when the fake faces were in place, which has led to the improvements to tiling you see in the latest screenshot. Bit hard to describe without going into a lot of detail, but seems the easist solution for now. Will need to re-do all the meshes now with this in mind.

[EDIT]

Okay, the issue with the normals appears to be fixed:

Problem is now that the meshes aren't quite lining up properly, something to do with some float inaccuracy resulting from either a bug in the editor or rotation I think, but at least it is a new problem to solve.

I added some further functionality to my 3D model editor to actually visualise the normals, which has made this easier to figure out.

You can toggle them on or off with the little N button bottom right. Between that and the fixed normal system I described earlier, I was able to solve the normal issue, so now I just need to figure out the problem with the placement co-ordinates.

[EDIT]

Last edit on this post. Finally got it working perfectly:

Seems the only solution to getting the seams lining up right is to extend the edges of the meshes by a small amount, so that they overlap very slightly. This, combined with the now corrected normals is giving me perfect tiling.

Been an adventure. Never tried to create meshes that tile before and have learned a lot. Its not the easiest but armed with the experience of this week, I should be able to move forward a bit quicker now.

Hope this has been useful to someone in a similar position. You never know.