Author Topic: Problems with Texture  (Read 6220 times)

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Problems with Texture
« on: July 24, 2005, 01:28:10 pm »
I did the following:
Code: [Select]

tex = TextureManager.getInstance();
Texture grass = new Texture( "grass2.png");
tex.addTexture( "grass", grass);

terra = Loader.loadASC( "terra02.asc", 1, false);
terra.setTexture( "grass");


The result can be found here
I have tried different sized of textures and got no result. Has that something to do with the U and V Data in the ASC file? I still have not found any informations about the fileformat, so I am learning it by try and error ;)

Perhaps anyone of you knows this and can tell me how to fix it ;)[/url][/code]

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Problems with Texture
« Reply #1 on: July 24, 2005, 01:36:00 pm »
I think I got it fixed by setting U and V greater 0 ;)

Hm, I fixed the weird pixelerror, but I got no clue how to show the texture correctly. can anyone post some informations about the U and V Part of the ASC file?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Problems with Texture
« Reply #2 on: July 24, 2005, 07:07:50 pm »
u and v are a textures x and y with 0,0 being the upper left corner and 1,1 being the lower right. To map the upper right triangle of a quad with it's corresponding "triangle" of the texture for example, one would use (0,0), (1,0),(1,1)...and (0,0),(0,1),(1,1) for the lower left triangle.

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Problems with Texture
« Reply #3 on: July 24, 2005, 07:17:54 pm »
When I create Terrains with those (most points are descriped 3 times than), I get an error from the loader. File seems to be to big. So I only use 1 Texture for the terrain, write no U and V and look how to create terrains with 3ds ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Problems with Texture
« Reply #4 on: July 24, 2005, 07:29:49 pm »
ASC is an old 3DS variant and 3DS is limited to 2^16 vertices per object. If you are using more, this may cause trouble. Are you?

Edit: You don't have to use the conversion step to ASC/3DS/whatever as you can create the triangles directly from your PNG and add them to the object "by hand" using addTriangle in Obejct3D.

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Problems with Texture
« Reply #5 on: July 24, 2005, 08:29:04 pm »
Hmm, I should try that. thanks for the idea ;)

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Problems with Texture
« Reply #6 on: July 24, 2005, 09:11:30 pm »
Works great!
Just the OcTrees take forever and the "createTriangleStrips" you are using in the FPS example.
What exactly does it? and is it important for Terrains? ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Problems with Texture
« Reply #7 on: July 24, 2005, 11:17:35 pm »
Quote from: "Uija"
Works great!
Just the OcTrees take forever and the "createTriangleStrips" you are using in the FPS example.
What exactly does it? and is it important for Terrains? ;)
Creating an octree takes it's time...it's already quite optimized. Creating triangle strips isn't...but it may be usefull on the terrain depending on how you are creating it. Google for "triangle strips" to see what they actually are and build your terrain accordingly. jPCT will recognize it and so there should be no need to call createTriangleStrips anymore.