Texturing one side at a time?
Blitz3D Forums/Blitz3D Beginners Area/Texturing one side at a time?
| ||
| is this possible? thanks |
| ||
| Texturing what ? |
| ||
| say i am making something like a building, i don't want the roof to look like the walls |
| ||
| Ok. The usual way is to unwrap/uvmap different parts (groups of triangles) of your mesh so that some parts will be colored with some colors of the texture. You will have to learn about unwrapping/uvmapping... You can also do the same thing in code if you don't need complex shapes for your buildings. (See vertextexcoords http://www.blitzbasic.com/b3ddocs/command.php?name=VertexTexCoords ) |
| ||
| is there anyway to do this in code? |
| ||
| Yes, i just gave you the necessary function. You can also do it this way if you build the mesh in code : AddVertex(Surface,x,y,z,u,v) or VI% = AddVertex(Surface,x,y,z) VertexTexCoords(Surface,VI,u,v) |
| ||
| Or the easy way : Create a different surface for the roof, with a second material using a second texture. At least you'll be able to "tile" the texture which is not possible with texture atlas (or, you'd need to create a quad for each tile, which is both boring to do and not accurate at all) Theory is simple :
tex1 = LoadTexture("wall tex file.jpg/png/etc..")
tex2 = LoadTexture("roof tex file.jpg/png/etc..")
brush1 = CreateBrush()
Brushtexture brush1, tex1
brush2 = CreateBrush()
Brushtexture brush2, tex2
mesh = CreateMesh()
surf1 = CreateSurface(mesh, brush1)
;Add the vertices and triangle for the walls on this surface
surf2 = CreateSurface(mesh, brush2)
;Add the vertices and triangle for the roof on this surface
Main difference is : You don't texture the entity (or the mesh), you texture a material that you apply directly on the surface. |
| ||
| |
| ||
| Ultimate Unwrap3D is a good tool for doing it via an IDE. |
| ||
bobysait, there is an error in your code:AddVertex surfBorderGraphics3D 800,600,0,2 SetBuffer BackBuffer() |
| ||
| Weird, part of the code has been copy/paste overriding itself code updated (I hope). |
| ||
| Thanks, it is working now :) |