Multiple UV Maps

Blitz3D Forums/Blitz3D Beginners Area/Multiple UV Maps

Dark One(Posted 2007) [#1]
Hello,

I am relevatively new to Blitz3D coding, but have had it for quite some time now, and am finally trying to get the hang of it; however I have ran into a speedbump.

I have been searching for an answer to this question, however I can't seem to find one, so I'm posting it here. In Blitz3D, how does one go about retrieving the UV map information from the file(say I have multiple UV maps), and set a brush or texture to that specific UV map? I assume its got something to do with surfaces, however I can't figure out how to tell the surface which UV Map it should be painting on...can anyone help with this? Is it possible to set a surface to a UV Map?

Thank you for any help you guys can give me on this.


mindstorms(Posted 2007) [#2]
the texturecoords() command should do it...


b32(Posted 2007) [#3]
A mesh can have multiple surfaces, and they can be painted on with a brush.
However, some meshes have an hierarchical structure, so they consists out of multiple meshes. If so, you can access them using GetChild and CountChildren. Remember to check CountChildren again for each child, because the structure is recursive.

To get the number of surfaces on a mesh, use CountSurfaces and use GetSurface to access the surface. Then, use LoadBrush to load a brush and PaintSurface to paint the brush onto the surface.
The actual UV coordinates can be read using VertexU and VertexV.
TextureCoords is useful if you want to alter the UV coordinates. This command is related to VertexU/V.


jfk EO-11110(Posted 2007) [#4]
Additional notes:

When a mesh was loaded using LoadMesh then it will be one entity (without children) containing a number of surfaces.

When it was loaded using LoadAnimMesh then it may contain a parent child hierarchy where each child may contain surfaces.

The loading order of the surfaces is not the same each time, but some kind of random game. So GetSurface will not return the same results each time you run the program. (Tho, it will not change during runtime, of course)

Each brush may make use of up to 8 textures, but it's recommended to use no more than 4.

No matter how many textures you use with a brush, the max number of texture coord sets is 2. The command TextureCoords allows to make a texture use a certain set.

To save models with multiple coordsets, a working export plugin for your Modelling App is required, or a converter like UU3D. In the B3D model format the texturecoords set is stored in the texture flags parameter, as the bit value $10000 (that is 65536).


Dark One(Posted 2007) [#5]
Thank you guys very much, through your posts and instructions, I figured out how exactly blitz3D treats surfaces, and how to paint them properly. Seems like surfaces are just the "materials" which can be set out within the modelling program, and any textures you apply to the model work based on the models UV Map.

Thank you guys for your help, I was trying to figure out how to properly work the painting for so long; and thanks to you guys I got it working wonderfully now. Thanks again.


RemiD(Posted 2014) [#6]

The loading order of the surfaces is not the same each time, but some kind of random game. So GetSurface will not return the same results each time you run the program.


I have found this too and i think this is really confusing.
A solution to avoid this would be to save the mesh with a custom mesh file...


fox95871(Posted 2014) [#7]
Having seen some pretty undesirable graphical errors in games due to videocard quirks, I never use more than one texture. You can do some pretty amazing stuff with just that one texture though, even eliminate the need for actual lights in your game, which don't look very good on low poly meshes anyway. You get higher compatibility and speed at the cost of just a little extra elbowgrease in Photoshop.

http://www.youtube.com/watch?v=qsd1QZ8nmgE