3DS Loaders In OpenGL

Started by
13 comments, last by LostinTime 16 years, 3 months ago
Hi, I been trying to get 3ds loaders and tutorials for my project work. However, so far, most of the 3ds loaders I found had seperate texture loaders that map the coordinates of a texture onto the object. Is there a specific reason for doing so? I ll also gladly appreciate it if someone could give me a link to a webpage that has a tutorial on it (loading the texture of the file from the 3ds file itself). My Compiler is Vstudio and I am using C++ for the project.
Advertisement
How would you go about adding a texture to a 3D model?

FlyingIsFun1217
Either by assigning the material inside 3D max itself, or as I load into Vstudio and then assigning bits of the texture loaded which is loaded in a different file.

I know that chucks are part of a 3Ds files, but I still dont get how to read the chucks texture.

Also, I read about a library being used for 3DS in Vstudio, is that true?
I know someone wrote a file using cilo.h and similar headers, but I cant seem to find the full headers for it,or I am confused by the integers beside the code, since they dont correspond to each other( you ll understand when you google for it).
Textures AREN'T included in the 3ds file,... only UV coordinates are. You need the texture in a separate file.
Quote:Original post by Dunge
Textures AREN'T included in the 3ds file


That's what I was trying to get to. When you have a 3D format (I don't know of one that does...), no texture is saved. When loading a 3D model, you need to figure out what texture to use and how to put it on that 3D model.

FlyingIsFun1217

Yup, in your .3ds file, you're going to find :

Main chunk -> 3d editor chunk -> material chunk -> texture map 1 chunk -> texture filename

...which is a null-terminated string such as "default.tga".
You then have to load this file yourself.
Quote:Original post by Trillian
Yup, in your .3ds file, you're going to find :

Main chunk -> 3d editor chunk -> material chunk -> texture map 1 chunk -> texture filename


I don't think it's a sub-chunk of the 3D Editor chunk.

Main Chunk -> Material Chunk -> Texture Map Chunk -> Texture Filename

0x4D4D -> 0xAFFF -> 0xA200 -> 0xA300 ( '\0' terminated char array )

I could be wrong. My 3DS loader was thrown together before I ditched it and wrote a custom format.

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

Oh dear... let me get this straight..There isnt any file format out there which allows me to export both the mesh and the texture? ( not talking about custom file formats).

Deadstar, do you have a tutorial about writing your own file format? I ll take a shot at it.
As far as I know, only some custom file formats allow texture embedding. Depends on what you define as 'custom', of course.

However, what's the problem with storing textures externally? Why would that be any more complicated that designing your own format?
Create-ivity - a game development blog Mouseover for more information.
Supposedly i have different textures for different parts of these say a table I created..to texture them I would need to layout the texture like that of a cube , isn' it? An open six-figure cube. or something similar. However when I import in I must use a texture specific to one, so like say I want one part of it to be in bump map, the other in tga, wouldnt that kind of inflict with one another?

the other solution would be to load the file sperately then texture them accordingly..but loading takes time. Hence, I ll want to try that.

My friend suggusted piggy-backing half life engine to get what I want into Opengl, but I dont feel its right, so I am left with this.

This topic is closed to new replies.

Advertisement