Videoscape file specs
Videoscape file format was originally used by Amiga package 'Videoscape 3D'. It is now used by Blender for importing/exporting meshes in text format. All compatibility is tested with Blender. In fact, all info in this doc is taken from Blender manual. Thanks, Ton.
Videoscape files are saved with .obj extension. Each file can contain one object. If multiple objects are to be saved, multiple files have to be created. Each object receives number and this number is added to extension. Eg. when we want to save 13 objects we will receive files: my_name.obj, my_name.obj2, ..., my_name.obj13
Blank lines may be added to make file more readable but no comments is allowable.
Files may be in four major flavors:
- Mesh with coloured faces
- Mesh with coloured vertices
- Lamp
- Gouraud curves or NURBS surfaces
Each flavor is identified by magic number (first line in file). They are:
1. Mesh with coloured faces
3DG1 - magic number
total_number_of_vertices - total number of vertices
x1 y1 z1
x2 y2 z2
... - vertex coordinates
number_of_vertices_in_face vertex_index_1 vertex_index_2 vertex_index_3 ... vertex_index_n color
Vertex index is counted starting from 0. Color is written in BGR format (reverse order to RGB). Eg. red color in BGR is 0x0000FF.
Example file (simple gray plane) and screenshot:
3DG1
4
1.000000 1.000000 0.000000
1.000000 -1.000000 0.000000
-1.000000 -1.000000 0.000000
-1.000000 1.000000 0.000000
4 0 3 2 1 0xcccccc
2. Mesh with coloured vertices
Warning! This file flavor doesn't seem to be recognized or saved by Blender and is here for completeness only.
GOUR - magic number
total_number_of_vertices - total number of vertices
x1 y1 z1 color
x2 y2 z2 color
... - vertex coordinates with color in BGR format
number_of_vertices_in_face vertex_index_1 vertex_index_2 vertex_index_3 ... vertex_index_n
Example file:
GOUR
4
1.000000 1.000000 0.000000 0x0000ff
1.000000 -1.000000 0.000000 0x00ff00
-1.000000 -1.000000 0.000000 0xff0000
-1.000000 1.000000 0.000000 0x00ffff
4 0 3 2 1
3. Lamp
3DG2 - magic number
total_number_of_lamps - total number of lamps in file
for each lamp:
type - lamp type (0 - point lamp, 1 - spot lamp, 2 - sun)
spotsize spotblend - size of spot beam in degrees and intensity (length) of beam
R G B E - color (RGB) and (E)nergy of lamp
x y z - lamp coordinates
vecx vecy vecz - lamp direction vector
Example file (two lamps - one normal and one spot) and screenshot:
3DG2
2
0
0.0 0.0
1.0 1.0 1.0 1.0
-4.0 4.0 2.0
0.0 0.0 0.0
1
45.0 0.5
0.5 1.0 1.0 1.0
2.0 3.0 4.0
0.4 0.3 0.6
3. Gouraud curves or NURBS surfaces
This kind of file can describe both curves and surfaces.
3DG3 - magic number
type - object type (5 is surface, other is bezier curve)
number_of_items - number of curves or surfaces
ext1 ext2 - extrude numbers also indicated for surfaces. These are NOT floats, they're integers divided by 500.
Matrix [4][4] - right-handed object matrix. Used to determine position, rotation and size
for each item:
type - type (0 - poly, 1 - bezier, 4 - nurbs. Add 8 to this if curve is 2D.)
pntsu pntsv - numbers of vertices in u and v directions
resolu resolv - resulotion of u and v direction
orderu orderv - order in the u and v direction
flagu flagv - the 'cyclic' flag in u and v direction. If equal to 1 it is cyclic.
for bezier repeat this block pntsu times:
x y z
x y z
x y z - three handle vertices
h1 h2 - handle types (0 - free, 1 - auto, 2 - vector, 3 - aligned)
for other curve type or for surface repeat this block pntsu*pntsv times:
x y z w - coordinates and weight of vertices
for other curve types add this block:
u1 u2 u3... - knots in u direction
for surfaces add this block:
v1 v2 v3... - knots in v direction
The number of knots is a very precise value. If the value is not correct, file will not be properly loaded. This is the calculation for the total:
order + pnts + (order-1)*(flag&1)
If necessary, a series of increasing numbers can be filled in here.
Example bezier curve:
3DG3
0
1
0 0
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
9
2 0
32 0
0 0
0 0
-3.0 -1.0 0.0
-2.0 0.0 0.0
-1.0 1.0 0.0
3 3
1.0 1.0 0.0
2.0 0.0 0.0
3.0 -1.0 0.0
3 3
Example of NURBS surface:
3DG3
5
1
0 0
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
4
4 2
32 32
4 2
0 0
-2.0 0.0 0.0 1.0
-1.0 1.0 0.0 1.0
2.0 0.0 0.0 1.0
3.0 -1.0 0.0 1.0
-2.0 0.0 1.0 1.0
-1.0 1.0 1.0 1.0
2.0 0.0 1.0 1.0
3.0 -1.0 1.0 1.0
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
1.0 2.0 3.0 4.0
Written by Max Gilead (gilead@linart.krakow.pl). Based on Blender manual (http://www.blender.nl). Thanks to Ton Roosendaal who wrote the paper docs.