• 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
s.howie

How was this achieved?

10 posts in this topic

I watched this video that demonstrates some graphics tech Obsidian are developing for Project Eternity.
 
 
I'm really curious of how they achieved 3D dynamic water levels and lighting on a 2D image.
 
If anyone could explain it to me like I am 5, I would greatly appreciate it.
Edited by s.howie
0

Share this post


Link to post
Share on other sites

That reminded me of late PSX and early PS2 era stuff. For a moment I thought they were making an dev kit and was somewhat interested, but then I saw they're just making yet another 'classic' cRPG. Sort of puzzled by why the guy is excited enough to talk for half the video about that. It's well made, but there's nothing really new there.

0

Share this post


Link to post
Share on other sites

@ L. Spiro

 

Thanks for your reply. My 5 year old brain is struggling to understand all of what you said but I think I have a tentative grasp on the basic idea.

 

What I took away from your explanation was as follows:

 

1) When the 2D image of the environment is generated, a depth buffer is returned along with the RGB value of each pixel.

2) This depth information per pixel can then be used to somehow mask the water effect.

 

 

I got lost where you mention "reversing the actual height of each pixel".

 

 

I have a few assumption on how step 2 is achieved:

 

1) I assume that the depth buffer for each pixel is the distance from the camera, and that the z height of the pixel could then be found from knowing this depth value and the angle and position of the camera.

2) Once the z depth of a pixel is known, I assume when the water texture is rendered it checks each pixel against the corresponding pixel z height of the environment image, only rendering when the height is equal to or below the water height.

3) Knowing next to nothing about graphics programming, I'm assuming these operations, being per pixel, are pushed to the GPU by a shader.

 

 

Thanks again for shedding some light on what is going on under the hood. Please let me know if I have horribly misunderstood your explanation.

0

Share this post


Link to post
Share on other sites

When they rendered the scene from their 3D model they kept the depth buffer from the render. When they draw the 2D scene they restore that buffer and then do additional drawing. They can get that water effect by fiddling with the depth of the water. It's not necessary to use a shader for the water effect; normal depth testing can do that. The lighting effect (day/night shift) could be done with a pixel shader. The depth buffer operates at the per-pixel level, so the positioning of the camera in this case is somewhat moot, since the scene is pre-rendered. Basically each pixel has a value indicating its depth. In order for a new color to be drawn into that location it must have a lesser depth value than the existing pixel. So to lower the water like that they can just increase the depth at which they render the water texture and the rock pixels will end up on top, hiding the water. The lighting effect with the orb looks kind of like bump mapping or displacement mapping. Links below:

 

http://en.wikipedia.org/wiki/Z-buffering

http://en.wikipedia.org/wiki/Bump_mapping

http://en.wikipedia.org/wiki/Displacement_mapping

Edited by Khatharr
2

Share this post


Link to post
Share on other sites

@Khatharr

 

Thanks for your explanation and the links.

 

My understanding of what I am reading on z-buffering is that the depth value is distance from the camera. If depth value alone was used to determine where the water was rendered then would it not render in a plane that faces the camera rather than a plane facing up the y axis?

 

Perhaps I am coming at this from the wrong angle. I am thinking of the water as a flat texture rather than a plane that has also been rendered and has its own z-buffer. If this were the case, then this planes depth buffer could be shifted to shift the water height. Then the two depth buffers can be checked against each other, rendering the pixel closest to the camera.

 

Am I getting close?

0

Share this post


Link to post
Share on other sites

@Khatharr

 

Thank you for that succinct explanation. I feel I am starting to understand, at a very high level of abstraction, what is going on.

 

I'm inspired to play around with the concept to see if I can get a similar effect. I may cheat though and render an image. I'll render both environment model and water plane depth buffers as images then do a pixel by pixel comparison to see which pixel I should chose to draw into the combined image.

 

Thanks again.

0

Share this post


Link to post
Share on other sites

@Khatharr

 

Thanks for the further explanation.

 

I assumed that depth testing would usually be performed on graphics hardware. However, the skill set and tools I have immediately at my disposal wont allow me to program for it (I planned to play around with the idea in Javascript and my graphics card isn't supported by WebGL). Hence the inefficient CPU rendering of the image. Essentially my plan was to overlay the water image onto the environment by comparing the two depth buffers (rendered as images). I understand this is not what really happens when a scene is rendered to the screen.

 

However, your comment has helped me further understand the concept and for that I am grateful. Your description of how they would not clear the depth buffer before drawing the water but instead copy in the depth buffer of the environment for comparison against those of the water plane drove it home for me.

 

Your insights into the rendering process have given me a great appreciation of how a scene is rendered. I find it hard to believe how many calculations must be going on under the hood to do a raycast for each pixel on the screen against each triangle in the scene each frame and every frame. It does all this and runs at 60fps!

 

Mind = Blown

 

Obviously there must be optimisation strategies to only do tests that make sense (like spatial partitioning?), and maybe not recalculating depths for an object that has not moved if the camera is static (Though this wouldn't help keep a solid framerate whilst the camera is moving). And many other things I wouldn't even think of.

 

Thank you for all your time in trying to make sure I understand the concept. It has been very valuable. But I feel as if I am only becoming more and more curious ;P

Edited by s.howie
0

Share this post


Link to post
Share on other sites

One of the big optimizations that the GPU has access to is the fact that rasterizing a single pixel is "embarassingly parallel" (actual technical term). None of the results depend on any of the other results. All the operations can be done in parallel. This is why you'll often hear about 'streams' on a GPU. The GPU will actually rasterize an enourmous number of pixels at the same time. The hardware is also optimized for floating-point and matrix math and the pipeline itself is riddled with optimizations like face culling and frustum clipping that can exclude large numbers of polygons from most of the required processing. It's a pretty interesting system and well worth the time to investigate and fiddle with. smile.png

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