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

What data is needed to draw multiple textures on a single mesh surface?

4 posts in this topic

I have experience with DirectX and am currently doing a project for a modding community (xlnation).  I am new to using multiple textures on a mesh and I need some help. (My only experience is using the old fashioned "1 size fits all" texture that covers the entire surface using u,v coordinates).  There are two things I am trying to figure out with this thread. 

 

  1. I may or may not be able to figure out how to do it on my own but I could use some pointers on where to start.
  2. I am trying to decipher the data in a file that contains texture data for a spherical object's surface.  I need to know what basic information is needed to draw a texture on a mesh surface; specifically a sphere (The texture does NOT cover the entire surface).

 

I am going to discuss the file first because in discussing it, I should be able to get answers to the first question.

 

The file contains the information necessary to draw the globe.  The file is a binary file and has 20 bytes of information stored with each texture followed by the name of the texture file. (I am not including the 4 byte int value describing the length of the string representing the file name).  

 

My guess is that the 20 byte section of information contains 5 floats.  What information would these floating point numbers represent so that they could be used to draw a texture on the sphere that does NOT fill the entire sphere?

 

My original guess was:

some kind of location, (possibly the coordinate of the center of the texture), X,Y,Z

a rotation value

a scale value.

 

The problem I am facing with my guess is that the necessary size of the rotation value (a single float if I have guessed correctly) does not (in my mind) fit with using an x,y,z coordinate system.

 

So what kind of information is necessary to correctly draw a texture over a small section of a globe (or any surface for that matter)?

Edited by primem0ver
0

Share this post


Link to post
Share on other sites

First: welcome to the gamedev community.

 

Second: Take a read through this article. It should help you making posts which may get you better responses.

 

Third: You've asked several unrelated questions. You'll get better responses if you confine yourself to a single technically specific question.

 

That being said:

 

With regard to pointers for rendering meshes with textures, take a look at documentation and examples for ID3DXBaseMesh (more specifically DrawSubset), ID3DXMesh (inherits from ID3DXBaseMesh), the D3DXMESHOPT enumeration, D3DXMATERIAL, and ID3DXEffect. Googling for "d3d9 drawing a sphere" results in ~49000 hits. Does any of that information help?

 

With regard to rendering all or a portion of a sphere - what have you tried? Sounds like a simple vertex grid with positions, texture coords and possibly normals.

 

With regard to hacking a binary file: is it copyrighted material?

 

What's the file extension? What are the formats of the images - PNG, JPG, BMP?

Edited by Buckeye
0

Share this post


Link to post
Share on other sites

Well maybe the nature of my problem extends to several topics but the basic question is this... How do I draw multiple textures onto a single mesh when those textures need to be drawn to different parts of the mesh? There are several different types of textures being used but that doesn't matter right now.  What is important is that one type of texture (the most important one) is the outline (shape) of a continent.  (The continent is white on a black background).  These continents need to be drawn to the right part of the globe.

 

All I am finding when I search is how to use UV coordinates and to set textures.  However, this problem is more about finding out which vertices to use... because not all vertices in the mesh will be using the same texture (or texture set).   

 

I have read that it is possible to "render" to a "surface" rather than the backbuffer and then use that surface as a texture.  If that is true then I can make some sense of the 20 bytes.

 

4 floats (or ints) describe the location and size of a rectangle (2 each) on the surface.

1 float describing the orientation (angle).  

 

However I am having trouble locating a tutorial on how to do this. PLUS, I don't think that this is the method used.  The problem with this method is that by using it, the textures will become severely distorted near the poles of the sphere. That doesn't happen.  So there needs to be another way to do this that doesn't create distortion.

 

As far as copyrights.  Yes, the material is copyrighted but the game (CitiesXL) was intentionally made to be moddable.  There are 4 modding communities that exist for this game, one of which is on the games original website.  I will be creating a new tool for modding and that tool needs to be able to draw the world on which the cities exist.  

 

All I am interested in right now is the basic method (outline of steps) on how to do this (draw the texture to the right part of the globe).  I can probably look up the details of each step myself.

Edited by primem0ver
0

Share this post


Link to post
Share on other sites

the basic question is this... How do I draw multiple textures onto a single mesh when those textures need to be drawn to different parts of the mesh?

 

The most common approach is to setup a mesh material list for a mesh, where each material may specify a texture (as well as other attributes). An attribute table is then setup which specifies which mesh faces are to have which attributes (material) applied when rendered.

 

This article, though it's based on DX8, describes the process of setting up attribute groups.

 

As mentioned above, take a look at ID3DXBaseMesh, in particular, DrawSubset(). The basic sequence involved is:

 

1. set the material (including texture) associated with an attribute group.

2. render the vertices in that group.

3. repeat for each attribute group.

 

IF (and that's a big IF) the mesh is rendered using DrawSubset, I would guess (and just a guess) that the mesh itself is in a specific order (by either vertex+uv or index) by attribute, and individual textures in the file have a specified attribute number, starting index or vertex number, and number of indices, vertices or faces.

 

It may well be (as you intimate) that a different rendering scheme is used, in which case, all bets are off. Without knowing how the mesh is rendered, it's extremely difficult at best to determine what data is needed to perform the rendering.

 

EDIT:

 

 


So there needs to be another way to do this that doesn't create distortion.

 

Not true. Take a look at "Mercator projection." Images of that projection could be used and would be specifically designed for "distortion." Examining the textures themselves may give you a clue as to how they are rendered.

Edited by Buckeye
0

Share this post


Link to post
Share on other sites

I will take a look at this possibility.  Thanks

 

 


So there needs to be another way to do this that doesn't create distortion.

 

Not true. Take a look at "Mercator projection." Images of that projection could be used and would be specifically designed for "distortion." Examining the textures themselves may give you a clue as to how they are rendered.

 

 

Except that none of the files that contain the continent textures have any kind of distortion. (EDIT) Including the black and white continent outline masks (/EDIT).  There is a mercator projection that has distortion but it is a black and green targa file.  

Edited by primem0ver
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