Surfaces?

Blitz3D Forums/Blitz3D Programming/Surfaces?

John Blackledge(Posted 2005) [#1]
Sorry, guys, I finally give up. I've got a headache.

I've been follow the discussions e.g. 'maximum number of vertices and surfaces per entity', but I have to admit that every time someone makes a statement regarding surfaces, and surfaces per entity, I'm confused again.

Could someone please write a short tutorial (please, not a one-liner) explaining exactly what you guys mean by polygons, faces, and surfaces (and, single-surface entities)? It's the difference which is confusing me. I understand vertices.

Thanks.


ozak(Posted 2005) [#2]
Well. Usually.

Polygons are a collection of triangles. A face is a triangle (in my book) and surfaces are a collection of triangles (polygons/faces/whatever) that share the same material properties (texture usually).

Short but easy to follow :)


Rhyolite(Posted 2005) [#3]
Vertex = a point in 3D space

Poly/Tri/Face = a triangle in a mesh made from 3 vertices (corner points)

Surface = a collection of polygons or tri's (triangles) joined togther with a single color or texture applied (although you can use vertex colors instead)

Mesh = One or more surfaces joined together

Single Surface Entity = a mesh with only one surface

Hopefully that is correct!
Rhy ;)


Ross C(Posted 2005) [#4]
Red Dots = A Vertex. A Vertex is invisable. Just a point in 3d space used so triangles may be formed :o)
Triangles = A Polygon\Face\Tri

The whole thing there, is a surface. You can pile layers of surfaces together on a mesh, to give multitextured look.




Rhyolite(Posted 2005) [#5]
Let me guess, its an asteroid??!!!


Ricky Smith(Posted 2005) [#6]
Just nitpicking really but :

A polygon is not quite the same as a triangle. A polygon can be made up of a single triangle or 2 or more adjacent triangles usually with the same surface normal i.e like triangles they are 2 dimensional.


Shifty Geezer(Posted 2005) [#7]
Can someone explain Blitz's automatic handling of surfaces? If I load a dozen models and assign them all to the same texture using LoadTexture() and EntityTexture(), does Blitz assign them all to the same surface? I've never used manual surface and brush creation as it's always been automatically handled by Blitz. Is this a terrible faux pas with crippling inefficiency?


Ross C(Posted 2005) [#8]
Well, basically, a mesh = a surface. But, if you use CopyEntity, i believe it references them so they render quickier. So, there only the same surface, if it's all the one mesh :o)

You can use the AddMesh command. I beleive that merges surfaces.


Shifty Geezer(Posted 2005) [#9]
I load the meshes and textures as seperate entities. I use CopyMesh() to populate my scene with meshes, but texture those meshes with different textures. eg.
tex1=LoadTexture()
tex2=LoadTexture()
tex3=LoadTexture()

object1=LoadMesh()
object2=LoadMesh()

for n=0 to 100
   mesh=random(1,3)
   select mesh
      objects(n)=copymesh(whichever mesh)
   tex=random(1,3)
   select tex
      textureentity objects(n),whichever texture)
next
Let's say this produces 30 copies of 'object1' and textures 10 each with each of the textures. Would this result in 3 surfaces, or 30? Should I instead create 3 copies of 'object1' and apply each of the textures, and duplicate those instead to maximise (or rather minimise!) surfaces?


Rhyolite(Posted 2005) [#10]
This would result in 30 surfaces.

You can not combine surfaces from different meshes, so copying 'object1' will still result in 30 surfaces. Using CopyMesh is quicker than reloading the mesh every time, but they still have seperate surfaces.


scribbla(Posted 2005) [#11]
Hi John
umm my understanding of this is

say you have a character and you select all its polygons
and give them a name "all_character" this would be a single surface mesh

lets say you then change your mind and select all the polys in the hands and give them a name "hands"

you now have 1 mesh with 2 surfaces
"all_character" and "hand"

i only found this out when i did a count surfaces on a mesh with vertex colours and texture map on different parts

i think thats right, i know that gave me headache as well ;)


John Blackledge(Posted 2005) [#12]
Thanks to you all, and Hi to you again Tiler.

I think the confusion has come about because some people have been using the terms a little interchangeably.
But you all seem to agree here.

I guess my own confusion comes about when I think of 'single surface particles', which would appear to be single faces belonging to the same surface, such as sparks, apparently being far more efficient than say using sprites. I just have trouble thinking of a lot of single faces being thrown about even though they belong to the same surface (/mesh?).

And this is more efficient for Blitz is it?

So, let's see:
A face is the same as a triangle.
A surface _is_ a mesh, but a mesh could contain more that one surface (as with Tiler's body and hand)?


John Blackledge(Posted 2005) [#13]
Ah... and should I add: as soon as you implement more that one texture on a mesh then you have effectively created more than one surface - each separate texture somehow forces the creation of a new surface, which is to be avoided.

Have I got that right?


scribbla(Posted 2005) [#14]
ummm
if your applying 2 textures to the same set of polys or face groups as i used to call them, then i would think it would still count as 1 surface

i think it only applies if you have different poly groups on your mesh

but im not sure :(

try a count surfaces on your mesh


jfk EO-11110(Posted 2005) [#15]
Yes, basicly this is true. You should not avoid surfaces at all costs. The relation of Surfaces / Triangles should be well balanced. It doesn't make much sense to pack 500'000 Tris into one surface, when 90% of the faces are out of the camreas viewport/range all the time. In the same time it's way to slow to create 10'000 Sprites for some FX, because this will force the creation of 10'000 surfaces and brushes.

Again, here's my definition:

Triangle (Tri): A triangle made of 3 Vertices. Note: Vertices can be used by more than one Triangle (aka shared vertices)
Quad: Made of 2 Tris.
Polygon: usually a Tri or a Quad. (Some tools deal with quads only, so their Polycount must be doubled)
Surface: A group of Triangles that are using the same Brush
Brush: A Material defined by Texture(s), FX etc.

EntityTexture is the quick'n'dirty way, but you should prefere to paint surfaces with brushes (PaintSurface), which is the proper way.


John Blackledge(Posted 2005) [#16]
Oh, bo**ocks - and then there's more.

Brushes. I've played with brushes, even though I wasn't sure what I was doing, I got them to work.

But what makes you say EntityTexture is quick and dirty, and what makes Brushes 'the proper way'?
(I'm asking you to hold my hand here, aren't I?)


Rhyolite(Posted 2005) [#17]
..because EntityTexture applies the texture to the whole entity without any 'control'. Using brushes allows finer control and you can also reuse brushes.

But I think you have got your head around surfaces correctly (at least how I understand them anyway!).

Rhy :)


jfk EO-11110(Posted 2005) [#18]
As Rhy said: a brush has a lot more options than a simple texture: Multitexturing, FX etc. Additionaly you need to use brushes if you want to use Mesh-commands at some point, eg. AddMesh. You cannot AddMesh Meshes that are textured with EntityTexture, but Brushes are merged correctly. With Brushes you are also capable of tracking down the used textures.

I think it's most important when you want to save the Mesh at some point.


John Blackledge(Posted 2005) [#19]
Yeah, got that last bit, thanks Rhyolite.

Now, rather than bother you guys any more, is there a tutorial, a book?

Or did you just pick it up as you went along?


Rhyolite(Posted 2005) [#20]
Hmmm, I am not sure if their is an 'easy' way to learn texturing/blitz or 3D in general. There are a couple of books for Blitz3D, one has recently been listed on the Blitz main page - but here is the link anyway! Only sounds like 2D to me though?

http://www.gamedev.net/columns/books/bookdetails.asp?productid=548

I guess I just picked it up as I went along. You have to being 'trying' stuff to really learn anything I reckon. I did lots of searches on this webby and others when I found yet something else I did not know. I looked at the sample code that comes with blitz etc etc.. and I am still learning!

Early on I think you just have to accept you will often do stuff 'the wrong way' and then find a better way later. At least, that is my experience.

Hope that helps,
Rhy :)


jfk EO-11110(Posted 2005) [#21]
I just picked it up, after painfully experience each and every trap. I agree, a good book with all the extra special tricks that are real FAQ here is needed.

Many tricks and workarounds can be found in the code archives, but a lot of important questions are simply answered in the Forum again and again.

Collecting FAQs should be simplified. Mods should be able to copy a thread to the FAQ by a simple click.