Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (degenerate_762, AndrewAMD, Ayumi), 1,321 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
terrain chunking #216966
07/20/08 12:28
07/20/08 12:28
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Whats the deal with terrain chunk? I have a terrain 256x256 vertices and terrain_chunk set to 32. 256/32 = 8. So I should have 8 chucks with exactly 32x32 vertices.

I end up with 33x33 vertices on all chunks except the last ones in each row, which are 32x32. So the total of vertices is 259x259 instead of 256x256. There is one extra vertex on most chunks... why!?

The math is all wrong when I try to access each vertex on each mesh and write data to a buffer. Is this some sort of technique or is it a bug?

Re: terrain chunking [Re: sheefo] #217284
07/22/08 13:50
07/22/08 13:50
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
HELLO... Hello... hello...

Re: terrain chunking [Re: sheefo] #217294
07/22/08 14:57
07/22/08 14:57
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
the only thing i can think of is the fact that when two are next two eachother, the middle vertices are overlapping causing one extra

Re: terrain chunking [Re: lostclimate] #217306
07/22/08 15:55
07/22/08 15:55
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
If your terrain is with even number of verts , it'll have to split it in half. This would mean for example (in a row) 32 / 2 = 16.
Between the 16 and the 17 vert there is a face...Where would this face go smile ?
If your terrain is with odd number of verts , it'll split in half at that 17 vert...33 / 2 = 16 from both sides and the 17 at the middle.
I'm not shure about this smile but this might be the reason why its adding a vert...to save the middle faces.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: terrain chunking [Re: EpsiloN] #217320
07/22/08 16:51
07/22/08 16:51
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Thanks guys. I fixed it when I made my terrain size 257x257. I accessed each vertex like as if it were 2D grid (which it is) so the extra vertices are not read.

Each chunk is 33x33 vertices now, so the math works out.

What I was doing was a little something like this:
Code:
DWORD dwTotalVertices, dwVertices;
D3DVERTEX* pVertices;
...
dwTotalVertices = pMesh->GetNumVertices();
dwVertices = (DWORD)ceil(sqrt((double)dwTotalVertices));
...
pMesh->LockVertexBuffer(0, (LPVOID*)&pVertices);
for (unsigned y = 0; y < 32; ++y) {
	for (unsigned x = 0; x < 32; ++x) {
		float h = pVertices[x+y*dwVertices].y;
	}
}
pMesh->UnlockVertexBuffer();



Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1