• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ChristOwnsMe

Draw Order Issue

12 posts in this topic

I am rendering a planet of cubes, and I am having Z issues and I cannot figure out why. Here is an image.

 

http://imgbin.org/index.php?page=image&id=12134

 

As you can see int he center of the image, I can see inside the sphere, when I should be seeing the shell of the sphere.

I am using XNA to render this. My near value is 1f and far value is 30,000f, so I cannot figure out why things disappear at the mid range.Any ideas on how to debug this? Thank you.

0

Share this post


Link to post
Share on other sites

Cullmode is set to none. I thought that is what I should do if I wanted all sides of a cube to display? The outside of the sphere disappears if I move to one side of the spear as well. 

0

Share this post


Link to post
Share on other sites

If you are saying the sphere's are being rendered inside out, I would first play with the cullmode until they appear correct and then play with the winding order of the triangles until you get the correct result with no cullmode set.

0

Share this post


Link to post
Share on other sites

I do have the depth buffer enabled. The sphere looks normal from the front.  As I move around the sphere, the shell starts to slowly fade away,and when I am at the sides, I can see the "inside" of the sphere, or rather the other side of the sphere. My cullmode is set to none. I thought this is what would make it so this issue didn't happen and no polygon would be culled. Am I missing something? I've tried CullMode.None, Clockwise, and Counterclockwise, and the issue is the same.

 

This may be obvious to you all, but this doesn't happen with wireframe. Just thought I'd add that.

Edited by ShadowMan777
0

Share this post


Link to post
Share on other sites

You may have a visual perception problem.  Depending upon the scale of the objects, both may be renderd properly, however, because of how the are constructed, ( color and scope ) you think that you are no seeing what you want.

 

You may want to do some additional testing.  I would try a couple of test.

 

1 - Color either the cube or the sphere a solid color.

 

2 - move the camerea to do a fly by of the cube.  Based upon your stated distance, there should be blank space between the teo entities.from

 

3 -  From what I am seeing, the sphere is obviously larger than the cube, So I would check the scale of each object, this may be causing your overlap.  If the sphere is to large, then it naturaley extend beyond the intended space.

 

4 - I do like the effect.  I think it looks very cool.

0

Share this post


Link to post
Share on other sites

I should mention I am using PolyVox to generate the voxels. This is a 16^3 voxel volume. Each cube is a cube that represents 1 voxel in the volume.The vertices for the cubes are generated in PolyVox and then used in XNA. Here are some more images to help point out the issue more.

 

 

Image 1: The sphere looks fine. Looking at it from the front left.

http://imgbin.org/index.php?page=image&id=12135

 

Image 2:Moving further forward you can start to see the cubes disappearing at the TOP RIGHT of the sphere and you are able to see the other side of the sphere.

http://imgbin.org/index.php?page=image&id=12136

 

Image 3: The closest hull of the sphere is now gone and you can see the other side of the sphere.

http://imgbin.org/index.php?page=image&id=12137

 

This is with CullMode.None on, and depth buffer enabled. I have tried changing the winding order of the vertices to no avail.

0

Share this post


Link to post
Share on other sites

What is your depth function set to because if that is set to pass always you can have depth on but draw order will still interfere with it. You most likely want the depth function to be set to smaller.

 

CullModeNone will draw all polygons btw regardless of winding of vertices only CW and CCW care about winding order and you should switch to one of them in the end as it can help your framerate.

0

Share this post


Link to post
Share on other sites
Also double-check to make sure you actually have a depth buffer (DepthFormat.Depth24 or DepthFormat.Depth24Stencil8 when you create your backbuffer/rendertarget).
0

Share this post


Link to post
Share on other sites

How big am I allowed to have my far plane without causing issues? My far plane right now is 40,000, and if I set it super low and get close to the sphere there doesn't seem to be issues.

0

Share this post


Link to post
Share on other sites

It's not how big your far plane is but the ratio between your far plane and your near plane that matter.  The easiest fix is to push your near plane out a little - if increasing it to say 10 or so resolves the issue, then you've just confirmed that a value of 1 is much too small for you.

 

There's a useful depth buffer precision calculator at http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html which will let you plug in some values and see how much precision you lose: with near 1 and far 30000 (and assuming a 24-bit depth buffer) the smallest depth separation you can resolve at the mid-range (15000) is a little over 13 units; increase near to 10 and this becomes 1.3 units - much better.

 

This, by the way, gets considerably worse if you're using a 16-bit depth buffer; with near 1 and far 30000 your smallest resolvable separation is now close to 2800 units!!!  Quite nasty indeed.

 

So two main things here - firstly, prefer to use a 24-bit depth buffer (which shouldn't be a problem as all hardware from at least the past 10 years or more will support one), and get that near plane pushed out as far as you can reasonably tolerate it - you're very probably going to find that this will be a lot farther than you think right now.

Edited by mhagain
0

Share this post


Link to post
Share on other sites

Thanks for the info and that calculator. I finally fixed the issue. Apparently I had a DepthBias set to 1 somewhere at some point. Thanks for all the help and information everyone.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0