Materials & Textures

Blitz3D Forums/Blitz3D Programming/Materials & Textures

_PJ_(Posted 2003) [#1]
If I load in a mesh that contains surface, UV and texture information, then I try and re-texture it, my new texture doesn't appear. I have tried inserting TextureBlend commands, but they have either no effect, or leave the mesh brilliant white (no texture).

Any ideas where I am going wrong?
Sorry I cannot provide my code at the moment.


Akat(Posted 2003) [#2]
load the texture first... i think if all the UV and texture info 'exist' in the model, so u dont have to texture it then, just load the model - if u used TerraPak, only load the texture first (without the name) before load the model.


_PJ_(Posted 2003) [#3]

if all the UV and texture info 'exist' in the model, so u dont have to texture it then, just load the model



That's the problem. I wish to use my OWN texture on a model that seems to have texture data within the code.


skidracer(Posted 2003) [#4]
Are you using the PaintMesh command?


_PJ_(Posted 2003) [#5]
NOpe, just EntityTexture... I will give Brushes a try later...


jhocking(Posted 2003) [#6]
I never have any problems here. My guess is that you simply aren't doing it correctly. For example maybe you typed the filename incorrectly (although that would result in a memory access error so I suppose that isn't the problem here.) Another possibility is that you are using the wrong texture layer. How about posting your code?


_PJ_(Posted 2003) [#7]
I'm sure it's something to do with UV info within the mesh. Only I'm not very techy, and do not understand that sorta stuff!!!

At the moment, the code leaves the mesh bright white. Failing this, it seems to have a texture of its own that isnt linked to an external file. My texture doesn't appear on it at all.

I cannot post my code for you to try because it is all over the place and objects data is read in as types from a file. However,

download
this

and look at the files:

Beta\Libraries\SectorBuild.bb
max_objects=ReadLine (SectorFile)

For bf=1 To max_objects

setup_object.sector_object=New sector_object

setup_object\name$=ReadLine (SectorFile)
setup_object\class$=ReadLine (SectorFile)
setup_object\scaleX=ReadLine (SectorFile)
setup_object\scaleY=ReadLine (SectorFile)
setup_object\ScaleZ=ReadLine (SectorFile)
setup_object\PosX=ReadLine (SectorFile)
setup_object\PosY=ReadLine (SectorFile)
setup_object\PosZ=ReadLine (SectorFile)
setup_object\mesh=LoadMesh("Visual\3d\"+setup_object\class$+".b3d")
setup_object\texture=LoadTexture("Visual\3d\"+setup_object\class$+"txt.bmp",9)
setup_object\RotX#=ReadLine (SectorFile)
setup_object\RotY#=ReadLine (SectorFile)
setup_object\RotZ#=ReadLine (SectorFile)
setup_object\Shield=ReadLine (SectorFile)
setup_object\Hull=ReadLine (SectorFile)
setup_object\Friend_or_foe=ReadLine (SectorFile)
setup_object\Dock_Here=ReadLine (SectorFile)
TextureBlend setup_object\texture,3
EntityTexture setup_object\mesh,setup_object\texture,0,1
PositionEntity setup_object\mesh,setup_object\posX,setup_object\PosY,setup_object\PosZ
ScaleMesh setup_object\mesh,setup_object\scaleX,setup_object\scaleY,setup_object\scaleZ

NameEntity setup_object\mesh,"Construction"

 Next




Beta\Libraries\Sectors\Sol\Objects.DAT (open in notepad - it's just text)
the following excerpt is the data being read for 'setup_object.sector_object' Type



finally:

Beta\Visual\3D\Station.b3d
and
Beta\Visual\3D\Stationtxt.bmp

These are the mesh and texture files in question. In the game (just execte Beta/Main.bb ) the entity is the space station that is right in-front of the camera :-)


Sorry about the format, hope it's clear - any probs let me know!