Timeline for XNA: Instancing Cubes, Each Side Different Texture
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 8, 2012 at 9:35 | comment | added | Andrew Russell | You get approximately a few hundred draw calls per frame (the "batch limit"). So 30 draw calls per frame is probably fine. But to properly performance tune it, you'll need to take measurements of your running code yourself. | |
| Aug 7, 2012 at 13:52 | comment | added | Nifty255 | Would it still be easy-ish on the CPU to split draw calls into chunks? Each chunk would perform its own draw call, so messing with one block doesn't force initialization of a potentially 32k+ size array, but rather an array of only 10k tops. A maximum of 30 draw calls in a single frame. Sound like it would work? | |
| Aug 6, 2012 at 13:02 | comment | added | Nifty255 | Ah, I see. The vertex declaration, being VertexPositionTexture, will contain all the data for me. Thank you for your help. Now I just need to rewrite my current project which draws each as a cube model. A great many changes coming... | |
| Aug 6, 2012 at 12:45 | comment | added | Andrew Russell | All I'm really describing is what the buffer should contain once you fill it. How you go about filling it and drawing it is up to you (or worthy of a separate question). It's worth pointing out that the buffer will contain "transformed vertices" as opposed to "vertices and a transform". | |
| Aug 6, 2012 at 11:48 | comment | added | Nifty255 | Thank you for clarifying. Should this be implemented so?: block has 6 quads, each with transform, tex coord. chunk requests visible sides from each block and gives to world, which gives to game to draw as a single buffer containing all visible faces? | |
| Aug 6, 2012 at 8:56 | comment | added | Andrew Russell | @Nifty255 In case it wasn't clear from my answer: you should be submitting an entire buffer - containing a large number of quads from multiple blocks - as a single batch (a single GraphicsDevice.Draw*() call). | |
| Aug 5, 2012 at 23:50 | comment | added | David Gouveia | @Nifty255 I'd go with Andrew's suggestion. | |
| Aug 5, 2012 at 15:45 | comment | added | Nifty255 | Wait... What if I used something like: foreach block, foreach face, if block the face is facing is air, submit face data This way, blocks with air above only will only submit one face worth of data, but a lone block would submit all 6 faces. the data would consist of transform(based on side submitted) and the texture coord. The batch consists of only one quad then. | |
| Aug 5, 2012 at 15:20 | comment | added | Nifty255 | Well you would be right about cloning Minecraft. I'm just bored and gave myself a challenge. I too am oblivious to its engine's inner workings other than the fact that each block type extends from a base block, and that each block is part of a chunk and each chunk part of a world. So I came up with this rough code representation: link | |
| Aug 5, 2012 at 11:20 | history | edited | Andrew Russell | CC BY-SA 3.0 | added 115 characters in body; added 3 characters in body |
| Aug 5, 2012 at 11:07 | history | answered | Andrew Russell | CC BY-SA 3.0 |