Author Topic: Textures in FPS Demo  (Read 4728 times)

Offline k_getchell

  • byte
  • *
  • Posts: 4
    • View Profile
Textures in FPS Demo
« on: February 08, 2006, 07:53:17 pm »
All

I am sorry to post such an open question, but I am having real difficulty understanding how the textures are applied in the FPS demo which is provided in the JPCT download package.

From the source I have noted the comment:

Code: [Select]
       /**
         * Load the textures needed and add them to the TextureManager. We are loading the "numbers"
         * texture for blitting the framerate as well as the weapon's environment map and all JPGs
         * that can be found in the "textures"-directory. The 3DS file of the level contains
         * materials that are pointing to these textures (identified by name).
         */


However I am unsure how to determine how the 3DS file of the level refers to each texture.  I have imported the 3DS file into 3D Studio Max 8 and cannot see how the texture files relate relate to the objects by name:  The objects in the 3DS file are named along the lines of objXXX where XXX is the object number.  The materials covering the objects are named MaterialXX where XX is the material name.  The textures are named qlXX.jpg where ql refers (I presume) to the 3DS file, XX refers to the texture number.  Thus I cannot see how either the objects and textures or materials and textures relate.

If anyone could spend the time either explaining, or pointing me in the direction of a URL that explains how to map between 3DS objects and textures I would be very grateful.

Kind regards,




Kris

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Textures in FPS Demo
« Reply #1 on: February 08, 2006, 08:11:48 pm »
I don't know about if or where 3DStudio shows texture names as i don't own it, but the texture names are part of the 3DS-file. jPCT reads them and refers to them by this name. The loader asks the TextureManager for a texture with that name (that doesn't have to be the actual file name...the name in TextureManager can be anything as long as it's unique) and if there is one, it assigns it. If there isn't, it creates a dummy texture with that name. Here's a shot from an older version of Deep Exploration that shows the material properties of the used file. As you can see, the names are there:


Offline k_getchell

  • byte
  • *
  • Posts: 4
    • View Profile
Textures in FPS Demo
« Reply #2 on: February 08, 2006, 11:54:53 pm »
Thanks for the tips, I have been working with the software in Deep Exploration and have managed to get textures assigned to my objects.  However whenever the engine is run, the textures do not look as expected...the structure surrounded in red in the first image is supposed to be overlaid with the texture in the second.


(Fig 1: Screenshot of my jPCT scene)



(Fig 2: Texture which should be overlaid on the object surrounded by red in fig 1)

Any ideas what is going wrong?  I am simply using the code that comes with the FPS demo and using my own 3DS file, so no doubt I am just doing something incredibly stupid.

Thanks for your patience!



Kris

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Textures in FPS Demo
« Reply #3 on: February 09, 2006, 12:12:24 am »
Either the texture is not assigned at all (doesn't look like it, because it's grey, not white like it would be with the default texture) or the texture coordinates are not correct. But that's difficult to tell...you can send me the 3ds-file if you want so that i can see for myself what's wrong with it.

Offline k_getchell

  • byte
  • *
  • Posts: 4
    • View Profile
Textures in FPS Demo RESOLVED!!
« Reply #4 on: March 02, 2006, 05:30:33 pm »
I have finally found out what the problem is.  When converting from 2D plans to a 3D model I was using the Extrude option in 3D Studio Max 8.  The problem was that following the extrude it was impossible to get textures to apply to the objects.

The solution was to apply a UVW Map modifier to the shapes, making sure to select the BOX option on the UVW Map modifier.  This then causes the extruded 2D shapes to behave like a 3D object and accept textures accordingly.

This problem has taken me weeks to solve, but finally I am able to generate 3D models of 2D Autocad plans using 3D Studio Max 8!