• 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
lipsryme

Geometry jumping around / distorted on close up(Depth problem?)

9 posts in this topic

I've got a curious problem I need some help with. When I translate my geometry e.g. 6000 on an arbitrary axis in world space. And then get close to them they start to distort and jump around a bit when the camera moves. This does not happen with geometry located around 0. My nearPlane is 0.01f and far plane 50000.0f Decreasing the far plane does not solve the problem. Increasing near plane only in the sense that I can't even get that close tongue.png I'm not sure why this is only happening if my geometry is far away in world space (but still in front of my camera). Here's a video showing this: [url="http://www.youtube.com/watch?v=O-VFosRp9WY&feature=youtu.be"]http://www.youtube.com/watch?v=O-VFosRp9WY&feature=youtu.be[/url]

0

Share this post


Link to post
Share on other sites
When you are 6000 units from the camera you have effectively chopped off up to 13 bits of fractional precision. Typically this shouldn't matter for the rendering as you should have aggregate transforms which work in camera space. Is it possible you are transforming from local to world then world to view? If so then combine them together on the CPU beforehand.
2

Share this post


Link to post
Share on other sites
But I'm not actually 6000 units away from the camera, my camera is located at the same 6000 units in front of my geometry.
And btw I'm using a 32bit float depth buffer. (DXGI_FORMAT_D32_FLOAT)
How does it matter if I transform one by one in the vertex shader ? Edited by lipsryme
0

Share this post


Link to post
Share on other sites

If the camera and the object are both 6,000 units away from the origin, then you have lost the same amount of precision on both. This adds up to some nasty jumping around.

 

The best way to rectify this is to treat your camera as the origin of the scene, and move everything else around it (can be done by quite simply by subtracting the camera position right before building your model/view matrices).

1

Share this post


Link to post
Share on other sites

You mean subtracting the camera position from the geometry's position ? This does not seem to work for me.

1

Share this post


Link to post
Share on other sites

You mean subtracting the camera position from the geometry's position ? This does not seem to work for me.

Subtracting the camera's position from every object's position (including itself - the camera should be located at [0,0,0]).

0

Share this post


Link to post
Share on other sites
The problem is I need my camera to be at 6000+ for my atmosphere shader to work. Also my geometry completely disappears. Let me get this right, I translate my geometry somewhere, and from this translation value I subtract the camera position ? (And the camera has to be at 0,0,0?)

Hmm I guess it might be possible to fake my position for the atmosphere telling it that I'm 6000+ higher on the y axis while I'm actually not Edited by lipsryme
0

Share this post


Link to post
Share on other sites

So the point is that floating-point precision is greatest close to zero, and reduces quite drastically over larger numbers.

 

Currently, your camera and object are ~6,000 units away from zero (so the precision is very bad). But conceptually, your camera and object are very close together, so you can exploit that fact by moving the origin closer (and it's conceptually simple to treat the camera position as the origin). If you really need your further object to be 6,000 units away from the camera, that's fine - after you subtract the camera position they will still be 6,000 units apart from each other.

 

I imagine however that the problem is that the atmosphere shader relies on being centred at the origin (which you should fix - what happens when you want 2 separate planets with atmosphere?). A simple fix here is to do the atmosphere calculations in the planet's local coordinate space (while rendering everything in the camera's coordinate space).

1

Share this post


Link to post
Share on other sites
Well since it's relying on precomputed texture lookups and needs the world position of the geometry and the current camera position I figure I could offset this 6360 units on the y-axis, and running this I do seem to get the same correct results like before but I'm actually at 0, 0, 0 now. I will however try to use this trick of making everything relative to the camera to further avoid problems with the depth precision. Thanks. Edited by lipsryme
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