Primitives and Surfaces

Blitz3D Forums/Blitz3D Programming/Primitives and Surfaces

_PJ_(Posted 2005) [#1]
Is it possible to construct a level as read from a file, but building it up from primitives, however, and this is the tricky bit, textures are required. Although the majority of these primitives will have identical textures, I am just worried that this will result in too many 'surfaces' plus the huge amount of meshes (I estimate about 2000 per level) may cause some real slowdown, especially when collision detection comes into play etc.)


Sunteam Software(Posted 2005) [#2]
You really do need to control the surfaces in your meshes as the more surfaces you have the more impact on the graphics pipeline thus affecting speed. The most important factor is your target platform and what you expect people to have to run your software comfortably, once you decide that then you can start to work out what limits this places on your 3D world in terms of surfaces.

However yes it is entirely possible to create worlds from primitives, in fact you can also build meshes to suit as Blitz has commands to build these from the vertex up (i.e. vertex to triangle to surface).


Rob Farley(Posted 2005) [#3]
If you use addmesh the surfaces combine.


_PJ_(Posted 2005) [#4]
Sunteam - yeah I know that surface count can drastically hit the speed, that's why I wanted to avoid using so many!
My game is quite basic, straightforward and simple, lacking in anything really fancy so I would like it to be as compatible as possible.


If you use addmesh the surfaces combine.

Great! Thanks, Rob - I've never paid much attention to that command before, glad you pointed me towards it!


Dazman(Posted 2005) [#5]
Addmesh is a very useful command, as is addmeshtosurface in the code archives (which is supposed to be better although i have found no increase in speed over Addmesh myself).

***Hijacking thread***
Does anyone know of a way to literally add 2 meshes together and get rid of the redundant surfaces (in code), eg. if i create 2 cylinders and position them end to end and use Addmesh the internal ends of the cylinders are still there and i can sometimes still see the seams? (just an example - no need to suggest using ScaleEntity!)
I think i am asking too much!


Ross C(Posted 2005) [#6]
I find addmesh mucks up the textures.. :S


DJWoodgate(Posted 2005) [#7]
Ross, Mucks up the textures how?

Dazman, that would be difficult to do automatically after you have combined them into one mesh, unless the verts of redundant triangle are coincident, and they probably won't be. (well in fact they might be for cylinders). In any event it is easier by far to ditch one of the caps before combining.


Dazman(Posted 2005) [#8]
I thought it would be too difficult :(

Ditching the end caps sounds like it might help though.
If i've use CreateCylinder() how do i go about getting rid of them?


DJWoodgate(Posted 2005) [#9]
Well I have just tried SSwifts routine on the archives and it seems to work ok with cylinders, so you might like to give that a go.

http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=526

If that does not work for you I will knock up something to remove caps, it's not that easy to explain.


Dazman(Posted 2005) [#10]
Thanks DJ

SSwifts routine certainly works but i don't understand what it does that is better than Addmesh, whichever i use i tend to be able to see the joins when the resulting mesh is rotated at certain angles or at certain distances from the camera.
I think maybe i just need to change the way i'm lighting and/or texturing them.

I appreciate the offer though.


DJWoodgate(Posted 2005) [#11]
Yes, you probably will still be able to see the seams though removing the redundant tris should make it less obvious. something else to try is welding them - http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=874
but of course that will only work if they have the same texture and so on.

Also run updatenormals on the merged mesh, this will smoth the normals over the joins, again making them less obvious.


Dazman(Posted 2005) [#12]
I missed that one! I'll try it after work. Thanks again DJ.