Swapping texture on certain polys

Blitz3D Forums/Blitz3D Beginners Area/Swapping texture on certain polys

Dock(Posted 2005) [#1]
Is there any way that I can change the texture on specific polygons on a mesh? I have a grid that I want to be able to change certain tiles from 'Off' to 'On', but I'm not sure of the best (or easiest) way to do it.

I considered using animated textures, but I realise this will cause all the tiles to change at once. I could possibly move the UVs, but I'm not sure how to do that either.

Any ideas?


jhocking(Posted 2005) [#2]
I would recommend using separate surfaces (ie. split up the mesh into multiple surfaces.) You can have separate textures on different surfaces.


Dock(Posted 2005) [#3]
Ah, interesting...

If I'm building my grid in 3DSMAX, how would I export it with each tile defined as a seperate surface? How would I change the texture on a particular surface within the model?


Dock(Posted 2005) [#4]
I still don't seem to be able to do this. I tried detaching each tile as a seperate object, but this causes problems for my lighting (I have a lightmap shadow cast over the grid).

Is there anywhere that I can find more information on surfaces in Blitz, or is there another way to change the texture on certain triangles only?


BlackD(Posted 2005) [#5]
Don't use separate surfaces for a tiled surface. Very very slow.

The command you want is VertexTexCoords.

+BlackD


octothorpe(Posted 2005) [#6]
Note that you may need to give the triangle its own vertices (still on the same surface though) if you don't want the textures on the surrounding triangles to blend into your new UV coords.


jhocking(Posted 2005) [#7]
Don't use separate surfaces for a tiled surface. Very very slow.

Whoops, I didn't notice that your mesh is a grid of tiles. Yeah, too many surfaces is bad.

Your thought about moving UVs is the way to do it, and BlackD pointed you to the relevant command. And, as octothorpe points out, you need to ensure the tiles have discontinuous UVs for this to work. Although not the only way, breaking the mesh into separated (but paradoxically still combined) polygons is one way. If you are using 3D Studio Max the fastest way to assign discontinuous UVs to a grid is using the UV Map modifier set to Face mapping, although breaking apart the polygons would probably make things easier to code (ie. it'll be simpler to determine which UVs are associated with which polygons.)


Dock(Posted 2005) [#8]
Excellent, I got this working. However, I have some more questions:

It works nicely when I have the grid on its own as a B3D file, but it doesn't cope too well when I have multiple objects within the same B3D file. Is there any way to choose a specific object/surface within a B3D file? Does Blitz remember the object names from MAX?