Looking around in the yabee exporter, it appears that it writes new vertices for every face even if those vertices already exist in the file from a previous face.
Is there any negative impact on game performance by doing this? I’ve written a method that only writes unique vertices, which means the .egg files are significantly smaller, but when converting them to .bams they end up the same size anyway.
So does this mean the only advantage in my overly complex system is the .egg files are smaller? I presume panda3d converts to bam when loading, which seems to remove duplicate vertices in egg files.
The .egg loader generally does a good job at optimising the .egg file before loading it, so I don’t think you need to worry about it. Keep in mind, though, that if you use flat shading, you can’t share vertices because your vertex normals are different for each polygon; you can only share vertices between polygons when you use smooth shading.
You can’t assign a normal to a polygon, only to its vertices. When giving a polygon a certain normal, you’re really just setting the same normal vector to all its vertices, and this can of course only work when the vertices are unique to that polygon.
That’s how the GPU handles geometry data - the representation in your favourite modelling suite may differ.
I don’t understand. I can make an egg file of a cube with only 8 vertices that has flat shading that renders properly. Is the egg loader simply making the requisite copies of the vertices and assigning a normal to them depending on what face they’re a part of?
Yes, this is the case. (Though actually, there is an exception: you can ask OpenGL to render in “flat shaded” mode, which means it reads only one normal for each face, and the egg loader can generate models like this if you set egg-flat-shading 1 in your Config.prc file. But you probably don’t really want to do this, because it is more likely to be a performance cost than a performance benefit, due to the nature of modern GPU’s.)
You can examine the GeomVertexData produced by your models to see the actual vertices created by the egg loader, or just use something like model.analyze().