Texture layers and 3d mesh objects

Blitz3D Forums/Blitz3D Programming/Texture layers and 3d mesh objects

Crazidemon(Posted 2005) [#1]
I just got a free Citroen Xsara mesh off the internet, and it looks great. I was trying to texture the different objects in blitz, but found that they textured all the objects in the mesh. Is there any way around this? Also, I was trying to put a seperate texture onto the number plate, which was a different layer to the rest. I couldn't find any ways to texture just this one layer, without changing the rest of the car.

If you could help, that would be great.


Brendane(Posted 2005) [#2]
You will need to locate (by trial an error probably) the Surface in the Mesh which uses the number plate texture. Use GetSurface() on the Mesh for each of it's surfaces. Then construct a new Brush and set a texture for the brush (ie your new number plate) - then use PaintSurface to paint it with your new Brush.

If you are wondering why?
A Mesh is a collection of Surfaces.
Each Surface can have its own Brush and holds the geometry that uses this Brush.
A Brush describes how the geometry is to be drawn - ie colour, texture, blending etc.

So essentially your model will have been split up into several surfaces because it uses several different textures.

Make sense?


John Blackledge(Posted 2005) [#3]
Or load the mesh into a proper modeller, texture it there - that's the usual way.


jfk EO-11110(Posted 2005) [#4]
You can use Lithunwrap, the latest free version 1.3 for that (google). Make sure to read a lithunwrap tutorial, some of it is a bit tricky.

In this App you can assign a texture to each Object (that would be a Surface in Blitz). Even when the mesh has only one surface, you still can position its UV Coords in a way that allws to use certain parts of the texture for certain triangles or groups of triangles.

This is the hard part of the work: you need to drag the Verices and Triangles to the right positions on the texture.


Crazidemon(Posted 2005) [#5]
Thanks guys, I'll try that tonight. Never thought of using different surfaces.


Crazidemon(Posted 2005) [#6]
Hmm, Lithunwrap is a really hard program to learn, might need to read a tutorial first. Looks great though, thanks.


Brendane(Posted 2005) [#7]
Crazidemon : If you are considering using different surfaces - be aware of the performance issues (might not bother you of course).

More surfaces usually means more textures - which means textures have to be switched more often during rendering - switching textures is costly and something you generally want to minimise in a real world app.

In your car example you could make it more optimal by 'packing' all the textures onto one texture and re-building the UVs using something like LithUnwrap.

There are times when you can't pack textures - ie when a texture is 'wrapped' over an object (ie some texture coordinates are outside the range of 0-1).

Just to point you in the right direction.