Textures on interiors
by Dave · in Torque Game Engine Advanced · 09/11/2006 (2:58 am) · 7 replies
Hi,
Just wondering if I'm missing something here. I have an interior created in Quark which looks fine in the 3D view in quark. All textures mapped OK. The export using the TSE map2dif works with no errors. I copy the dif and the textures into the same directory in my game. All textures are 256 x 256.
The interior appears in my game but with the orange "no material" texture on all surfaces. The only thing I can spot in the log is a few lines where it says "material unmapped" for the textures I am using.
I haven't done anything different to the way I did this in previous versions of the engine (M3 was the last version I used). Can anyone tell me if I'm missing some new essential step for interiors?
Thanks a lot,
Dave.
Just wondering if I'm missing something here. I have an interior created in Quark which looks fine in the 3D view in quark. All textures mapped OK. The export using the TSE map2dif works with no errors. I copy the dif and the textures into the same directory in my game. All textures are 256 x 256.
The interior appears in my game but with the orange "no material" texture on all surfaces. The only thing I can spot in the log is a few lines where it says "material unmapped" for the textures I am using.
I haven't done anything different to the way I did this in previous versions of the engine (M3 was the last version I used). Can anyone tell me if I'm missing some new essential step for interiors?
Thanks a lot,
Dave.
About the author
#2
new Material(UNIQUEMATERIALNAME)
{
baseTex[0] = "mymaterial";
}
That would be the simplest material definition. There is a full list on TDN of the the base material types or you can create custommaterials for advanced shader use.
09/11/2006 (3:16 am)
You need to create a material definition for each texture used. Make a file called materials.cs in the same directory as your dif and have it do something like this:new Material(UNIQUEMATERIALNAME)
{
baseTex[0] = "mymaterial";
}
That would be the simplest material definition. There is a full list on TDN of the the base material types or you can create custommaterials for advanced shader use.
#3
Apologies for not searching the docs, I didn't bother as I didn't think materials applied to plain old textures splattered on interiors, unless you wanted to do something fancy with shaders.
Thanks again,
Dave.
09/11/2006 (3:22 am)
Lads, thanks very much. I played with materials in an earlier milestone, up to and including writing my own shaders, but did not have to create a material for every texture I used. That seems slightly crazy to me! However if that's the way it's done I'll go and read the docs. Apologies for not searching the docs, I didn't bother as I didn't think materials applied to plain old textures splattered on interiors, unless you wanted to do something fancy with shaders.
Thanks again,
Dave.
#4
An example of what I am trying is this
new Material(misc174mat)
{
baseTex[0] = "misc174";
mapTo = "misc174";
};
The texture is named misc174.jpg. What happens now is that the "no material" texture disappears but the other textures do not appear. The dif is invisible from the outside. If you move inside the dif some of the walls are bright yellow and some are invisible. I have no bright yellow textures specified. It's really frustrating.
Any help, or pointers to up-to-date docs, would be gratefully recieved.
Thanks,
Dave.
09/11/2006 (5:24 am)
Well, I've spent the last couple of hours reading and trying things out with no luck. The docs on TDN are way out of date, using datablocks and addmaterialmapping(). Unless I am looking in the wrong place...An example of what I am trying is this
new Material(misc174mat)
{
baseTex[0] = "misc174";
mapTo = "misc174";
};
The texture is named misc174.jpg. What happens now is that the "no material" texture disappears but the other textures do not appear. The dif is invisible from the outside. If you move inside the dif some of the walls are bright yellow and some are invisible. I have no bright yellow textures specified. It's really frustrating.
Any help, or pointers to up-to-date docs, would be gratefully recieved.
Thanks,
Dave.
#5
new Material(AnynameHere)
{
baseTex[0] = "misc174";
bumpTex[0] = "misc174_b"; ///only put this in if you have bump maps
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 0.1"; //you can add stuff like this to it
specularPower[0] = 32.0;
};
leave out that mapto command....hope it helps...works for me just like this
09/11/2006 (8:51 am)
Hey...try this...new Material(AnynameHere)
{
baseTex[0] = "misc174";
bumpTex[0] = "misc174_b"; ///only put this in if you have bump maps
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 0.1"; //you can add stuff like this to it
specularPower[0] = 32.0;
};
leave out that mapto command....hope it helps...works for me just like this
#6
09/11/2006 (9:37 am)
Another thing that it could be is if your are defining the material in a different directory from where the texture is. If so you can do a full path like basetex[0] = "~/data/interiors/misc174"; and it should find it.
#7
Thanks a million, got it working. It was as JC said, I was defining the materials in a different directory to the textures...doh!
Oh well, as usual it wasn't a complete waste of time, I learnt some useful things. Isn't that what makes programming an endless round of fun? And also found that there's a handy little function in the materials.cs in the demo folder that saves a lot of time defining new materials.
Thanks again to one and all for your help with this.
Dave.
09/11/2006 (11:18 am)
Hi folks,Thanks a million, got it working. It was as JC said, I was defining the materials in a different directory to the textures...doh!
Oh well, as usual it wasn't a complete waste of time, I learnt some useful things. Isn't that what makes programming an endless round of fun? And also found that there's a handy little function in the materials.cs in the demo folder that saves a lot of time defining new materials.
Thanks again to one and all for your help with this.
Dave.
Torque Owner Stefan Lundmark