Painting an Entity
Blitz3D Forums/Blitz3D Beginners Area/Painting an Entity
| ||
I have been experimenting with creating a "door" mesh for a dungeon. I selected a nice wood texture to color it, but when I display the door, it just shows up as a gray color, not the vivid browns of the wood texture. What am I missing? What's the proper procedure for "painting" a mesh you have created. Hey, BTW, is there anyway to save meshes created inside Blitz3D, so they can just be loaded off a harddrive? |
| ||
I'm guessing you haven't set UV coordinates for your vertices. UV coordinates let the rendering engine know what parts of your textures get painted where on your mesh. |
| ||
Yes you can save meshes - look in the code archives there are a few different formats that you can export to. Although I don't think it is possible using blitz commands alone to create bones so animated b3d models are not possible, I think. Here are some of the code archive links: ASC format: http://www.blitzbasic.com/codearcs/codearcs.php?code=1033 B3D format: http://www.blitzbasic.com/codearcs/codearcs.php?code=866 VRML format: http://www.blitzbasic.com/codearcs/codearcs.php?code=580 DirectX format: http://www.blitzbasic.com/codearcs/codearcs.php?code=631 Oh..and regarding the first question - yes you need to set the UV coordinates on each vertex of your mesh. |
| ||
Hate to admit it, but while I am fairly practiced at 2D programming, this is my newbie attempt at Blitz3D. So, ummm, how do I set the UV coordinates? I have created a mesh and one surface (do I need to create a separate surface for each side of the door?) and eight vertices, and have created 12 triangles (for the six sides of the door). How do I set UVs for these? Thanks. (Oh, and thanks for the info on saving meshes!) |
| ||
Use the VertexTexCoords command to set the UVs. |
| ||
Well, the command says: VertexTexCoords surface,index,u#,v#[,w#][,coord_set] Parameters surface - surface handle index - index of vertex u# - u# coordinate of vertex v# - v# coordinate of vertex w# (optional) - w# coordinate of vertex coord_set (optional) - co_oord set. Should be set to 0 or 1. Description Sets the texture coordinates of an existing vertex. So, what are u# and v# and w# coordinates? How are they expressed? What info should I be supplying to the command to accommodate it? |
| ||
First of all, forget about the w# coord - it's not used. Also, forget about the coord_set for now as this is only used for multi-texturing. The u and v coords specify the horizontal and vertical coords of the texture to map to the vertex. However, these coords aren't expressed as pixel positions, they're a decimal fraction in the range 0.0 to 1.0. So, the top-left of the texture is u=0,v=0 and the bottom-right is u=1,v=1. Crappy ASCII art coming up: 0 U coord 1 0 ---------------------- | | | | V | | | | c | | o | Texture | o | | r | | d | | | | | | 1 |____________________| That's probably as clear as mud so you're probably better off googling for a better explanation of how UV mapping works. :) |
| ||
Here you go.![]() This image shows pretty much what big10p said, I highlighted one of the UV co-ordinates which is shown in red, the co-ordinates for it are at the bottom of the image (ignore the W co-ordinate). Basically you have a texture, then you move the vertices of the parts of model to fit to it. Hope that helps. =) |
| ||
Most definitely interesting. Thanks. What application are you using for that dartboard pic? For what it's worth, I worked around the door by simply using CreateCube()., then ScaleMesh to reshape it, and then textured it, and voila! I have a door. |
| ||
That screenshot is from Max 6. I haven't tried messing about with UV's in Blitz yet. I will do one day though. |
| ||
I've been looking up the price on 3d max. Holy smoke! That's one expensive software package, and out of my cost budget. |