0
\$\begingroup\$

I would like to implement a rendering component that makes use of texture-, bump- and light mapping. Unfortunately, I am a little bit stuck on some implementation details. In particular,

  1. Does each different map require individual texture coordinates? (I assume at least a light map would)
  2. Is there a simple file format that stores all the information needed? ( I guess .obj's are missing support for light maps)

I would be grateful for advice on this.

\$\endgroup\$
  • 2
    \$\begingroup\$ Texture and bump/normal maps generally use the same UVs, though the resolution may be different in some cases. Lightmaps are only useful for static geometry, and they're dependent on a specific environment an object is in, so it doesn't really make sense to package it with the mesh data, which is often reused multiple times. You could use the same UVs for lightmapping but usually you will just have a few large lightmap atlases. You probably want to create your own file format that stores exactly the information you need in a way that's easy and fast to read. \$\endgroup\$ – bcrist May 20 '14 at 3:34
  • \$\begingroup\$ @bcrist Shouldn't this be an answer ? \$\endgroup\$ – Heckel May 20 '14 at 7:41
  • \$\begingroup\$ @bcrist Thank you for the comment! It made a lot of things clear. I am now thinking about the file structure. Especially, how to associate the light map atlas, the mesh file and the additional coordinates to map the light map texture to the mesh. If you post your comment as an answer, it can mark it. \$\endgroup\$ – scttrbrn May 20 '14 at 9:21
  • \$\begingroup\$ @Heckel yeah I suppose it should have been. When I started out I was just going to make a comment about lightmaps not being a property of the mesh itself, but the comment grew as I was writing it :P \$\endgroup\$ – bcrist May 20 '14 at 13:40
2
\$\begingroup\$

Usually, for texture based lighting techniques such as normal mapping and specular mapping, the same set of texture coordinates is used, because the textures are the same, only holding different contents. See this image:

enter image description here

The first is the normal map, then the diffuse map (object color), then a couple specular maps. As you can note, they have the same "shape", just different colors. So the texture coordinates should be the same.

Light maps in the other hand normally use a separate set of texture coordinates, since they are images that simulate the shape of a light source projected on a surface.

As for a file format that stores information for all normal/specular/light maps, the Collada format is probably a a good place to start looking. It is a XML based format, so it is very extensive.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. I might look into Collada, though I think it is a quite complex format to fully understand. \$\endgroup\$ – scttrbrn May 22 '14 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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