One model - with several textures: howto?

Blitz3D Forums/Blitz3D Programming/One model - with several textures: howto?

BerhanK(Posted 2003) [#1]
How do I load a b3d model which has texture maps stored in several files: like


1) doo3 texture (own file)
2) outdoor texture
3) desk texture

etc..
I am talking about loading
a b3d file (LoadMesh command)
and then LoadTexture, but the loaded b3d model oses more than one texture..

thanx


Ross C(Posted 2003) [#2]
Do you mean multitexturing, or 2 uv sets?


BerhanK(Posted 2003) [#3]
2 uv sets I guess!

Anyway why would someone use multitexturing?

I mean what is it used for?


Ross C(Posted 2003) [#4]
Well, with multitexturing, you can have 8 different textures on the one surface. They would all use the one uv set, but each can be scaled and rotated seperatly. And they use a blend mode, also can be individually defined, to draw the texture.

For instance, on a terrain, you might have a grass texture for the whole terrain. Then you could have another texture, scaled up more, for bits of plants. Then on top of that, another texture for a path or something.


Gabriel(Posted 2003) [#5]
I don't think you're after multitexturing. Maybe I've misread the question. But are you asking about loading a single b3d file which contains several separate objects? Each of which requires a different texture?

If so, that's no problem, and you don't need to mess around with UV sets or multitexturing. Just parse through the children with FindChild/GetChild and apply textures to each. They will need to be separate objects within your modelling application in order to do this, but they probably already are.


simonh(Posted 2003) [#6]
Of if the B3D model has only one mesh but that mesh consists of several surfaces, you can texture each surface separately by using GetsSurface and PaintSurface.


jfk EO-11110(Posted 2003) [#7]
You can also use a Texturemapping Tool to assign Textures to diffrent parts of a Mesh. Lithunwrap 1.3 is freeware. Usualy you should use only a minimum of texture-files (which are then seperate surfaces). But using Lithunwrap you can also put several Texture-Materials on one Texture image and then move the vertices, triangles or groups of the Mesh to the wanted positions.


BerhanK(Posted 2003) [#8]
My model is only one file(only one .b3d file loaded) with several surfaces, and I want to use several bitmaps, for each "object" in this model.

Everything is done in lightwave and I only convert the lwo object/scene to b3d format.

I am not sure how to do the FindChild/GetCHild, does it work with only one model? I mean a scene that consists of only one model?
Perhaps Blitz reads it as several models as there are several surfaces?!


Thanx guys.


Rob(Posted 2003) [#9]
LoadAnimMesh keeps all the bits seperate with seperate textures.


BerhanK(Posted 2003) [#10]
Rob, I do not have an animation.

I only have one b3d file (no onim in it)!

It's an office scene which has a window and from the window there is one surface with the picture of a streetscene. It's this file that is loaded(should be loaded) from a separate file.

In fact I'd like to load all my textures for all objects from separate files!

The tricky bit is that the whole scene is only one object/entity.

If I had my objects (soffa, desk, and so on) loaded separetely then it wouldn't be a problem, but I'd like to do everything in the lightwave and then just save the scene and import it in b3d!
Only because it looks so much better with shadowmaps rather than realtime shadow.


BerhanK(Posted 2003) [#11]
I found a function in the code area called: LoadB3D but I can't get it to work - has anyone tried it?

http://www.blitzbasic.com/codearcs/codearcs.php?code=524

thanx


jhocking(Posted 2003) [#12]
Whether or not your model has animation data is irrelevant. LoadAnimMesh keeps separate objects within a model separate, while LoadMesh merges everything into a single object/entity.

That said, the issue may be that you need to apply textures to separate surfaces, not to separate objects. It's really hard to tell. Use CountSurfaces on your model to see if there are multiple surfaces; if so, texture surfaces individually.


BerhanK(Posted 2003) [#13]
I found it:

it' much more basic really:

just use this:

room = loadmesh("office.b3d")
C_Text = Loadtexture("textures/Room_01_Texture_1024_day.tga")
C_Text2 =LoadTexture("textures/city_day.tga")

entitytexture room, C_Text
entitytexture room, C_Text2,1

the model has a texture for the office scenen and one texture for the bitmap seen thru window..


Ross C(Posted 2003) [#14]
Multitexturing :)


BerhanK(Posted 2003) [#15]
Ross C, I am not sure that it's multitexturing.

Because if I only type:

room = loadmesh("office.b3d")

Then everything works properly.
But If I load the textures manualy I have to type like that in order to make them work properly!

I dunno.