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

Cylindrical texture coordinates

8 posts in this topic

Hello,

In my application I want to handle textures in a same way, even if they are applied in a different manner (projection, cylindrical, spherical, box). So this means I don't want to use automatic texture coord. generation, but I want to calculate them myself, when the object is created.

Usually, people calculate one texture coordinate (u,v) for each vertex (x,y,z). So each vertex will always have assigned the same texture coordinate.

But in my understanding, this cannot work when using cylindrical/spherical texture mapping:

suppose that one of the triangle (with vertices A, B, C) closing the cylinder has following angular coordinates (in polar coordinates, in degrees): 340, 350, 10

So those 3 vertices will be mapped following 3 u-texture coordinates: 0.9, 0.95, 0.05 (approximately!)

But that is not correct: the texture fragment would be spanning across almost the whole texture!

we should rather have following u-texture coordinates: 0.9, 0.95, 1.05

I could assign the vertex C the u-texture coordinate "1.05" to make that triangle look ok, but the problem is that the same vertex C is also part of other triangles, which might rather require the u-texture coordinate "0.05".

I hope I explained myself clearly enough ;)

So the only solution to this would be to have 3 texture coordinates for each triangle, rather than to have one texture coordinate for each vertex. Do people usually do that?

Is there another option?

Thanks for any advice!
0

Share this post


Link to post
Share on other sites
[quote]So the only solution to this would be to have 3 texture coordinates for each triangle, rather than to have one texture coordinate for each vertex. Do people usually do that?[/quote]
[quote]the texture fragment would be spanning across almost the whole texture![/quote]
What the hell are you talking about. How does a texture fragment which has a single pixel from a texture have a whole texture mapped to it? That's impossible. And to unwrap a cylinder to a texture you only need 2 uv's. You have to have a seam obviously. Take a soup can without top/bottom, cut the label from top to bottom and unfold. It is 2d applied to a cylinder.
-1

Share this post


Link to post
Share on other sites
Thank you for the reply dpadam450,

I didn't use the right word I guess. With "texture fragment" I meant "one textured triangle part of the cylinder".
I attached a picture to this reply, it should clarify my problem.

Thanks
0

Share this post


Link to post
Share on other sites
Right so don't build a triangle that goes over that seam. That's how it has to be obviously. You can either cut up your triangles along the seam or/but for any model done by an artist they will have seams anyway. You don't make seams and then model them, you make the seams cut through existing vertices based on your models shape.
0

Share this post


Link to post
Share on other sites
Thanks again.

Obviously that's one way to do. But it is very troublesome if you are not directly in control of what geometry is being used (i.e. the user can edit and manipulate the geometry)
The way I am doing it now (see my "funny" explanation above) works, but instead of calculating the texture coordinates on a vertex basis, I am calculating the texture coordinates on a triangle basis:

Basically, instead of one pair of texture coordinate per vertex, I use 3 pair of texture coordinate per triangle

I just wanted to confirm that this method is also being used sometimes, since I will have to be able to export the whole thing at some point, and provide something "standard" ;)
0

Share this post


Link to post
Share on other sites
No it is never used because there is no reason to not open it up in a 3d application and edit it. Not to mention a perfect cydlinder that had the triangle as you have shown it should have never ever been built that way.
0

Share this post


Link to post
Share on other sites
Well, then here is a stupid question maybe:

With the specially prepared cylinder (with correct seam) you will still need special handling at the seam points: indeed every seam point is part of a triangle "opening" the cylinder, and a triangle "closing" the cylinder, thus every seam point will need 2 differentiated texture coordinates... unless you create the cylinder open (i.e. two overlapping seams, each seam point is present twice).

Please refer to the picture: points B & C in the upper part, will require different texture coordinates!
0

Share this post


Link to post
Share on other sites
The second form, the "open" cylinder, is the common solution used in almost every model exporter available. The reason is exactly as you have mentioned.
Texture coordinates are not the only attribute that can differ per vertex on the model. Multiple normals are also commonly available, forcing even more splitting into multiple "single attribute" vertices.
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