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

Archived

This topic is now archived and is closed to further replies.

Someone

Texture coordinates?

5 posts in this topic

Hi! I was wondering what is the best way to store texture coordinates? I read in several tutorials and they say that making data structures for vertices and polygons makes it easier to program, and they recommend putting the x,y,z,u,v coordinates in the vertex structure. However, it seems to be giving some problems in the texture alignment. For instance, just say I have a texture saying "HELLO" going from left to right and want it textured on all 6 surfaces of a cube. Now if I put the U,V coordinates in the vertex data structure for the front face as (0,1) = top left (1,1) = top right (0,0) = bottom left (1,0) = bottom right The word "HELLO" would be properly shown in the front face. But how do I make it make it show properly as well on the side faces (just say the face on the left), since the left vertices of the front face are now the right vertices of the left face? If I put these for the left faces... (-1,1) = top left (0,1) = top right (-1,0) = bottom left (0,0) = bottom right Then the face on the top will start having problems since the top left vertex (which is the same vertex as the top left vertex of the left face) and bottom left vertex (which is the same vertex as the top right of the left face) of the top surface as not aligned in the same U coordinate. So I''m wondering if anyone has any ideas on how to handle this situation... Do I separate the U,V coordinates from the vertex data structure? (Hope my explanation can be understood...)
0

Share this post


Link to post
Share on other sites
yes, that is how i deal with it. i have a vertex list with just the positions and normals, then i have a poly list, each poly has indices to the proper vertices and the uv coor (among other vertex poly specific things, like predermined color and its own normal). otherwise, you can make a texture with repeating HELLO''s and use 0,0 and .25,0 for front face, etc (i won''t go into dealing with the top and bottom faces here OR you can create several addressing modes (ways to interpret tex coords) like in d3d (d3d supports 4 diff modes, i think) and do 0,0 1,0 for front, 1,0 and 2,0 for the next face, finally you have 3,0 and 0,0 for the last face. you then set the addressing mode and in your engine interpret in a special way. in this case, you do wrap around: texcoor % 2, (1 is a special case), so 0 is 0, 1 is 1, 2 is 0, 3 is 1. well, that''s a brainwave, hope it starts a brainstorm.
later, Alex
0

Share this post


Link to post
Share on other sites
Hmm... if you think about it, if you use that 0 = 0, 1 = 1, 2 = 0, 3 = 1 addressing method, there''ll be a face where there is a (1,0) on the left vertices and (0,0) on the right vertices, causing the image to be flipped as well...

I was thinking of more on the OpenGL front, cause in OpenGL, there''s a command where it can take data from an array so that they won''t need to draw shared vertices more than once. I''m wondering how do they handle that in OpenGL engines like Quake. Anyone knows?
0

Share this post


Link to post
Share on other sites
well, i don''t know anything about ogl, but in d3d you handle that by using triangle strips, v1,v2,v3,v4 will make two triangles, v1,v2,v3 and v3,v2,v4. a whole cube can be sent out as a triangle strip. in d3d i would use a proper tex addressing mode (there are those that flip the image and others that don''t, i leave the alg to u), there must be something like that in ogl. sorry i can''t be of any more help.
0

Share this post


Link to post
Share on other sites
You should store the texture coordinates by poly, not by vertex.

It''s fine to store the info by vertex if you repeat the vertex (ie v[1] is the top left corner of the front face v[8] is the top right corner of the left face. In actuality v[1] = v[8], but the program doesn''t know that.)

Since you''re sharing the vertexes though it doesn''t make sense to do that. It''ll cause problems when you''re skinning any sophisticated mesh.
0

Share this post


Link to post
Share on other sites
Yes, OpenGL does support triangle strips, but I''m trying to make the class being able to support all types of objects.

I''ve figured out some method to handle this problem, but have yet to implement it to see if it works fine. What I''m planning to do is to have pointers to texture coordinates in the vertex data structure as well as the polygon data structure. That way, for things like the boxes, you can use the texture coordinates from the polygon structure.
For complicated meshes where each vertex will only have 1 texture coordinate, you can switch to the vertex''s texture coordinates. Any comments on this method? I have yet to try it out to see if it works fine... Storing pointers only won''t cause much performance drop, would it?
0

Share this post


Link to post
Share on other sites