(DX9) Problem Octree with a Big Static Mesh - Urgent Help

Started by
7 comments, last by pristondev 6 years, 5 months ago

Hey, Im trying to use this Octree sample from Davig Ang https://www.programmingmind.com/demo/basic-octree

What happens its that works perfectly with small meshes or medium meshes, buuut, with a really big mesh, dont.

 

The mesh I want to use:

01a31144cb.png

What happens on Octree App:

32b881d7e1.png

 

As I said, this happens ONLY with BIG MESHES, small meshes like on the sample all works good. I already tried to change the #defines, because its a big mesh, but nothing works.

Thanks for help.

Advertisement

Perhaps your vertex indices are only 16-bit?

I think Nypyren is right, see Octree.h line 70 :


WORD	*indices;

That smells of integer rollover.

I changed to UINT and I got the same problems, but only with big meshes..

Did you change the GPU code to upload and use 32bit indices too?

-potential energy is easily made kinetic-

15 minutes ago, Infinisearch said:

Did you change the GPU code to upload and use 32bit indices too?

Ye..

D3DFMT_INDEX32

mGroups.numFaces * 3 * sizeof(UINT);

UINT *indices;

I deleted most of the map objects, to turn it into a small mesh, but I got the same problem lol.

4798505ad9.png

 

With this mesh (example), all works good.

6217eb6061.png

 

@Loading the mesh out of this octree system, like DX mesh viewer, I can see normally

Probably the problem is here:


// Copy over all the faces and groups from the mesh			
	unsigned int *indices		= NULL;
	unsigned long  *attributes	= NULL;

	newMesh->LockIndexBuffer( D3DLOCK_READONLY, (void**)&indices );	
	newMesh->LockAttributeBuffer(D3DLOCK_READONLY, &attributes );

	for(DWORD i = 0; i < totalFaces; i++)
	{
		mFaces[i].v1 = *indices++; 
		mFaces[i].v2 = *indices++; 
		mFaces[i].v3 = *indices++;
		mFaces[i].group = attributes[i]; // Store the group (attribute) index - this is where the grouping happens

		mGroups[attributes[i]].numFaces++; // Keep count of the number of faces		
	}

	newMesh->UnlockIndexBuffer();
	newMesh->UnlockAttributeBuffer();

Im getting problem with mGroups on my meshes, so CreateIndexBuffer failed and crash the program. What I was doing before to run program, I was simply ignoring when mGroups.indexBuffer is null, but I think that its the problem.

 

Someone?

This topic is closed to new replies.

Advertisement