Making *.B3D Meshes

Blitz3D Forums/Blitz3D Beginners Area/Making *.B3D Meshes

Captain Wicker (crazy hillbilly)(Posted 2011) [#1]
Hi,

I was just curious about actually being able to code a mesh in bb3d. I have the official bb3d programmer's manual but can't find anything in there on making a model in blitz3d. Can someone please tell me how I can make a mesh in bb3d if at all possible.

Thank You,
Austin H.


Hotshot2005(Posted 2011) [#2]
I found the Blitz 3D Help files on how to make Mesh and it called CreateMesh

; CreateMesh Example
; ------------------

; In this example, we will create a custom mesh. This custom mesh will be in the shape of a ramp.

Graphics3D 640,480
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,45,0,0

; Create blank mesh
ramp=CreateMesh()

; Create blank surface which is attached to mesh (surfaces must always be attached to a mesh)
surf=CreateSurface(ramp)

; Now we have our blank mesh and surface, we can start adding vertices to it, to form the shape of our
; ramp.
; Vertices are invisible 'points' in a 3D object that we can attach triangles too later.
; To create a single triangle, you need three vertices, one for each corner.
; However, you can share vertices between triangles, so you do not always need 3 new vertices per
; triangle.
; In the case of our ramp mesh, we will require 6 vertices, one for each corner

v0=AddVertex(surf,0,0,0) ; bottom corner 1
v1=AddVertex(surf,0,0,1) ; bottom corner 2
v2=AddVertex(surf,4,0,1) ; bottom corner 3
v3=AddVertex(surf,4,0,0) ; bottom corner 4
v4=AddVertex(surf,0,2,0) ; top corner 1
v5=AddVertex(surf,0,2,1) ; top corner 2 

; Having created our blank mesh and surface, and added our vertices to form the shape of the mesh, we
; now need to add triangles to it in order to make it solid and visible to the user. We create
; triangles simply by connecting vertices up, very much like a 3D dot-to-dot.

; When adding triangles, we need to remember that they are only one sided, and the side they are
; visible from is determined by the order in which we specify the vertices when using AddTriangle.
; If the vertices, in the order that they are specified, are aligned in a clockwise fashion relative 
; to the camera then they will appear visible, otherwise they won't. 
; So, to make our ramp visible from the outside, we will be connecting all vertices in a clockwise
; fashion, relative to the camera.

t0=AddTriangle(surf,v0,v3,v2) ; bottom triangle 1
t1=AddTriangle(surf,v0,v2,v1) ; bottom triangle 2
t2=AddTriangle(surf,v0,v4,v3) ; front triangle
t3=AddTriangle(surf,v1,v2,v5) ; back triangle
t4=AddTriangle(surf,v0,v1,v5) ; side triangle 1
t5=AddTriangle(surf,v0,v5,v4) ; side triangle 2
t6=AddTriangle(surf,v2,v4,v5) ; top triangle 1
t7=AddTriangle(surf,v2,v3,v4) ; top triangle 2

; Now we will position our ramp in front of the camera so we can see it!
PositionEntity ramp,0,-4,10

; Enable wireframe mode so we can see structure of model more clearly
WireFrame True

; And a quick loop that renders the scene and displays the contents on the screen until we press esc
While Not KeyDown(1)

; Constantly turn our ramp entity to show it off a bit
TurnEntity ramp,0,1,0

RenderWorld
Flip

Wend

; The end! 
End


and

if You make own 3D Models then You could try 3D Milkshape or Wings 3D or AC3D

For building own 3D World...you could try 3D WORLD STUDIO :)

GOOD Luck :)

Last edited 2011


Captain Wicker (crazy hillbilly)(Posted 2011) [#3]
Thanks


Yasha(Posted 2011) [#4]
The example there pretty much covers it for creating meshes programmatically. Things to note are that there is no "SaveMesh" function (you have to either work out how to save in a standard format, or roll your own file type), and no built in function for attaching vertices to bones (it can be hacked around, but is a bit messy).

The .b3d file format is a specific file format for saving meshes that closely matches the way meshes are represented in Blitz3D's engine at runtime. It's the only officially supported file format that can save everything the Blitz3D engine also offers (proper vertex normals, bone-based animation, etc.). If you want to get into making mesh files, I can recommend three nice freeware programs:

-- Wings3D: a simple subdivision modeller. This is good for quickly making low-poly static meshes. It doesn't support animation of any kind though, and doesn't export to .b3d.

-- PaceMaker, for bone- and physics-based animation. This is a really simple animation tool that lets you just drag a ragdoll's limbs into place, and also lets you record physical simulations (e.g. collapsing on the floor upon being shot) if you don't have a physics engine in your game, or it can export physics properties for the engine if you do! It can also import .3ds and export .b3d so it's good for converting your characters into .b3d format. You need to turn off the option to export physics properties if you use this with miniB3D.

-- gile[s], a lightmapper. Excellent for baking beautiful lightmaps into your levels, and again, can convert .3ds files (which are a bit rubbish) to .b3d.


andy_mc(Posted 2011) [#5]
another good one is: deled: http://www.delgine.com/
there's a plugin for b3d import and export.


Captain Wicker (crazy hillbilly)(Posted 2011) [#6]
Anyone here know how to animate a mesh from 3d canvas with fragmotion?


jfk EO-11110(Posted 2012) [#7]
You may want to use CHaracterFX or Pacemaker to add a skeleton to some mesh geometry. THis may also be possible in Fragmo directly, but it's amount of features is a bit of an overkill, so maybe it's easier to add the bones somewhere else.