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

measure a mesh to aline it to a position

7 posts in this topic

Hi.

 

I'm trying to line up two box shape meshes. In perspective view it works fine even with mesh scaling,

but when I set a orthographic view the height of my mesh are smaller I've multiplied my meshes height value with the orthographic zoom value I use but its off by about 10 to 15 pixels on screen.

 

this is how I set up the ortho projection

float zoom = 1.8f;

D3DXMatrixOrthoOffCenterLH(&OrthograpicProjection, (-Width/2)/zoom, (Width/2)/zoom, (-Height/2)/zoom, (Height/2)/zoom, 0.0f,1000.0f);

 

and my height is like so

Height = GetMeshHeight(mesh) * 1.8;//it just goes through all verts and gets the largest y value

 

any Idea how or whats wrong. it works in perspective projection with the GetMeshHeight() function so it cant be that hey.

0

Share this post


Link to post
Share on other sites

Your post is somewhat confusion... I'm not sure if I get it, but I will give it a try.

 

You use two different ways to render your mesh to the screen, perspective and orthographic, and compares the height measured in pixels of those two renders, right ? Now, you discovered, that the mesh is  smaller/taller in perspective mode vs ortho and you try to compensate by zooming in. The zoom-level is caluclated by the (object-space) height of the mesh.

 

I've some issues with this approach. First, the rendered height of an mesh in perspective view depends on the depth of this mesh, even on the depth of each rendered vertex. Therefor the front surfaces will appear larger than the back surfaces. To measure the height I would take either a flat surface (eg a rect) or atleast a sphere. Second, you can't just take the mesh height (which is in object space) and compare it with something in camera space of a perspective camera. Though this will work for ortho. And eventually , what is the tolerance of 10 to 15 pixels ?  Is it just 3% of the height or 200% ?

 

Well it comes down to this: If you don't have flat meshes, all on the same plane, orthogonal to the camera, then comparing perspective with orthografic rendered images is not really useful and I would be happy with a tolerance of a few pixel, just don't try to make it perfectly fitting.

1

Share this post


Link to post
Share on other sites


I'm trying to line up two box shape meshes.

Ashaman implies it and maybe he guessed correctly - but what does "line up"  mean? You mention a couple of times that "it" works fine in perspective projection, but a better technical explanation is needed for what "it" is. Help us to not have to guess.

1

Share this post


Link to post
Share on other sites

no no no. Im making a interface from the mesh there front view and Im was just saying the Get meshHeight returns the correct height when I use it in a perspective projection.

 

but for this Im only in ortho some thing like this

-------------------------------------------------

|                                                          |

--------------------------------------------      |

| _________________________|___|

                                                   |          see it over lapps this much

-------------------------------------------- 

and I want the other one to be placed under this quad thats the line up I'm talking about

0

Share this post


Link to post
Share on other sites

What is the "height" of a mesh? The AABB volume?

 

 

Mesh data comes from art tools, and artists who build them know where the key positions are that need to line up. I strongly suggest the data be embedded in the art resources themselves. Most artists are very comfortable with the process, dropping whatever kind of object you want such as a bone/joint or locator or some other kind of named marker.

 

The common modern model formats (such as collada) allow you to create many different kinds of named markers inside files. All it takes is a named object with a position and orientation. Think of one object having a slot and the other having a tab. An inverse transformation will let you position the second object's marker at the same position and orientation as the first object's marker.

 

 

1

Share this post


Link to post
Share on other sites

Hi Frob.

I normaly do put in bones for things like this for my skinned meshes but this is just frames just some mesh containers that make up my interface.

my other menus I just pass in a offset found by trial  and error to find the offset needed, this time I thought I would get smart and make it automatic so much for smart hehe.

I'll try changing the z value of the interface and see if I can get the right height.

0

Share this post


Link to post
Share on other sites

Is this what you're trying to do?

 

box%20align.png

If so, are you trying to do that by moving the meshes, or by changing the view?

1

Share this post


Link to post
Share on other sites

Opps Sorry everyone I did 11 hours of programming  and it ends up it was just me the height is in fact the depth hehe.

so in fact it does get the correct height(depth)

 here it is, its a list box that can hold dialogboxes for players who join the game

I think I will change the text I dont like the text the red quad is just a image frame with no image its for the players avatar.

Thanks all, I should take some breaks but time is a factor I have so much work to do.

 

PlayerSlots.jpg?psid=1

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