Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

173 Neutral

About Drakken255

  • Rank
  1. Many thanks, can I get an example in the shader? I can't seem to get it working. Also, translations are held in the bottom row of matrices, yes? Because I build each instance's translation matrix like so: float4x4 instanceTrans = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, trans[0], trans[1], trans[2], 1}; and when I multiply that with my rotations, things get weird. But if I don't, then the faces face up as expected.
  2. Thanks for the tip, but I decided to simply build and pass 6 rotation matices to the shader before even sending the instances, since a cube face can only have 6 rotations. So now it's just a matter of correctly reducing the size of my atlas index information. Should I be able to apply a similar technique since my atlas indices are unsigned shorts? Even if I have to pack 2 shorts into one 32 bit integer, and unpack them to 2 32 bit unsigned ints in the shader, that's fine. I just don't know what combination of options will allow me to correctly send 4 unsigned shorts.
  3. Let it be known that all I'm asking is how to write my shader and other relavent graphics code to send as little data per-instance as possible. I'll worry about reducing instances on my own.   That being said, I need to know how to send four (4) unsigned short integers to the GPU, considering HLSL has no 16 bit integer type.
  4. Firstly, if this ever becomes more than a learning exercise, it will definitely not be a Minecraft clone. It will instead likely be a 3D Pocket Tanks. I am already instancing individual faces, and my game detects whether a face is hidden by others. So it is only drawing what can be seen, except for faces behind others. I haven't quite figured out occlusion culling yet, but that is a secondary concern. The entire purpose of my post was to ask how to effectively reduce graphics transfer bandwidth on a per-instance basis first, and then reduce the number of instances. EDIT: I figured out how to reconstruct translation and rotation matrices, so all I need to pass per-instance is 3 floats for position, and 3 floats for rotation. Now, it's just a matter of whether or not a ushort will be properly converted to a regular int by the shader.
  5. Hello all, long time since my last post.   I worked on a voxel engine about a year ago in XNA using hardware instancing of each cube's faces. While making it, I made a post here asking for advice (link below) on how to improve the framerate, as my code was incredibly inefficient, from doing too much unneeded update logic to simply drawing too much. During said discussion it has improved vastly, but had to put the project down without implementing the number 1 most important piece of advice I took from that post: reducing the volume of data about each instance. Following is a quote explaining how much I was using and how much I could have been using.     My goal is to take the last byte count down even further. transform 3*4 -> 12 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes color 2*1 -> 2 bytes TOTAL: 20 bytes   As the quote shows, I was indeed passing an entire matrix, when only the translation info was needed. I solved this easily enough by simply passing a Vector3 and rebuilding the world matrix in the shader.   Next, I want to take the next three variables (coordinates for a texture atlas, (base, overlay, and breaking)), and reduce them further than 2*2 down to a single 16 bit unsigned integer, which should allow ~65,536 different atlas coordinates. Problem is: (1). I don't know how to turn an index into an x and a y int in HLSL code. I could do it in C# fine by just dividing the index by the number of pieces per row, storing the rounded down number as y, and subtracting the y * the number of pieces per row from the index to get x. (2). HLSL has no 16-bit integer. Is it possible to still send a 16 bit int, but convert to a 32 bit int once it's there? Or am I just missing unlisted integral types?   Lastly, for my color, I only want to send 2 bytes. The first will represent red, green, and blue, while the second will represent transparency. How do I convert 2 bytes into 2 floats when the time comes?   All in all, I just need help in converting different data types back and forth to allow for the least needed bandwidth when I send my instance information.   For those of you that would like to view the original discussion, click this link: http://www.gamedev.net/topic/629247-face-instancing-dividing-draw-calls/       EDIT: I just realized that since I am instancing individual faces of each cube, I do also need rotation, so memory per instance will actually look like this: transform 12*4 -> 48 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes color 2*1 -> 2 bytes TOTAL: 56 bytes   What I don't understand is why I need to send an additional 6 bytes for a 3 axis rotation, or where in the matrix that data is, so I now also need help getting this cut down a bit.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!