Some questions about world meshes, and multitexturing!

Blitz3D Forums/Blitz3D Programming/Some questions about world meshes, and multitexturing!

ChrML(Posted 2004) [#1]
I read this in the Command Reference:
A little note about multitexturing and slowdown. Graphics cards support a maximum amount of textures per object, which can be used with very little, if any, slowdown. For most cards this is two, but for a GeForce3 it is four. However, once you use more than this amount, Blitz will emulate the effect itself by duplicating objects and textures. Obviously, this may then cause slowdown.

I'm modelling a foo level for my game, to test different stuff, but wonder how I should set up the meshes. Some textures must be animated (like traffic lights, water, etc...). Should I make the entire level (except stuff that must be moved, breaked, similar...) in ONE mesh, and then texture faces with different texures (which means hell of lot of UV mapping, and slowdowns according to the blitz manual), or should I split up in pieces where each objects have max two textures. How should I do the traffic lights, when the front, and ONLY the front, not the rest of the obstacle, must be updated ingame several times. I know about LoadAnimTexture and that stuff, but not how to attach the texture loaded to a single face. And after all this stuff, how the hell can I lightmap it, or somehow get different stuff in the world to cast shadows?


Al Mackey(Posted 2004) [#2]
I think the manual isn't being very clear here. It really should read "textures per surface" and not "textures per object". On the line just before this one, the manual reads:
The optional index parameter specifies which index number should be assigned to the texture. Index numbers are used for the purpose of multitexturing. See TextureBlend.

So I'm pretty sure it's talking about how many textures you can stack on top of each other, not how many textures are used total across an object.


ChrML(Posted 2004) [#3]
Okay. Thanks for clearing that up :). Anyone knows a way to get rest working?


jfk EO-11110(Posted 2004) [#4]
shadows is not easy. there are two kinds: static and dynamic. as far as I know sswifts shadow system is the only one that is really useable. But it isn't for free. Dynamic shadown are used with moving things like characters etc.

Static Shadows are achieved by lightmaps, these are precalculated shadow-textures. they will be mixed with the original textureS of a Mesh , so they will define which parts are in shadow and which are lighten. There are several Lightmaping Tools around, even Radiosity Tools, a more realistic Lightmapping method: Maplet is free for Blitz Customers. There is Lightbulb, Cartographyshop, Gile[s] and more. Some can import and lightmap Meshes, others can only create, lightmap and export.

A mesh is made of Triangles and Triangles are made of 3 Vertices and each Vertex has its UV Coords which describes its location on the texture. UVs are stored as floats from 0.0 to 1.0, representing a range of 0 to texture size (eg: 0.5=127 when the texture width of 256)

When a Mesh uses 2 Layers of textures, each Layer has its own UV Set. So there is Coords Set 0 for the usual Textures and Coords Set 1 for the Lightmap texture.

If a static (non-animated) mesh uses multiple textures (not talking about multiple layers here!) you can access the various Textures by their Surface handle, using the Paintsurface command.

b=loadbrush("fancy.bmp")
surfs=countsurfaces(mesh)
for i=1 to surfs
 s_id=getsurface(mesh,i)
 paintsurface s_id,b
next


Of course, The mesh needs to be stored as a multi-surface thing.

Try Lithunwrap 1.3

http://w1.854.telia.com/~u85426484/LithUnwrap.zip

a tutorial: http://homepage.ntlworld.com/toneth/LithUnwrap.html

, which is free and lets you map meshes with any number of surfaces. Or buy its sequel, UltimateUnwrap3D, which is one of the most essential low cost UV Mapping tools around.

You can also use the saveB3D Code from the Code Archives. So you would use the Command AddMesh to add some Surfaces together to one mesh and then save it. But if you use AddMesh, you best only use Mesh Commands, and no Entity Commands for those Meshes, until they are added together. Use PositionMesh instead of PositionEntity, PaintMesh instead of ENtityTexture and so on.

Sorry, my english is really bad.

So if you once have your Light Signal mapped in a way that it uses 2 Surfaces, also known as Materials, you can access the lamp part as a seperate surface.


ChrML(Posted 2004) [#5]
My greatest thanks, jfk. I'll see what I can make :).