Note that there are some explanatory texts on larger screens.

plurals
  1. POVertices behind are being drawn infront - XNA
    primarykey
    data
    text
    <p>Well, I am creating a minecraft terrain thing just for the heck of it. The problem I have is that if you look on a certain angle some faces which are actually behind others are drawn in front of them, thus not showing the actual ones which are there. Like minecraft I have the terrain seperated into regions, and when the vertexbuffer is built, only the "outside" faces are shown. It is also for some reason is not drawing the very top nor the left blocks. In addition to all of these problems faces seem to be overlapping ie (only half of a face can be seen)</p> <p>Here is what it looks like (note I am only drawing the top faces because I have to fix the others up): <a href="http://s1100.photobucket.com/albums/g420/darestium/?action=view&amp;current=minecraftliketerrain.png" rel="nofollow">http://s1100.photobucket.com/albums/g420/darestium/?action=view&amp;current=minecraftliketerrain.png</a></p> <p>I am also drawing all the regions in one go with the following method (i'm using reimer's effect file until I can write my own :):</p> <pre><code>public void Draw(Player player, World world) { effect.CurrentTechnique = effect.Techniques["TexturedNoShading"]; effect.Parameters["xWorld"].SetValue(Matrix.Identity); effect.Parameters["xProjection"].SetValue(player.Camera.ProjectionMatrix); effect.Parameters["xView"].SetValue(player.Camera.ViewMatrix); effect.Parameters["xCamPos"].SetValue(player.Camera.Position); effect.Parameters["xTexture"].SetValue(world.TextureAlias.SheetTexture); effect.Parameters["xCamUp"].SetValue(player.Camera.UpDownRotation); for (int x = 0; x &lt; world.regions.GetLength(0); x++) { for (int y = 0; y &lt; world.regions.GetLength(1); y++) { foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); Region region = world.regions[x, y]; if (player.Camera.BoundingFrustum.Contains(region.BoundingBox) != ContainmentType.Disjoint) { device.SetVertexBuffer(region.SolidVertexBuffer); //device.Indices = region.SolidIndices; device.DrawPrimitives(PrimitiveType.TriangleList, 0, region.VertexCount); //device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, region.VertexCount, 0, region.SolidIndices.IndexCount / 3); } } } } } </code></pre> <p>Help would be much appreciated thanks :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload