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

Generating height/normal/etc maps from 2 images

4 posts in this topic

O hai thar

I'm thinking about creating a tool for my engine, that creates normal/height/etc maps from 2 stereo images, just like this software: http://www.photosculpt.net/

That software's just damn awesome..

But I have no idea how to do this.. Any suggestions?
I think it's based on some kind of luminance difference, or what..
0

Share this post


Link to post
Share on other sites
[quote name='L. Spiro' timestamp='1349525205' post='4987368']
This is related to computer vision, which is [i]actually[/i] an AI problem, not a graphics problem.

I will explain some of the procedure but there is too much to explain in one post and you will have to Google some words I will present on your own.


Firstly, there are a few things you need to know about the cameras used to take the images.
#1: The focal length of the cameras (which should be identical). [i]f[/i].
#2: How far apart the cameras were. Used to calculate the baseline [i]B[/i].

In order to calculate the depth for any given pixel you also need to know where it is in space relative to each camera (but only in 1D (X), since the depth component is still unknown and the vertical component Y is the same for both cameras (since it is assumed the cameras were horizontally aligned)).
However, this assumes you know where each pixel is for each camera. That is, for any given pixel, you need to know its X relative to camera 0 and also to camera 1.
Taking 2 images and figuring out this information is called [url="http://en.wikipedia.org/wiki/Correspondence_problem"]Correspondence[/url].

This is the research you need to do on your own, as it is not practical to explain on a forum post, at least when you include SSD ([url="http://en.wikipedia.org/wiki/Mean_squared_error"]sum of square distance[/url]) errors for determining best matches when there are multiple choices to make and when you account for the recovery of lost data.
Note that due to loss in information between images, it is not always possible to determine depth for a given pixel. Your best bet in that case would be to average the depths of nearby pixels in which correct depth information was able to be determined.



Once you have used Correspondence to determine where a single pixel is in relation to each camera, you can determine the depth by doing the following:
Project the pixel onto the back plane of camera 0 by a distance of [i]f[/i], and do the same for camera 1.
The results are x0 and x1.

Knowing the focal length [i]f[/i] and the baseline [i]B[/i], the equation to find the depth [i]Z[/i] is:
(x1 - x0) / [i]f[/i] = ([i]B[/i] / [i]Z[/i])
or:
[i]Z[/i] = [i]fB[/i] / (x1 - x0)


Another useful term would be “Stereovision”.


L. Spiro
[/quote]

This is way more compicated than I thought, wow.
AFAIK in the software I linked in the OP, you don't need to input the focal lenght of the camera, or the distance, or anything. You just input two images and it produces * maps. I founs some kind of tutorial about creating depth maps from two images, if anyone needs the link here's it:
http://www.pages.drexel.edu/~nk752/depthMapTut.html
Thank you very much for your explanation.
If I write something interesting I'll share it here.
Thanks again.
0

Share this post


Link to post
Share on other sites
A general-purpose tool doesn’t actually need to know the baseline or focal-length, since there is a common denominator for both (baseline would be the average distance between human eyes and focal length would be the average depth of the human eyeball, from pupil lens to the central retinal vein).

Of course your results will not be entirely accurate if you do not use the actual terms used during photography, but in most cases photographers try to simulate physical eye conditions so it generally will not be noticeable if you assume these defaults.


L. Spiro Edited by L. Spiro
1

Share this post


Link to post
Share on other sites
[quote name='MrOMGWTF' timestamp='1349534722' post='4987402']
This is way more compicated than I thought, wow.
AFAIK in the software I linked in the OP, you don't need to input the focal lenght of the camera, or the distance, or anything. You just input two images and it produces * maps. I founs some kind of tutorial about creating depth maps from two images, if anyone needs the link here's it:
http://www.pages.dre...epthMapTut.html
Thank you very much for your explanation.
If I write something interesting I'll share it here.
Thanks again.
[/quote]

If you look at the generated depth-map in that link, you'll see the crudity of the result. If you look at the features page for PhotoSculpt, you'll see there are many limitations. I suspect this is because of the approximations and assumptions they make in order to avoid things such as focal length in their calculations. This type of thing is a complex beast, just as L. Spiro indicated. The idea of it is pretty neat, but I just don't think the tech is there yet. I've seen a few things done with PhotoSculpt, and in my opinion at least they just do not come close to what a real artist can produce, especially for game artwork where it's not simply a matter of producing something that is as close to real life as possible, but rather is a matter of producing something that looks good in a game without hampering performance.
2

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