Jump to content

What is the best topology?


Guest
 Share

You are about to reply to a thread that has been inactive for 4263 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi!


I'm learning to use Blender 2.63 and am currently working on the conversion of a prim-based villa to a mesh one. My experience with 3D modeling and Blender is basic, so please bear with me.


I have some doubts on what is the best topology to use for the building I am working on, as you can see in the following screen capture. The image shows the façade of the two-floor building with some window openings, duplicated as to show two different topologies:


VillaTopo.png

 

Which one of the two topologies is the better one? The one on the left has less faces, so I thought it would be the most preferable. But, there are some duplication of edges as some of them overlap. Also, is it better to have all the vertices attached as is in the example on the right, or it doesn't matter?


Another thing I want to ask is about the darkest areas in the smooth shading. Is it something I should be concerned about?

 

Link to comment
Share on other sites

 

 

Topology.JPG

 

This would be a better topology, if you want the least amount of faces AND connected vertices (no overlapping edges).
Both walls are exactly the same btw, one is triangulated though.

There are two issues with overlapping edges like you use them. First is the lighting, you already mentioned it yourself. If the size of the different faces gets big, you will see odd lighting effects in SL. The other issue is the vertices on the overlapping edges will all count. So while the number of faces goes down, the number of vertices could go up.

In your left picture there are 7 squares for the wall without windows, so 7 x 4 = 28 vertices. In your right picture there are 25 vertices. In the picture shown above, there are 20 vertices for the wall.

The less vertices, the lower the landimpact and upload costs. Usually I am all for the least amount of faces possible, but in this case I'd prefer the least vertices. Not for the landimpact/upload costs, but because it will look better in SL.

If I had to choose between your two models, I'd use the one on the right. if you want four different textures for the four quadrants of the wall, that one is even preferred over the one I made.

EDIT... The strange lighting you see in Blender might either be a Blender issue or it could be unwelded vertices/different smoothing groups. Someone who uses Blender could certainly tell you how to fix it if the latter is the case. (for the version on the right that is, not the left, that would be unfixable then)

  • Like 2
Link to comment
Share on other sites

Thanks a lot, Kwakkelde. This is very helpful. So, in general it is better to avoid overlapping edges. Good to know. I wonder why it is so difficult to find good information on a proper topology. I have searched for tutorials and best practices on the web and couldn't find anything. If anyone knows of a good tutorial / best practices on topology, please let me know.


Could the odd shading be caused by vertices not being perfectly aligned? What I am working on is a prim-based model I exported from SL with Mesh Studio. Some of the vertices in the collada export are not perfectly aligned. Obviously this is not a big issue in the prim-based model as the difference is insignificant, but I wonder if in Blender this may cause the odd shading. Any Blender expert has an answer to this? :)

Link to comment
Share on other sites

To add to what Kwak said, the download weight (and therefore usually the land impact) depends on the size of the mesh data. Each vertex adds 16 bytes, while each triangle adds 6. So the vertex count you see in the uploader is more important than the triangle count. Also, vertexes at sharp corners count as many times as there are different angles of the faces meeting there, while the triangle counts are unaffected.

The graded shading you see across each triangle in the right-hand model is presumably because they are smooth shaded. That causes the shader to gradually change the normal as you go across the area, so that light is reflected differently. This will persist in SL and spoil the appearance of the wall. You need to set it to flat shading (Mesh->Faces->Shade flat). This will increase the vertex count, for the reson I gave above. Vertices within a completely flat area should not get duplicated though. If you want to have complete control over sharpness of edges, you can use the edge-split modifier, which lets you control it by either angle between faces or by marking edges as sharp, or both.

In some cases, you have abrupt change in shadin as you cross the edge between triangles. This means those faces are not continuously joined across that edge. This can be either because you have accidentally duplicated the edge, in which case you can merge the vertices (AltM->Center). Otherwise it can be because the normals on the adjacent faces are pointing in opposite directions (more likely, I think). You can detect this by turning on the display of normals (under Mes Display in right-hand properties bar). You can also see more easily if you make the display of faces one-sided, as it is in SL, by turning on either Textured Solid or Backface Culling (under Display in properties bar). You can flip the normals by selecting the affected faces and either using the button in the toolshelf, or Mesh->Normals->Flip.

  • Like 2
Link to comment
Share on other sites


Indigo Mertel wrote:

 

Could the odd shading be caused by vertices not being perfectly aligned?

 

Yes and no, it depends on the faces.

You see the effect on faces around a single window aswell, those were all on the same side of a prim, so obviously perfectly aligned.

If different prims were not aligned properly, it could give the effect aswell, but not per mesh face, only per prim face (which is at least two mesh faces for a box).

Another option is the importer not importing the vertice locations perfectly. Just scale all the vertices that should be aligned to 0% along one axis. Again, I can't tell you which buttons to click unfortunately.

  • Like 1
Link to comment
Share on other sites

Ah, thanks a lot Drongle. Your post anticipated one of the other matters I am confused about. I do remember reading past posts of you where you advise about sharp edges and how they increase LI inworld. I am confused about using the edge split modifier though. My understanding is that the modifier can only be applied in object mode, thus it is applied to the whole object at once. Is this the proper way to do it? I guess what confuses me is that I had the idea that I had to add a round fillet to all edges.

The shading is indeed smooth. I thought this was the proper shading to use for models to be imported to SL. It looks as I was wrong.

As for the face normals, I am aware of the normal display and I always leave it on. This is another tip I picked from old posts by you. I've noticed it seems to be a frequent case. I didn't know about textured solid and backface culling.


Very interesting the bit about the weight of vertices vs faces. I didn't know that.

Link to comment
Share on other sites

It's a consequence of the internal mesh data format. Basically, each triangle is three 16-bit indices into the vertex list, and each vertex has 8 16-bit numbers, 3 (xyz) for position, 3 for normal and two for UV coordinates. When the same posion occurs with different normals (sharp) or UV (seams) it has to be duplicated as a different vertex.

  • Like 2
Link to comment
Share on other sites

If you use smooth shading and uncheck the edge angle option, but check the sharp edges option, in the edge split modifier, then it will affect only those edges that you have marked as sharp. This gives you complete control. The effects on shading show up in the 3D view, so you can see what's happening as you mark edges as sharp.

Concerning continuous/discontinuous faces - sometimes you can make large LI savings by using discontinuous pieces instead oj proper joining up. In the picture, supposed to represent part of a window frame, the version on the left is 32 vertices (after counting duplications for sharpness) and 16 triangles. That's 608 bytes. The middle, joined up one is 56 verts, 42 triangles and 1148 bytes. It can be improved to the one on the right at 44 verets, 30 triangles, 884 bytes. So I make my frames like the one on the left (but removing the back face that would be hidden in the wall). 

One cost of this is that it makes it difficult to get exact registration of baked textures. The joined up ones are much better for that. On the other hand, the unjoined version is much easier to UV map, and saves seams, which can also help to reduce LI (especially if the bars are rounded - note that an open-ended 8-sided smooth shaded cylinder has the same number of verts as a 4-sided sharp one, although more triangles - 384 bytes vs 336, including UV seam).

joints.png

 

 

  • Like 2
Link to comment
Share on other sites

I wonder if that makes sense :

Image98.png

 

Left side:

Here you could create a simple (planar?) alpha texture with a rectangular hole in the middle, then set repeat to 2 on x and y to get the window holes. Actually you could even add some semi transparency here, maybe even a bit of grunge on the windows ?

 

Right side:

here i have modelled the window holes. Look how i connected the window frames with the wall. its a bit of cheating. But ... Would it make sense to do it like this for minimizing the face count ?

Link to comment
Share on other sites

Your vertex count is not correct here. SL treats vertices with multiple normals (corners) as seperate vertices. If the backside of the windows is not modelled I count 164 verts for the left picture and 180 for the other (which btw is the same model I built :) ).

Splitting the verts of the wall and windows like you did makes no difference at all. SL would split them on upload anyway if they were welded in Blender.

btw... What you built with the alpha is a good way to construct one of the lower LoDs, I would never use textures with an alpha channel for the high LoD wall. chances you get the alpha sorting horror are just too big.

 

  • Like 1
Link to comment
Share on other sites


Kwakkelde Kwak wrote:

Your vertex count is not correct here. SL treats vertices with multiple normals (corners) as seperate vertices. If the backside of the windows is not modelled I count 164 verts for the left picture and 180 for the other (which btw is the same model I built
:)
).

Yes, you are right. I just counted the faces as they where reported in blender. btw, i created the object with ngons first, then applied triangulation and got the result out of the box.


Kwakkelde Kwak wrote:

 

Splitting the verts of the wall and windows like you did makes no difference at all. SL would split them on upload anyway if they were welded in Blender.

 

I do not understand that. The construction detail:

Image104.png

Anyways, actually i do not think that this detail of the construction is helpful. It is just a bit weird. I think that your way is the better solution :matte-motes-wink:

 

 

 

Link to comment
Share on other sites

Ok, let's see if I got things straight. Based on the suggestions I have received in this thread I can outline a list of best practices to follow. I have marked points where I still have some doubts with a question mark, so please feel free to clarify with further comments:

1. Vertices have a higher cost than faces. While it is important to model with the least number of faces, it is even more to follow practices to reduce the number of vertices.

2. Disconnected faces with overlapping edges are to be avoided.

3. Based on things I have read on the web it was my understanding that it is more practical to model with quads and even ngons/bmeshes and then triangulate before exporting the model as a Collada file. However, in the examples provided here I see that people triangulate from the beginning. Is this the best approach?

4. In some cases it is more efficient to design the topology so that faces are disconnected, as in Drongle's example of a window frame. With that example in mind my understanding is that it is better to sink the vertices of the bar in the window frame, rather than to exactly position the vertices on the frame (?).

5. I have been working on my model under the assumption that smooth shading should be enabled. This is not necessary on flat surfaces and should be enabled only where needed (?).

6. In order to reduce the number of vertices the edge split modifier can be applied on the model. This can be applied selectively through the modifier's settings and by marking edges as sharp.

7. Always make sure face normals are right by enabling the display of normals or by enabling the Texture Solid and Backface Culling properties.

Thanks a lot to all those who helped. Next round of questions will be on the best approach to texture a large building, as that is another topic where I am quite confused.

Link to comment
Share on other sites


Indigo Mertel wrote:

1. Vertices have a higher cost than faces. While it is important to model with the least number of faces, it is even more to follow practices to reduce the number of vertices.

Vertices cost more than faces in download weight and therefor in most cases the landimpact. This doesn't mean you should always go for less of them at the cost of more faces. More faces mean higher render cost. This won't be an issue for something as basic as blocks (houses etc) where the number is nowhere near as high as with curved items like clothing or cars. Normally I'd go for the least amount of faces. In your example though, the number of faces was reduced so far that lighting oddities started to appear. I would always keep a flat surface connected everywhere to avoid that. Maybe in one of the lower LoDs you could do something like that, or do what Gaia did in her example, with holes not modelled, but made with an alpha channel.


2. Disconnected faces with overlapping edges are to be avoided.


On a shared surface, yes. If you have a corner however or any sharp edge using different smoothing groups (or no smoothing groups at all by flat shading), SL would split the vertices on upload anyway. That is what Drongle ment by mentioning the split edge option. That way you will also see a more reliable number of vertices in Blender. (See the difference in Gaia's vertice count in Blender vs the actual count SL would make of it).


3. Based on things I have read on the web it was my understanding that it is more practical to model with quads and even ngons/bmeshes and then triangulate before exporting the model as a Collada file. However, in the examples provided here I see that people triangulate from the beginning. Is this the best approach?


That depends on what you are building. If you are going to use a subdivision modifier in Blender (making the model smoother by adding extra geometry), quads will give cleaner results. Also shading effects are smoother in most cases. It will also allow easier UV mapping in a lot of cases, especially in combination with the subdividing.

However, on a flat surface which won't ever have to be subdivided and has a simple planar UV map, none of these issues will ever occur. So then the least amount of geometry approach is better.

Never forget most tutorials you will find on the web are for high poly modelling, which is very different from low poly modelling for realtime rendering.


4. In some cases it is more efficient to design the topology so that faces are disconnected, as in Drongle's example of a window frame. With that example in mind my understanding is that it is better to sink the vertices of the bar in the window frame, rather than to exactly position the vertices on the frame (?).


It really doen't make a difference in either download cost or rendering cost, either way is fine. You'll use just as many vertices and just as many faces. Like I said earlier, on a hard edge the faces are disconnected anyway on upload.

 

 


5. I have been working on my model under the assumption that smooth shading should be enabled. This is not necessary on flat surfaces and should be enabled only where needed (?).


If a surface is truely flat, smooth shading will be no different than flat shading. (Unless I am really missing something, maybe Drongle can explain). Normally flat shading means split edges all around, but if the faces are connected in Blender AND they have the same normals (the surface is really flat), SL won't split the edges and the result will be the same as smooth shading. The weird effect you see is caused by something else I think, possibly split vertices in Blender.

 

 


6. In order to reduce the number of vertices the edge split modifier can be applied on the model. This can be applied selectively through the modifier's settings and by marking edges as sharp.


That will increase the number of vertices, all vertices on a split edge are counted for each surface they are connected to. Split edges leave you with a sharp edge though, which is often needed.

 

 


7. Always make sure face normals are right by enabling the display of normals or by enabling the Texture Solid and Backface Culling properties.

No idea what the texture solid does, but the backface culling can prevent surprises on upload.

_____

smoothing.JPG

Here a picture to clarify the split edges and different smoothing groups. On the bottom how you'd build it, on top how SL sees it.

On the left there are no sharp edges, so there are 8 vertices. It looks pretty off with the shading though.

On the right all edges are sharp (no connected squares share smoothing group), so it probably looks like you want it to.

SL sees it like 6 seperate faces, rather than the single face on the left. So the number of vertices goes up to 6x4=24, three times as much.

  • Like 1
Link to comment
Share on other sites


Indigo Mertel wrote:

3. Based on things I have read on the web it was my understanding that it is more practical to model with quads and even ngons/bmeshes and then triangulate before exporting the model as a Collada file. However, in the examples provided here I see that people triangulate from the beginning. Is this the best approach?

 

 

The Collada exporter internally converts ngons to quads and triangles during export. The SL Importer always converts Quads to Tris. I do not know if the SL Importer can convert ngons to tris too... So at the end SL sees only triangles.

Hence you not necessarily need to do the conversion by yourself. But there is a reason why it sometimes is better to do the conversion:

Converting a Quad to a Tri can be done in 2 ways. Sometimes it matters which of the 2 solutions are selected: You can see a difference in the final textured object like unexpected shades or weird look. This issue may get worse with automatic ngon to triangle conversion.

Here is a small demo what can happen when you triangulate a quad:

So it may be a good practice to triangulate just before exporting to examine the resulting object and possibly correct the edge flow where its wrong. By this you can avoid "bad spots" in your uploaded mesh.

  • Like 1
Link to comment
Share on other sites

(3) On any curved surfaces and on smooth shaded faces with angled adjacent faces, the details of triangulation can have large effects on the shading. This especially affects quads etc. that are not completely flat, whether geometrically or implicitly because of interpolated (smooth) shading. In those cases at least, it is safer to control the triangulation explicitly. In the case of Blender, collada export will divide ngons down at least to quads before writing them to collada. The uploader will then triangulate the quads. The triangulation (choice of diagonals) is different than what you get if you triangulate bu hand or using the Blender triangulation. So you can get differences between shading in Blender and in SL if you don't use the same completely triangulated model fot both. On the other hand, it is rather rare for this to be a problem, usually only if you have very un-flat quads. So it isn't generally necessary. (instead of reading this, see Gaia's film!)

(4) My buried vertices are really just laziness (i.e. efficient buse of time?). I believe the rendering cost is negligible as long as the hidden surface is small. It is certainly better to have them exactly on the surface though. As Kwak said, this is effectively what the uploader does to the flat shaded joint anyway (although that does keep the hole with the extra vertices too). Making it fit exactly can also reduce some of the problems with baked textures. It must be exact though, as any gap will be visible, and that sometimes involves a lot of extra effort.

(5) As Kwak said, if a vertex is inside an exactly flat surface the uploader will recognize that the normals are the same and will not duplicate the vertex, even if it is flat shaded*. So you can use flat shading without incurring extra LI as long as all your multi-face surfaces are exactly flat. You do need to use smooth shading as soon as you have any curved surface that you don't want to appear faceted, because it will cost you much more to smooth it with extra geometry than with smooth shading. If you also want some sharp edges, you can mix smooth and flat shaded areas in one mesh, but that can't always give you the result you want. The edge split modifier can. So if you want to use the same scheme for everything, use smooth shading for the whole thing and edge split for the sharp edges. Of course that would be very inefficient for meshes where all edges are sharp (simple uncurved window frames, cut diamonds, ...). So for those, just use flat shading.

(6) Yes. The effect of the split edges modifier on the vertex count is exactly the same as the effect of flat shading at angled edges, except that it only happens with those edges while leaving others smooth shaded. It's only really needed when you have both smooth shaded (eg curved) surfaces and flat shaded ones in the same model. Think of a cylindical pillar, with smooth shading for the vertical edges and sharp edges at top and bottom. If everything is flat or everything is smooth, then because of (5), you don't really need it. However, nearly all my models have both. So I usually use it.

(7) Textured solid does backface culling as well as putting the texture on it.

* For example, if you make a flat-shaded square plane and subdivide it once, it will count as 9 vertices, but if you then displace the center vertex out of the plane, it becomes 16 vertices (middle of sides -> 2 normals; center -> 4 normals). If its smooth shaded, it is 9 vertices before and after the displacement.

  • Like 1
Link to comment
Share on other sites

Instead of splitting your edges as described in (6) you could also use smoothing groups. For SL it doesn't make a difference, but you can get rid of any duplicated verts in Blender. I know duplicate verts or edges can be a pain when you want to move them for example. So one smoothing group for the top and bottom of the cylinder (they don't touch so can be in the same group) and one for the rest. I'm 99.9% sure Blender has this option.

I really can't think of a thing besides a better representation for number of verts in SL that would be easier when actually splitting. Then again, everyone has their way of doing things and I am sure I have some weird modelling manners myself.

Link to comment
Share on other sites

For this use of the edge-split modifier, you don't apply it except during export. You can control whether they effects on shading are displayed in edit mode, object mode and/or rendered images. The default is that the shading effect is displayed in edit mode. The vertices are not split, though, until you apply it, which you don't do. So you can see the effects while still editing the unsplit vertices.

I am not aware of the concept of shading groups in Blender. Gaia will tell us if it exists. In fact I don't know what it is in other software. Perhaps you could explain?

In Blender, the smooth/flat shading effect is applied on a per-face basis. So in quad faces, for example, the normal is either interpolated in both dimensions or none. This does not work properly on the quads making the circumference of a cylinder, which need to be interpolated around the circumference, but not from top to bottom. This can be seen in the picture. Left is a cylinder with the circumference set to smooth shading and the top and bottom set to flat shading. The edge is right, but the side shading is all wrong. The top is in the Blender 3D view (default settings), the middle is the rendered image from Blender, and the bottom is in SL. The cylinder on the right is using smooth shading of the whole thing, but with the edge split modifier and the edges marked as sharp.

gylegs.jpg        cylnorms.png

ETA - both count as 130 vertices in the uploader.

ETA - also, the generate normals in the uploader could be used to make the right from the left. It has exactly the same effect as the angle mode of edge-split, but it doesn't have the precise control of the marked sharp mode.

ETA - note the ribbing effect on the left in the 3D view. It took me ages to realise this was an artefact of the vertical normal interpolation after triangulation in this kind of smooth shaded surface where the interpolation needs to be anisotropic.

ETA - added the right hand pictute that shows the smooth shaded cylinder without (left) and with (right) the split adge application. Light blue are face normals and dark blue are vertex normals. I hope that makes the argument clearer.

Link to comment
Share on other sites

Ok, good thing I left the 0.1% there when I thought Blender would have smoothing groups like 3ds Max, looks like it doesn't.

For Blender split edge is the thing to use then, but it will create new smoothing groups.

A smoothing group is simply a group of faces that will blend their normals, like the round side of a cylinder, or the entire surface of a sphere or one side of a box. If you set one polygon on such a surface to another smoothing group, the edge will be sharp. You can assign multiple groups to a single surface so you can have a sharp edge somewhere in the middle of one surface.

If you say the split edge doesn't really split them (which the command with the same name does in 3ds max), I think that splitting edges might even be an easier way than doing it by manually assigning groups. All a bit academic, since Blender does it one way and 3ds max another.

Setting the shading to flat means removing all smoothing groups I guess.

Btw I have never seen the effect you created on the left. Something for the Blender folks to work on I guess, that looks like a bug to me, unless someone can come up with a use for it. Looks like 3ds max doesn't look in all four directions, but only in the directions where there's a shared smoothing group.

 

normals cylinder.JPG

 

This is the equivalent in 3ds Max of your cylinders plus one with one smoothing group (or in Blender smooth shaded).

 

Link to comment
Share on other sites


Drongle McMahon wrote:

I am not aware of the concept of shading groups in Blender. Gaia will tell us if it exists. In fact I don't know what it is in other software. Perhaps you could explain?

For all i know the concept of edge split modifier is sometimes also named: "smoothing groups in blender"


Drongle McMahon wrote:

In Blender, the smooth/flat shading effect is applied on a per-face basis. So in quad faces, for example, the normal is either interpolated in both dimensions or none. This does not work properly on the quads making the circumference of a cylinder, which need to be interpolated around the circumference, but not from top to bottom. This can be seen in the picture. Left is a cylinder with the circumference set to smooth shading and the top and bottom set to flat shading. The edge is right, but the side shading is all wrong.

 

 

gylegs.jpg

        

Isn't that a consequence of the lighting model used for smooth shading ? http://blog.machinimatrix.org/3d-creation/vertex-lighting-in-sl/ So maybe its not a bug but a feature of vertex lighting ? :matte-motes-sunglasses-3: And when you add an edge split, that is actually similar to what sculpty creators do by collapsing adjacent edge loops. So on the right side of the image above the cylinder looks right because vertex lighting no longer bleeds into the wrong faces ...

Link to comment
Share on other sites

Yes. I don't think the vertical interpolation thing is a bug. It is consistent. If a face is smooth shaded, use the vertex normals at each corner. If the face is flat shaded, use the same face normal at each corner. Then interpolated shading on all faces gives you the results we see in Blender and SL. You know the exporter better, but it must be making the same decision. In SL, it's all interpolated, which is why it has to have the duplicated vertuces at the sharp edges. That must improve performance by not having to decide. How 3Ds deals differently with that case, I don't know. I don't see how a triangle that only touches a sharp edge at one apex knows not to interpolate it's shading in that direction. The ribbing effect is presumably also a consequence of the fact that the interpolated normal shading is per-triangle, giving slightly different effects for the two edges of a quad where the triangles are vertically inverted. What that appears in the 3D view but not in the rendered image or SL, I don't know. Must be hidden in the details of the shaders.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4263 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...