Expanding a Mesh?
BlitzMax Forums/MiniB3D Module/Expanding a Mesh?
| ||
I'm trying to expand a Mesh with a function i found, but the result is totally weird! Instead of actually making the mesh bigger it seems to stretch it really odd... Here's the code i'm using: Import sidesign.minib3d Graphics3D 640,480,32 Local Cam:TCamera=createCamera() PositionEntity Cam,0,0,-10 Local ent:TMesh = createCube() updateNormals ent MeshExpand(ent,3) While Not KeyDown(KEY_ESCAPE) UpdateWorld RenderWorld Flip Wend Function MeshExpand(MESH:TMesh,am#) For k=1 To countSurfaces(MESH) surf=getSurface(MESH,k) For Index=0 To CountVertices(surf)-1 newx#=VertexX(surf,Index)+VertexNX(surf,Index)*am newy#=VertexY(surf,Index)+VertexNY(surf,Index)*am newz#=VertexZ(surf,Index)+VertexNZ(surf,Index)*am VertexCoords surf,Index,newx,newy,newz Next Next End Function (I can't use ScaleMesh since it doesn't work the same way) |
| ||
well the normal does not point from the mesh center outward. so it will not expand it most likely like you wanted it to happen. |
| ||
So what do you recommend i do? Got any example or could you help me out with my code? |
| ||
well, that depends on what you want to do. there is no "general solution" that will work for any geometry. thats why extrusion in 3D modelling applications has several distinct ways to do like normal etc |
| ||
I'm going to use it like a shell. Basically take a human model, copy the mesh and expand the copied mesh for like a shell around the player. |
| ||
sounds more like a job for scaleentity. |
| ||
ScaleEntity would only work for simple models like balls and cubes, having a model of a human or a car or something would really mess it up. Here's an example of how ScaleEntity would do it: ![]() |
| ||
well your expand code will cause the same issue. there is no way to expand anything and if it is bone animated forget it anyway! any mesh command is tabu on bone animated meshes or the bone animation will totally break it. |
| ||
There has to be a way to simply expand the mesh rather than scaling it, what about all those FatBoy codes on the PS1 that were so popular? :P It expanded the models making all characters really fat ingame. And i'm not planning on using it for animated models, only reason i used the Imp model was cause it's the only thing i had avalible. |
| ||
well one possibility is to expand it from given virtual axis and the like. to use your imp as example: you would extend the leg vertices from the "leg bone" as center and the like to make it "fat" around that given symmetry axis which seems like what you want to achieve. |
| ||
It's easiest to do this in a modelling package. Just extrude the surface. |
| ||
Well I solved it by using Klepto's version and shaders. Thanks for the help anyways! |
| ||
Sorry for dragging up an old thread, but surely simply moving each vertex along it's normal would give you that? There is a good few examples to create an outline mesh in blitz3d, which is basically what your wanting. |
| ||
I tried the Blitz3D examples but they all gave me REALLY weird results. I'm sure it would work, but I'm new to 3D (and BlitzMax actually) :P |