Long triangles

Blitz3D Forums/Blitz3D Beginners Area/Long triangles

fox95871(Posted 2013) [#1]
I thought I heard somewhere Blitz3D or computers in general don't like it if you use extremely elongated triangles. If so, would that be true relative to the mesh size too, like if it was a 1x, 0.000001y, 1z cube? I want to make walls that go up and down, but I'm worried that lowering them to 0.0y or anywhere in that range might cause problems. They're going to be part of a custom mesh, so they have to be somewhere. I could put them inside, but has anyone else heard if temporarily making faces of a mesh extremely short or even zeroed out causes problems?


TomToad(Posted 2013) [#2]
Never heard of that myself, would be interesting to know more. I do know that if you have 2 or more vertices that are at the same coordinates, many GPUs will treat them as one single vertex. I could imaging that if you have a triangle in which two corners are almost touching might be seen as existing at the same coordinates due to floating point imprecision.


RemiD(Posted 2013) [#3]

I do know that if you have 2 or more vertices that are at the same coordinates, many GPUs will treat them as one single vertex


Not sure about that. If it was true, flatshading will not be possible (different vertices with the same coordinates but with different normals.


Kryzon(Posted 2013) [#4]
We would need to see the context of that assesment so we understand what the person was talking about, but what I remember is that the rasterization of triangles is done in a "bad" way.

When you have adjacent triangles (and you usually do, when you're talking about meshes), the adjacent edges of those triangles are always rasterized two times.
The rasterizer (the hardware) always rasterizes each triangle individually, so for each triangle edge you're generating pixels two times.
This happens in every 3D engine you might use, since it's the way the hardware renders triangles - and every engine uses the hardware.

This is why for full-screen effects, some developers use a triangle rather than quad:


When using a full-screen quad the pixels on the diagonal are rendered twice. This might not seem like much, but you usually use full-screen rendering for expensive post-processing shader effects, where every optimization is sought after.
Regarding the triangle, only the pixels that are located on screen are rendered - the rest of the triangle is not rendered because a scissor-rectangle is used, so the rest is clipped off and discarded.


This is an optimization for consoles or extreme cases. You should really pay no attention to this sort of detail. For some things, like levels, you have no choice other than using long triangles anyway, not only to represent big surfaces but to minimize the triangle count.

I don't know how that cube you described is going to result visually, but it certainly won't throw an error. Although, if you're using a really thin cube as to appear like a flat sheet, you should rather create a quad manually using the Surface commands as that would spare you a few vertices, especially if you're going to use several instances of that.


fox95871(Posted 2013) [#5]
Yeah, I was having a little trouble deciding where to say triangle, or side. In the case of my project, I'm referring to walls that look like the picture on the left in the above post. Basically picture a cube, except I made it with CreateMesh, so it has some nifty extras. When the character's on it, they can walk to the next mesh, and also not fall off the other sides, by having walls that can be toggled. My choices for when a wall's down seem to be, fold it inside the cube, bring its top vertexes down to 0.000001y, or bring them down to 0.0y. It's the last 2 options I'm worried about. In fact, I could do the folding, but getting to the bottom of that thing I heard about would be a good learning experience. If it's bad to have a side that looks like a long needle, or is even of height zero, I wanna know about it, y'know?