0
\$\begingroup\$

Im downloading some free 3d models off the internet to test things in my game. When I download the package, it gives me a bunch of texture files and the obj model. What I dont understand is what I do with those textures? Are they used as source image files within the object? If so how can I export the uv map of the model with all these textures on it? Ive been trying to get a working example of this and havent been able to. Can someone guide me in the right direction? I edit my files with blender, and realize this question is a little bit off topic, but im lost!

EDIT:

Example of the textures I am using now:

enter image description here

\$\endgroup\$

closed as off-topic by Josh Jan 21 '15 at 16:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ the obj may have material tags, it'll point to which texture to use \$\endgroup\$ – ratchet freak Jan 19 '15 at 18:45
  • \$\begingroup\$ Okay, that makes sense! So I guess my real question is how can I export the uvmap to png to actually use in my code. Rather than having 5 different files? \$\endgroup\$ – Kyle Jensen Jan 19 '15 at 18:52
  • \$\begingroup\$ Ive looked at some blender tutorials but cant seem to find what I need \$\endgroup\$ – Kyle Jensen Jan 19 '15 at 18:52
3
\$\begingroup\$

An .obj model file may come with a companion file with the extension .mtl. Such a file is a material library that contains entries mapping from a material name to properties, including texture filenames to use for things like diffuse and specular.

In your obj-file, there are mtllib a.mtl directives to indicate the material library to use, and usemtl aaaa directives to select which material in the library that applies to the next occurence of the directive, or the end of the file.

When you load a file, you typically split it up by geometries (which correspond to submeshes) and by material, so that each thing you draw has a single material. From there, it's simple to set the textures indicated and draw.

From an authoring standpoint, an entry in the material library will correspond to a separate material in the editor, and each part using a material is likely a separate submesh or mesh.

\$\endgroup\$
  • \$\begingroup\$ Okay, so how does that translate to my code? Do I have to create a system to render these libraries? Or can I export the UV map of the texture and use the texture like normal. (which is what I would like to do as I am not the best with java.) \$\endgroup\$ – Kyle Jensen Jan 20 '15 at 0:47
  • \$\begingroup\$ @KyleJensen Your existing system with an implicit UV map is ad-hoc. In the obj format the way you associate texture maps with geometry is always via material libraries. You can establish some other convention for your application where you communicate the material definitions in some other way. You can't in general use a single map, as the texture coordinates for each subobject is for the maps of a particular material. \$\endgroup\$ – Lars Viklund Jan 20 '15 at 21:52
  • \$\begingroup\$ I added an example of the texture I have for a simple bear I downloaded. How can I create these? This is what my game can render atm \$\endgroup\$ – Kyle Jensen Jan 21 '15 at 3:58
  • \$\begingroup\$ If the way Im doing it is improper, would you be kind enough to tell me how I can render the mtl using java lwjgl? Or provide me some documentation? I havent really been able to find much help on this situation. @ LarsViklund \$\endgroup\$ – Kyle Jensen Jan 21 '15 at 12:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.