I cant get my floor model to work properly

Started by
2 comments, last by BCullis 11 years, 7 months ago
Hello guys, im making a new 3D game, i made a floor model, but it dowsnt draw the fourth triangle.
Here is the source: http://EvoGame.codeplex.com

Here is the model:

vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(0, 1)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, -0.5f), Vector3.Up, new Vector2(0, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(1, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, -0.5f), Vector3.Up, new Vector2(1, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(1, 1)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(0, 1)));

Thanks,
Andrei
Advertisement
Ok since you are declaring your vertices manual I suppose you do the same with the indices. I don't know why you need six vertices to make a floor or which vertices are used for the fourth triangle but my first guess is that its happening because of the cullmode. Write:
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
If the triangle shows up you have to declare it with the negated draworder.
found the problem, added 3 more vertecies.

and thanks, it didnt work:( im sorry
You masked your problem by adding another triangle, actually.

If I sit down and plot out the points you indicate in world space, I get two overlapping triangles with a missing chunk. And I can see why your third triangle "fixed" it.

[attachment=11247:explain.jpg]

If you don't want to use indexed drawing (which would let you use just 4 vertices) then you just need to change the position vector of your last (6th) vertex in the initial list to
(-0.5, -0.5, -0.5) and texture coords to (0,0) (so that it'll show up next to vertex "2").

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)

This topic is closed to new replies.

Advertisement