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

GPU Terrain Physics

12 posts in this topic

How can terrain physics be handled when a lot of modern terrain rendering is done via the GPU?

Normally for brute force approach and small heightmaps you could create vertices on the CPU and load them into a physics engine as a collision mesh but with GPU approaches there isn't always a 1:1 mapping of vertex data on the CPU to whats displayed on screen (eg. hardware tessellation or vertex morphing). One idea was to generate a low-medium resolution version on the CPU to form the collision mesh but I'm not sure how practical this is as it may cause visual artifacts with physics objects sinking into the terrain or perhaps even floating.

What is the modern approach to this that games like BF3 are using?
2

Share this post


Link to post
Share on other sites
I don't have a direct answer, but some food for thought:

It's been standard practice forever for physics and graphics to use different representations of the world, with different levels of detail.
E.g. in a car racing game, the renderer might have a mesh of 100k triangles per car, but physics just has half a dozen simple convex-polytopes per car.

You've also got to consider that object physics may be dictated by some graphic-less server, but will be viewed by two different clients -- one with uber-detail mode with 1M triangles for the terrain, and one with low-detail mode with 10k triangles for the terrain. In that case, the server can't generate a result that looks perfect for both clients, so it's got to make some kind of trade-off, such as using the medium-detail terrain mesh for physics.

If this is the case, where physics and graphics are necessarily somewhat out of sync, then there's a few tricks that can be done on the graphics side to patch up obvious problems. E.g. after being told where a humanoid is standing, the graphics could trace rays down from the characters feet against it's actual (current LOD) terrain mesh, and then use IK to properly anchor the character to the ground on the client-side.
2

Share this post


Link to post
Share on other sites
When you play some AAA games you will notice that some characters do sink into the floor (or gound) or do also float on some platforms. So I personally wouldn't worry too much about it.
What you don't want to see happen is that your character collision gets the player stuck into a wall or bush, with the only resolve being to restart a game checkpoint.
(This has happened in Uncharted 2 in a swimming pool level and in Uncharted 3 when I sent the boy jumping from the roof into a bush on the adjacent balcony)
Fixing those will get your collision detection into the right direction.
0

Share this post


Link to post
Share on other sites
In case of tessellation, you can have the physics be roughly correct with your terrain physics mesh, and then render a sporadically updated orthographically projected view of the displacement map for the terrain around your characters, and then sample that map when you do your skinning, and offset the verts up or down depending on the displacement at that point, and fade the offset out as the distance in between the terrain and the verts being processed gets bigger. (credits to the clever guys at NV for that).
0

Share this post


Link to post
Share on other sites
Thanks all. Seems clear that I need to use low/medium resolution data for physics and for large worlds have the ability to stream "chunks" in and out of memory.
0

Share this post


Link to post
Share on other sites
[quote name='ATEFred' timestamp='1345570312' post='4971897']
In case of tessellation, ... render a sporadically updated orthographically projected view of the displacement map for the terrain ... and offset the verts up or down depending on the displacement at that point...[/quote]Maybe PhysX allows that. I'm afraid (albeit not sure) it would wreak havoc in Bullet as all the contact points would get invalidated due to collision shape getting changed. The implication of this is that collision against heightfields would have to be bypassed... or is it just me?

It appears to me it's just a better solution to use standard signal analysis techniques. Heightmap points represent original signal with an adeguate margin of error. Interpolation must work inside this tolerable margin. Therefore, tassellation does not change physics representation, as it is already "accurate enough" for simulation purposes, leaving tassellation as a purely graphical effect.

Vertex morphing is also introduced to avoid visual popping or other visual artifacts. There's little reason to propagate those changes to the physical representation IMHO.
0

Share this post


Link to post
Share on other sites
[quote name='Krohm' timestamp='1345621596' post='4972109']
[quote name='ATEFred' timestamp='1345570312' post='4971897']
In case of tessellation, ... render a sporadically updated orthographically projected view of the displacement map for the terrain ... and offset the verts up or down depending on the displacement at that point...[/quote]Maybe PhysX allows that. I'm afraid (albeit not sure) it would wreak havoc in Bullet as all the contact points would get invalidated due to collision shape getting changed. The implication of this is that collision against heightfields would have to be bypassed... or is it just me?

It appears to me it's just a better solution to use standard signal analysis techniques. Heightmap points represent original signal with an adeguate margin of error. Interpolation must work inside this tolerable margin. Therefore, tassellation does not change physics representation, as it is already "accurate enough" for simulation purposes, leaving tassellation as a purely graphical effect.

Vertex morphing is also introduced to avoid visual popping or other visual artifacts. There's little reason to propagate those changes to the physical representation IMHO.
[/quote]

The technique (which they called displacement aware skinning) is visual only, so it is completely orthogonal to your physics computation methods. The idea is to still compute collision and IK or whatever using your physics solution, whatever it might be. Then when rendering the mesh itself you offset vertices based on the displacement used for tessellation (of the rendered meshes, not physics meshes) so that your previously computed vert positions based on the bone positions based on your physics computation match the actual displaced geometry rather than the simpler collision geometry.
0

Share this post


Link to post
Share on other sites
I don't understand. Graphics is not a vacuum. There will always be implications.

So we get now two systems, which must be kept in sync, with a serious possibility for them to diverge, a GPU read back for what? To fix a couple of pixels of encroaching? I still think this technique is taking for granted displacement will be very high. That might be the case for a generic tassellation, but in general it's not the case for terrain (the whole point of terrain is that it tolerates small errors).
This is what Hodgman is saying... live with approximations. And I agree with him.

Displace this:
[attachment=10877:Terrain-resting.png]
Please explain how would they fix it.
The implications of the "big influence" scenario are massive. If we have to use displacement like that, than in line of theory bounding boxes are... by extension of the same level of detail no more maningful. Occlusion queries should be perfomed on the real geometry... so... I don't understand what the starting point is. Perhaps it's just me.

Here is another way graphics influences gameplay. Or at least player reactions.
[attachment=10878:terrain-collision.png]
Please propose a solution. We can go great lengths in saying how this is a purely graphic effect.

An extreme problem. Consider steps of a stair. This configuration would cut a ragdoll to pieces.
Unless we write code to be smart and figure out what to do in each case (such as figuring out a global rotation: this is no more a plain displacement map rendering and usage.
Artistic issues: tell all your artists to deal with an additional texture fetch for something they don't really care. Or write a system which injects the proper code. Neither is free of consequences.

I cannot really wrap my head around this. Edited by Krohm
1

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1345709250' post='4972511']I dont understand why you're having a problem with this -- you're describing and agreeing that graphics and physics are necessarily slightly out of sync in a typical game, and the above suggestion is a hack that makes the results visually plausible, while introducing out-of-sync problems elsewhere instead. It's just a shifting around of our approximations. [b]It's just another option to add to your toolbox, to be evaluated on a case-by-case basis[/b].
[/quote]Thank you very much for stressing this for me. I think this is very important and was exactly the goal of my previous message.
1

Share this post


Link to post
Share on other sites
[quote name='Shael' timestamp='1345525258' post='4971716']
How can terrain physics be handled when a lot of modern terrain rendering is done via the GPU?

Normally for brute force approach and small heightmaps you could create vertices on the CPU and load them into a physics engine as a collision mesh but with GPU approaches there isn't always a 1:1 mapping of vertex data on the CPU to whats displayed on screen (eg. hardware tessellation or vertex morphing). One idea was to generate a low-medium resolution version on the CPU to form the collision mesh but I'm not sure how practical this is as it may cause visual artifacts with physics objects sinking into the terrain or perhaps even floating.

What is the modern approach to this that games like BF3 are using?
[/quote]

Unsure if you're still reading this, but I'll just [url="http://www.slideshare.net/DICEStudio/terrain-in-battlefield-3-a-modern-complete-and-scalable-system"]leave this link here[/url].
0

Share this post


Link to post
Share on other sites
Thanks for the link. That's some pretty hefty techniques they're using. I think I'll just go with a simple implementation and gradually build upon it.
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