Texturing one side at a time?

Blitz3D Forums/Blitz3D Beginners Area/Texturing one side at a time?

Polarix(Posted 2016) [#1]
is this possible? thanks


RemiD(Posted 2016) [#2]
Texturing what ?


Polarix(Posted 2016) [#3]
say i am making something like a building, i don't want the roof to look like the walls


RemiD(Posted 2016) [#4]
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 )


Polarix(Posted 2016) [#5]
is there anyway to do this in code?


RemiD(Posted 2016) [#6]
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)


Bobysait(Posted 2016) [#7]
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.


Bobysait(Posted 2016) [#8]



Blitzplotter(Posted 2016) [#9]
Ultimate Unwrap3D is a good tool for doing it via an IDE.


Dan(Posted 2016) [#10]
bobysait, there is an error in your code:

AddVertex surfBorderGraphics3D 800,600,0,2
SetBuffer BackBuffer()



Bobysait(Posted 2016) [#11]
Weird, part of the code has been copy/paste overriding itself
code updated (I hope).


Dan(Posted 2016) [#12]
Thanks, it is working now :)