[Verse-dev] 3DS loader in Python

Emil Brink emil at obsession.se
Fri Nov 12 13:18:10 CET 2004


On Fri, 12 Nov 2004 13:01:57 +0100
Thorsten Jordan <Thorsten_Jordan at gmx.de> wrote:

[3ds loader in Python]
> what features has the loader, i.e. which parts of a 3ds model can he upload?

Oh, it's rather bare-bones. It loads the 0x4000 (named object) and 0xafff
(matblock) chunks, and inside those the following chunks are handled:

In 0x4000:

0x4110 (parse_3ds_point_array)	- Loaded, uploaded to geometry layer 0.
0x4120 (parse_3ds_face_array)	- Loaded, uploaded to geometry layer 1.
0x4130 (parse_3ds_mesh_mat_group) - Loaded, but if more than one material
				    is defined, the data is largely ignored.
0x4140 (parse_3ds_tex_verts)	- Loaded, uploaded to geometry layers "map_[uv]".
0x4150 (parse_3ds_smooth_group)	- Loaded, but ignored.
0x4160 (parse_3ds_mesh_matrix)	- Loaded, set as object transform.
0x4600 (parse_3ds_direct_light) - Loaded, set as object light (this is really
				a rough representation).


In 0xafff:

0xa000 (parse_3ds_mat_name)	    - Used to name the material node.
0xa010 (parse_3ds_mat_ambient)      - Ignored.
0xa020 (parse_3ds_mat_diffuse)	    - Ignored.
0xa030 (parse_3ds_mat_specular)	    - Ignored.
0xa040 (parse_3ds_mat_shininess)    - Ignored.
0xa041 (parse_3ds_mat_shin2pct)	    - Ignored.
0xa050 (parse_3ds_mat_transparency) - Ignored.
0xa052 (parse_3ds_mat_xpfall)	    - Ignored.
0xa053 (parse_3ds_mat_refblur)	    - Ignored.
0xa084 (parse_3ds_mat_self_ilpct)   - Ignored.
0xa087 (parse_3ds_mat_wire_size)    - Ignored.
0xa100 (parse_3ds_mat_shading)	    - Ignored.
0xa200 (parse_3ds_mat_texmap)	    - Named image is loaded and uploaded

Basically, each object that has a single material, is assumed to be simple
texture-mapped mesh. The material will be created as a material node, and
given the following fragment content:

			output(color)
			     |
			     |
			  blender(*)
			    /\
			   /  \
			light texture
				|
			  	|
			      geometry

Obviously, a lot more complicated material graphs are needed to properly
capture the data available in the 3DS file, but I didn't want to spend too
much time on it, and just getting simple texture-mapped polygons in there
was the most useful to me. Plus, I don't run 3DS at all, and would have no
way of veryifying/understanding what the various parameters (lieke self_ilpct)
mean so it seemed pretty pointless. I guess that makes this into more of
a "hack" than a "proper" 3DS loader, but I never intended to solve the
problem once and for all, either. :)

Regards,

/Emil


More information about the Verse-dev mailing list