ClearSurface

Blitz3D Forums/Blitz3D Programming/ClearSurface

Boiled Sweets(Posted 2003) [#1]
Hi,

ClearSurface removes the tris and vertices from a surface but how do you go about removing the surface altogher?

I'm trying to optimise my world and have cubes made up of 3 surfaces, one for the sides, one for the roof and another for the floor.

I can safely remove the roof and ceiling surfaces on cubes that join each other. I can call ClearSurface on them but it doesn't remove the surface itself so my optimisation isn't as good as it could be, any thoughts?


Shambler(Posted 2003) [#2]
The best optimisation would be to instead of removing faces of a cube don't put them there in the first place.

For each cube look at its neighbours and then decide whether the cube will need a face there because it doesn't have a neighbour and vica versa.

Work with square faces rather than whole cubes.


Ross C(Posted 2003) [#3]
Try updatenormals?


Warren(Posted 2003) [#4]
I'd like to know this as well. When I'm deleting a portion of a mesh, how can I remove the surfaces allocated to it?

Answers like "don't do that" aren't really helping. :P


Ross C(Posted 2003) [#5]
Does,

FreeEntity surf

work? Where surf is the surface name?

[EDIT]

Also, are you using the ClearSurface surf, true, true

??


Boiled Sweets(Posted 2003) [#6]
I have tried ClearSurface surf, true, true.

It clears 5600 surfaces from my world. However it does NOT improve performance. I guess this is because...

i) The number of entities has not changed.

and / or

ii) The surfaces are clear (ie no tris and vertices) but they stil exist.

I can see that creating only the surfaces I need is a good way to go however. I also currently hide all cubes surrounded by cubes. This help a lot as it removes entities...

BUT I would still like to know how else I can increase performance.

I ought to add that I use camera fogging and a EntityDistance (from the camera) to do some basic culling. This also works very well...


Warren(Posted 2003) [#7]
Does,

FreeEntity surf

work? Where surf is the surface name?

No. As far as I remember, it crashes Blitz because the surface isn't an entity.


Pete Rigz(Posted 2003) [#8]
One way of doing it - For all of the surfaces that you want to get rid of, you can apply the same brush to all of them and then use the addmesh command to add the mesh into another empty mesh. This will consolidate all of the surfaces that share the same brush into one surface in the new mesh, u can then free the old one.

It sounds like you want to be using addmesh anyway dweezil if the cubes are all separate entities. This will merge their surfaces together and help performance, unless you need to move them about separately?