Hiding/ Showing polys at run time?

Blitz3D Forums/Blitz3D Beginners Area/Hiding/ Showing polys at run time?

YellBellzDotCom(Posted 2007) [#1]
I apologize, I didnt have time to do an actual search yet, Ill hit it tomorrow, but I was just wondering if anyone knows a function to show or hide certain polys of an animated mesh at run time? I sure appreciate any help here. If I find anything in my search tomorrow, I will post it here.

Thanks.


b32(Posted 2007) [#2]
I'm not sure, but depending on what you want, maybe the best method might be creating several meshes and showing them using ShowEntity/HideEntity. Else, you could try using vertexcolors:



Matty(Posted 2007) [#3]
I guess one way might be the following:

If the polys for the mesh that you wish to be hidden belong entirely to 1 surface then you could paint that particular surface with a texture that uses transparency - it would only need to be a 2x2 texture - black with alpha=0 easily set at runtime by creating a texture of that size and setting the alpha of the 4 pixels in the texture appropriately.


YellBellzDotCom(Posted 2007) [#4]
hmmm, so if I were to use vertex colors on the polys I wished to hide, could I set them to black? and use flags to make them transparent? Ill dig into this one more.

The texture route may be the way to go, of course I'll have to play around with that too.

Thanks for the help there, I'll still do a search and see what else I come up with.

Thank you.


YellBellzDotCom(Posted 2007) [#5]
Wow, B32, that was exactly what I needed!! Thank you very much! Ohhh this is too beautiful!

Thank you. I'll have a little note in my code for your credit there. That is awesome!

I do appreciate the help there also Matty, If things go south, I'll be revisiting your idea, thank you.


YellBellzDotCom(Posted 2007) [#6]
Dang, it seems backface culling is going on with the model when I use EntityFx 2+32. I can see through polys even when I dont hide em.

Polys are transparent when I use EntityFX 2+32. I dont think this is supposed to happen. Is it a bug? hmmmm


YellBellzDotCom(Posted 2007) [#7]
Ok, Matty, If Im using an animated model with a texture already assigned to it, how would you implement that idea?

Thanks again for any help


YellBellzDotCom(Posted 2007) [#8]
Ok, Ive tried loading my mesh as an x file thinking the entityfx was a bug with the b3d file format. It looked good until I enabled
surf = GetSurface(Char1, 1)
this causes a mav, lol.


...um as with a 3ds file, jeeeez!


b32(Posted 2007) [#9]
I see .. the error could occur, because GetSurface() should be in the range 1..CountSurfaces().
If your model contains a hierarcy, you'll need to search through the structure to find meshes that contain surfaces. If that is the problem, look at the printoutchildren() function below.
As for the Z-order problem, I'm not sure what to do about it. You could however, solve it in a different way. You can't delete specific triangles on a surface, however, you can clear all triangles using clearsurface. If you kept a copy of it, you can rebuild it, leaving out the triangles you don't want:



jfk EO-11110(Posted 2007) [#10]
I wonder: if you use a transparent triangle, hidden using VertexAlpha, will it still be alpha-z-sorted (or rather unsorted) like semitransparent alpha stuff?

Personally I think it's best to stay away from alpha whenever possible. You'll be happy when there is not already a lot of alpha when you start to add things like windows, plants, particles etc. (Talking about FPS level design)

ps

We should know what you use this for. I assume you want to do some kind of BSP-VIS Occlusion do you? Hiding parts that cannot be seen by the camera anyway, so it may render faster.

There is a command named addtriangle, but unfort. there's no RemoveTriangle. So what you have to do is rebuild the mesh, using a hidden reference mesh, but only clone the triangles that you want to be rendered.

This isn't very fast, that's why such VIS systems tend to be not very effective. Sometimes the overhead of rebuilding things makes the whole thing even slower than the original, unhidden rendering.

In most cases it's much more effective to split the mesh in pieces, eg. 10*10 pieces. The surface count may be increased this way, but it allows the camera to render only the pieces that are within the camera range and Field of View (FOV).

See also the ClusterizeMesh example in the archives.


YellBellzDotCom(Posted 2007) [#11]
I appreciate the help there JFK. I was looking to hide polys of a char model when I equipped a certain item. It would've made the vertex manipulation a lot easier hehehehe. I thought my programs were bugged and spent a week trying to find the problem but it just amounted to tweaking my model vertices and envelopes to compensate.

I really appreciate everyones help here, thank you.