PDA

View Full Version : Another question to Chris re extra vertices....



VinnyBarb
November 29th, 2015, 03:32 PM
As it seems, this developers forum died a fast death already, hence a question to Chris to satisfy my own curiosity and to at least post something meaningful here. With 3DS Max and I guess also with GMax, when "slicing" a mesh part, this usually introduces extra vertices on the sliced edges of such a mesh. Prudent creators will try to "target weld" (3DS Max speak) such extra vertices to other vertices nearby, like corner vertices where these will get "absorbed" and become only one single vertice at that point when "welded" in such a manner.

This also happens sometimes/often with "boolean operations" when one cuts something out of a mesh, like holes for windows etc., where sometimes one can not eliminate some of these vertices, which might/will distort the mesh somewhat, like on curved or round parts etc.. If a creator ignores all such extra vertices introduced into a mesh with above scenarios, how much, if any, performance penalties will these extra vertices cause if ignored and left in such meshes? That is with vertices which can be "target welded" without disturbing or distorting such a mesh?

Any meaningful answer is appreciated and thanked for.

VinnyBarb

rumour3
November 29th, 2015, 04:49 PM
VinnyBarb

I'm not sure what the 'official' answer will be but in an ideal world every vertex should have a purpose in defining either shape, smoothing or texture coordinates. However, in a model with up to 100k vertices, I'd be surprised if the performance hit from a few unnecessary vertices around some Boolean cuts makes that much difference, if the high detail mesh is used with efficient LOD models. Programs such as Blender and (I guess) 3DS Max are better at optimizing the geometry than they used to be. In my experience the first simple Boolean cut on a true flat surface won't make any unnecessary vertices, although second or third Boolean cuts on curved surfaces are a different matter.

If I'm feeling really keen, I'll go around a Boolean cut and manually weld any extra vertices to the 'important' ones, but I haven't found an automated way to do this. Blender has a 'remove doubles' function that will weld within a user definable threshold but this will invariably muck up the geometry by moving the welded vertices to a central point so I only use this for getting rid of vertices that are duplicated at exactly the same point in 3D space, and then only if they're not required to be separate in order to define a sharp edge.

R3

Dinorius_Redundicus
November 29th, 2015, 05:58 PM
Hi Vinnybarb

I'm sure the extra vertices must attract some computing penalty since the game engine must track every element (vertices, edges, faces, textures, smoothing groups etc.) in order to render it coherently in 3D space and time. So in principal it will always be a good idea to eliminate vertices that are beyond the minimum needed to define the model.

One of the features of 3DS Max that I found really useful in this context is the ability to Constrain the movement of a vertex to an existing 1D edge (or 2D face) without distorting the shape of the model. The mesh needs to be in Editable Poly mode for you to see the Constrain option. It's not there in Editable Mesh. Move the vertex until it meets one of the main vertices and eliminate it by welding the now coincident vertices.

If you have already textured the model, I believe there's even a way to move vertices without distorting the existing mapping. Look for the Preserve UV option (I've only read about this in "How to Cheat in 3DS Max 2009" but not actually used it yet).

I can't speak for Blender, but I know gmax doesn't have this.


.

ZecMurphy
November 29th, 2015, 07:16 PM
Good Morning All :)

From my understanding, extra vertices themselves may not have much of an impact (I'm may wrong here though). However when slicing a mesh (or using boolean), those extra vertices will generally mean extra triangles on the mesh, which can definitely have an impact on performance.

For just the one asset, in a blank scene, the performance impact will be negligible. However, in a full scene in-game the poly count can have a big part to play. That said, you can afford to be a little messy in your highest LOD (especially if those 'extra' vertices help with smoothing, or with curved surfaces/edges), but you should still clean as much up as you can. You'll definitely need to clean it up in the LOD to get it as low as possibly.

Regards

norfolksouthern37
November 29th, 2015, 07:55 PM
'extra' vertices as in those that are not absolutely necessary to define a particular surface will make extra triangles so yes they will have an impact.


if you truly do not need a vertex to define a face simply select them and press backspace - problem solved. This is entry level mesh cleanup.

WindWalkr
November 29th, 2015, 08:35 PM
Agreed with all the above.

The per vertex cost is small, but it adds up. Sometimes we have to duplicate vertices at export time anyway; for example at a hard edge where the adjoining triangles have different normals at that vertex- but rather than second guess what the exporter is doing, you're much better off simply providing a minimal number of vertices as a starting point so that the output contains only the necessary duplicates and not additional unnecessary duplicates.

As others have said above, the cost of one or two extra vertices out of a hundred thousand is pretty minor. You don't need to review the entire model one vertex at a time to see if you've missed one. But where you have tools or practices which reduce the number of vertices for the same visual result, you should use them. You definitely don't want to have thousands of extra vertices.

As always, take more care at the lower LODs. The impact of 10 extra vertices in a model which only has 100 vertices is potentially significant.

chris

VinnyBarb
November 30th, 2015, 02:48 AM
Thank you to all, I just wanted to know as I usually clean/targetweld/eliminate most unwanted vertices on boolean cut edges and sliced edges anyway, where this does not distort the mesh like on bend surfaces or the like. Its good to know some people still respond here as no new postings were made here for over 2 days.

VinnyBarb

rumour3
November 30th, 2015, 03:01 PM
@Chris- a related question. One of the essentials of 3D modelling is an understanding how to control smoothing. In Blender, there are options to apply smooth or flat shading to faces. The same result can also be achieved by splitting the edges around a flat face, even if smooth shading has been applied to it. I have been assuming that applying flat shading to a face effectively splits the edges at export time so it doesn't matter which approach I use- is this a correct assumption, or is one more efficient than the other?

R3

WindWalkr
November 30th, 2015, 07:58 PM
@Chris- a related question. One of the essentials of 3D modelling is an understanding how to control smoothing. In Blender, there are options to apply smooth or flat shading to faces. The same result can also be achieved by splitting the edges around a flat face, even if smooth shading has been applied to it. I have been assuming that applying flat shading to a face effectively splits the edges at export time so it doesn't matter which approach I use- is this a correct assumption, or is one more efficient than the other?

I can't speak for Blender or the Blender exporter, but as a generalisation you are correct. If the vertices are not split then the resultant normal (etc) will be an average across the adjoining polygons. If the vertices are split then they can be controlled separately, which gives more control over the appearance of the output.

chris

PEV
December 1st, 2015, 12:41 AM
In GMax (3dsMax?) you can make triangles with shared vertices have different smoothing groups, so that a crease line can be seen between the smooth surfaces in GMax. This works for trainz using a trainzmeshimporter.exe export for me, so I assume the blender exporter could do similarly.

Mind you it took ages to figure out a suitable lot of maths to make it happen. The final result is very simple after scratching around for ages trying to figure what the smoothing groups number meant. I was not happy with the GMax created vertex normals so I now calculate them separately in my exporter software.

WindWalkr
December 1st, 2015, 01:50 AM
In GMax (3dsMax?) you can make triangles with shared vertices have different smoothing groups, so that a crease line can be seen between the smooth surfaces in GMax. This works for trainz using a trainzmeshimporter.exe export for me, so I assume the blender exporter could do similarly.

Unless I'm misunderstanding what you're talking about, I think you'll find that TMI is doing the splitting for you. The user of the modelling package doesn't typically need to worry about this process, because the UI works at several levels of abstraction from the underlying hardware. Exactly where the splitting happens in the toolchain is a matter of history and compatibility, but TMI contains the guts of the Max exporter so it's probably quite capable of handling this kind of thing.

chris

PEV
December 1st, 2015, 04:03 AM
Thanks Chris.. I agree totally...