Surfaces?

Blitz3D Forums/Blitz3D Programming/Surfaces?

_PJ_(Posted 2004) [#1]
Can someone tell me in simple 'English for Eejits' what Surfaces really are. I understand, they 'hold' the texture, but when people go on about multiple meshes or triangles with a single surface, and bring Brushes and U's and V's into everything, I get ever so lost.

Please note:

a) I do not, and am unlikely to in the near future, own any 3D Modelling software.

b) I'm thick as two short ones

c) Spell it slowly!


aab(Posted 2004) [#2]
[unreliable info]
well, i'm a 3d noob, but as far as i can tell , a surface is like a series of tris that are on the 'same plane' with each other ie: they face the same direction

if you exported a model eg: as a 3ds, and it was a cube, each four-sided poly(=face of the cube) would be cut into two tris:
so then each set of two tris is a surface, and so there are six surfaces.
[/unreliable info]


Stevie G(Posted 2004) [#3]
A surface can be any group of polygons which share the same brush properties (i.e. same texture , blend, alpha etc.. ) - they do not have to face the same direction !?


Gabriel(Posted 2004) [#4]
You can't really have multiple meshes with a single surface, it's a trick. Each mesh entity has a minimum of one surface. Now what you can do is create one mesh entity which contains the vertex and triangle data for more than one object. Eg: ten little missiles could all be built as one model with the same texture, and therefore could all be made from one surface.

Now when it comes to moving these missiles independently, you can't use the entity commands any more, because the entity is all ten missiles now. So you have to use the vertex manipulation commands to move the parts which belong to each missile independently. You need a basic grasp of position, rotation and scaling around arbitrary points in 3d space, but it's not too complex. ( If my pathetic grasp of 3d maths can cope with it, it can't be too bad. )

Forget about brushes and UV's in relation to surfaces, as there is no real relation, except that you can only have one brush per surface as you can only have one texture.

Brushes are simply materials. A collection of properties which sets how the object looks. Color, texture, shininess, alpha.. all that stuff combined is a brush. In fact, you often need not use brushes if you don't want to, but it makes things neater.

UV's are the x and y coordinates of the texture. It defines how a texture is mapped onto an object. Each vertex has a u and v coordinate ( x and y on the texture ) Connect the three vertices which make up a triangle on top of your texture and you'll see which part of the texture will appear on that triangle when you apply the texture.


_PJ_(Posted 2004) [#5]
So how does one assign differing polygons to belong to a particular surface - or rather, define a surface to encompass specific polygons.

Is it possible to select different polygons from different meshes. I have heard that low surface counts really do increase speed.


Gabriel(Posted 2004) [#6]
You add polygons to a surface with AddVertex() and AddTriangle()

Yes, it's possible to go through an existing mesh and add it manually to a new surface, then add another and another. For that you'd need to go through all the surfaces of the existing mesh with CountSurfaces() and GetSurface() then go through the triangles with CountTriangles() and use TriangleVertex() to grab the vertices which make up the triangles. You can then get the vertexpositions with VertexX() VertexY() and VertexZ()

It's not as complicated as it sounds, and if you check out SSwift's AddMeshToSurface() function in the code archives, it's a good example to show how to do this.

http://www.blitzbasic.com/codearcs/codearcs.php?code=575


_PJ_(Posted 2004) [#7]

Now when it comes to moving these missiles independently, you can't use the entity commands any more, because the entity is all ten missiles now. So you have to use the vertex manipulation commands to move the parts which belong to each missile independently. You need a basic grasp of position, rotation and scaling around arbitrary points in 3d space, but it's not too complex. ( If my pathetic grasp of 3d maths can cope with it, it can't be too bad. )


I gotcha - so you kind of alter the mesh geometry rather than actually move it to give the impression the missiles move. I see. I think Ill leave that well alone for now!




You add polygons to a surface with AddVertex() and AddTriangle()

Yes, it's possible to go through an existing mesh and add it manually to a new surface, then add another and another. For that you'd need to go through all the surfaces of the existing mesh with CountSurfaces() and GetSurface() then go through the triangles with CountTriangles() and use TriangleVertex() to grab the vertices which make up the triangles. You can then get the vertexpositions with VertexX() VertexY() and VertexZ()

It's not as complicated as it sounds, and if you check out SSwift's AddMeshToSurface() function in the code archives, it's a good example to show how to do this.

www.blitzbasic.com/codearcs/codearcs.php?code=575



Thanks a million, Sybixsus. (wow! I spelt your nick right for once!)

What I intend to do, is learn how to build a mesh then texture it with multiple textures eventually. If I can learn this in the code it will really give me a better understanding. Thanks loads!