Advertisement

frustum culling with terrain made of strips

Started by March 12, 2002 07:27 PM
18 comments, last by nitzan 22 years, 11 months ago
Belive me you can build patches of size 2n * 2n without degenerate trisangles. In fact degenerate tris are something you dont want to put into anything (read recent nVidia''s papers).

look at it his way

in first line of patch you have tris like this


//////// -->

and in next one you have oriented like

\\\\\\\\ <--


you see that last tris of 1st strip connects to first one of 2nd without using degenerate tris..

There are more worlds than the one that you hold in your hand...
You should never let your fears become the boundaries of your dreams.
Darkwing, any chance you could do a jpg image with triangles to demo what you are talking about?
I think I get what you are on about, but just need to see it really...

[edit: stuped keyboard ]

[edited by - _the_phantom_ on March 15, 2002 8:45:16 AM]
Advertisement
code straight from my engine:


    // build VA strip base arrayvoid UTerrainQT::BuildNodeAVList( const int nodeSize ) {		int pos;												// position in vertex array				nodeBaseVASize = 0;										// vertex buffer size		nodeBaseVA[ nodeBaseVASize++ ] = 0;						// add first		for ( int x = 0; x < nodeSize-1; x++ ) {				// for x								for ( int z = 0; z < nodeSize; z++ ) {				// for z				pos = x + ( z * nodeSize );						// position in vertex array				if (z!=0) nodeBaseVA[ nodeBaseVASize++ ] = pos;			// add point				nodeBaseVA[ nodeBaseVASize++ ] = pos+1;			// add point			}				x++;												// next line in reverse order			if ( x < nodeSize-1 ) for ( int z = nodeSize-1; z >=0; z-- ) {	// for z				pos = x + ( z * nodeSize );						// position in vertex array				if (z!=(nodeSize-1)) nodeBaseVA[ nodeBaseVASize++ ] = pos;			// add point				nodeBaseVA[ nodeBaseVASize++ ] = pos+1;			// add point						}		}}    



nodeSize is size of patch side (eg = 32)
vertices are numberd like:
0123
4567
89

I'll post a screenshoot...
you'll see the whole thing in my LOTR contest entry...

EDIT : code has been changed : Philipp2k2 -> thanks for your comment... I fixed it .. I hope it works..

Another note : I use this code only once on startup to build VA prototype. It's not to be used on frame basis since all the nasty ifs..

There are more worlds than the one that you hold in your hand...

[edited by - _DarkWIng_ on March 15, 2002 1:50:34 PM]
You should never let your fears become the boundaries of your dreams.
well, i think you actually do have degenerated traingles (two of them) every time your strip ''turns around''. Perhaps I am wrong, but i dont think so.
let nodesize be 3.
vertices are arranged like this:
123
456
789
your code will generate these indices:
124578 986532
so there is one triangle 789 and one 898 which are degenerated.
yes DarkWing, i am aware that you must specify strips in a back-and-forth order, and i know you can join strips without using any degenerate tris, but in doing so, the strips will be joined by an invalid/unwanted tri (which I did mention in my previous post).

It is highly likely this extra tri could cause artifacts when you render the strip (i.e. will pop up/down, perpendicular to your patch surface). BTW, its likely to be more pronounced if there is a large difference in height between adjacent vertices.

Could you point me to any paper in particular that discusses this? I just don''t see how this hasn''t been a problem for you...


Philipp2k2: the tri 789 is not degenerate... this is the unwanted tri I am speaking of... the two degenerate tris in your set would be 788 and 889
Bad Monkey & Philipp2k2 : I fixed this problem.. look code in my previus post.. it''s been modified.

There are more worlds than the one that you hold in your hand...
You should never let your fears become the boundaries of your dreams.
Advertisement
Bad monkey. in your example, the triangles go from anti-clockwise to clockwise orientation. Is there any way around this?
You can specify a set of indices which will construct a single strip and preserve winding order, but it involves introducing more degenerate tris (totalling 4 between each strip you wish to join)

Whether this is a good idea or not is up to you... I don''t think its so great if you have short strips... but another small example:

678
345
012

indices - 0,3,1,4,2,5,5, 3,3,6,4,7,5,8

algorithmically, you can see that you just have to double-up on the beginning and end indices of each strip (excluding the first index of the first strip and the last index of the last strip)
Cheers.
Would there be any problems with doing the strips that way? like, do degenerate triangles cause any problems, or does the 3dcard just see that they aren''t triangles and ignores them?
no, there should be no problem with using degenerate tris (i ran a quick test using this method to make sure... my GF2mx seemed happy enough)

however, I am not sure what this approach (preserving winding) will do for the vertex cache... i think turning the corner and coming back is more vertex cache friendly... can't say for sure

(anyone in the know about the hardware issues involved here?)

[edited by - Bad Monkey on March 18, 2002 11:24:35 PM]

This topic is closed to new replies.

Advertisement