⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3dsinfo.txt

📁 这是书上的代码
💻 TXT
📖 第 1 页 / 共 3 页
字号:
              3D Studio File Format Information (3dsinfo.txt)
              -----------------------------------------------
                                    by
                              Jochen Wilhelmy
                                  a.k.a.
                                 digisnap
                         digisnap@cs.tu-berlin.de
                                06.08.1997


Introduction
============
The information contained in this file is only collected by me. The credits
go to the following people (in alphabetical order):

    Christophe Chabanois (Wolverine / Apocalypse)
    Jim Pitts
    Niklas Beisert (Pascal / 4711)

I think some more people did a good job in discovering unknown chunks, but
I don't know them all. The layout is based on 3dsffo10.txt from Christophe
Chabanois. I did not include any source code from this info, because it was
of no use to me. I used only the standard character set for compatibility
with other operating systems.

My own extensions and corrections are:
 - Corrected the hierarchy levels of some chunks, especially the material
   editor chunk and the spotlight sub-chunks are at the wrong place in
   some docs
 - Documented some spotlight and material sub-chunks
 - Documented most tracks
 - Made a consistent layout for all chunk descriptions

My reader is written in object oriented C++ and can read the chunks only if
they are in the right hierarchy position. It keeps the structure of the 3DS
file in memory and does not jam all vertices into one big array. It also
can write this structure back to a 3DS file. This gave me the possibility
to convert the data of my world-editor into a 3DS file to see where to
place the animated objects. If you want to convert a mesh object into a 3DS
file, you just need this chunk structure:

0x4D4D            Main chunk
  0x3D3D          3D editor chunk
    0x4000        Object block (with name of your object)
     0x4100       Triangular mesh
       0x4110     Your vertices
       0x4120     Your faces

The internal reader of 3DS sets all other things to their defaults. The
"auto edge" function is good if you dont't want to set the face flags.



Index
=====

1. Fast reference : The chunk tree
----------------------------------
This will help you to find rapidly a chunk number and its description.

2. A chunk - What's that ?
--------------------------
This will explain what a chunk is and help programmers understand the
general concept of the 3DS file format.

3. Data types
-------------
This short section will describe all data types used.

4. Chunks description
---------------------
This is the most important part of the document. It describes the chunks.




1. Fast reference : The chunk tree
==================================


Color chunks
------------
  0x0010 : Rgb (float)
  0x0011 : Rgb (byte)
  0x0012 : Rgb (byte) gamma corrected
  0x0013 : Rgb (float) gamma corrected

Percent chunks
--------------
  0x0030 : percent (int)
  0x0031 : percent (float)

0x4D4D : Main chunk
-------------------
  0x0002 : 3DS-Version

  0x3D3D : 3D editor chunk
  ------------------------
    0x0100 : One unit
    0x1100 : Background bitmap
    0x1101 : Use background bitmap
    0x1200 : Background color
    0x1201 : Use background color
    0x1300 : Gradient colors
    0x1301 : Use gradient
    0x1400 : Shadow map bias
    0x1420 : Shadow map size
    0x1450 : Shadow map sample range
    0x1460 : Raytrace bias
    0x1470 : Raytrace on
    0x2100 : Ambient color

    0x2200 : Fog
      0x2210 : fog background
    0x2201 : Use fog
    0x2210 : Fog background

    0x2300 : Distance queue
      0x2310 : Dim background
    0x2301 : Use distance queue
    0x2302 : Layered fog options
    0x2303 : Use layered fog

    0x3D3E : Mesh version

    0x4000 : Object block
    ---------------------
      0x4010 : Object hidden
      0x4012 : Object doesn't cast
      0x4013 : Matte object
      0x4015 : External process on
      0x4017 : Object doesn't receive shadows

      0x4100 : Triangular mesh
        0x4110 : Vertices list
        0x4120 : Faces description
          0x4130 : Faces material list
        0x4140 : Mapping coordinates list
          0x4150 : Smoothing group list
        0x4160 : Local coordinate system
        0x4165 : Object color in editor

        0x4181 : External process name
        0x4182 : External process parameters

      0x4600 : Light
        0x4610 : Spotlight
          0x4627 : Spot raytrace
          0x4630 : Light shadowed
          0x4641 : Spot shadow map
          0x4650 : Spot show cone
          0x4651 : Spot is rectangular
          0x4652 : Spot overshoot
          0x4653 : Spot map
          0x4656 : Spot roll
          0x4658 : Spot ray trace bias

        0x4620 : Light off
        0x4625 : Attenuation on
        0x4659 : Range start
        0x465A : Range end
        0x465B : Multiplier

      0x4700 : Camera

    0x7001 : Window settings
      0x7011 : Window description #2 ...
      0x7012 : Window description #1 ...
      0x7020 : Mesh windows ...


    0xAFFF : Material block
    -----------------------
      0xA000 : Material name

      0xA010 : Ambient color
      0xA020 : Diffuse color
      0xA030 : Specular color

      0xA040 : Shininess percent
      0xA041 : Shininess strength percent

      0xA050 : Transparency percent
      0xA052 : Transparency falloff percent
      0xA053 : Reflection blur percent

      0xA081 : 2 sided
      0xA083 : Add trans
      0xA084 : Self illum
      0xA085 : Wire frame on
      0xA087 : Wire thickness
      0xA088 : Face map
      0xA08A : In tranc
      0xA08C : Soften
      0xA08E : Wire in units

      0xA100 : Render type

      0xA240 : Transparency falloff percent present
      0xA250 : Reflection blur percent present
      0xA252 : Bump map present (true percent)

      0xA200 : Texture map 1
      0xA33A : Texture map 2
      0xA210 : Opacity map
      0xA230 : Bump map
      0xA33C : Shininess map
      0xA204 : Specular map
      0xA33D : Self illum. map
      0xA220 : Reflection map
      0xA33E : Mask for texture map 1
      0xA340 : Mask for texture map 2
      0xA342 : Mask for opacity map
      0xA344 : Mask for bump map
      0xA346 : Mask for shininess map
      0xA348 : Mask for specular map
      0xA34A : Mask for self illum. map
      0xA34C : Mask for reflection map

      Sub-chunks for all maps:
        0xA300 : Mapping filename
        0xA351 : Mapping parameters
        0xA353 : Blur percent
        0xA354 : V scale
        0xA356 : U scale
        0xA358 : U offset
        0xA35A : V offset
        0xA35C : Rotation angle
        0xA360 : RGB Luma/Alpha tint 1
        0xA362 : RGB Luma/Alpha tint 2
        0xA364 : RGB tint R
        0xA366 : RGB tint G
        0xA368 : RGB tint B


  0xB000 : Keyframer chunk
  ------------------------
    0xB001 : Ambient light information block
    0xB002 : Mesh information block
    0xB003 : Camera information block
    0xB004 : Camera target information block
    0xB005 : Omni light information block
    0xB006 : Spot light target information block
    0xB007 : Spot light information block
    0xB008 : Frames (Start and End)
      0xB010 : Object name, parameters and hierarchy father
      0xB013 : Object pivot point
      0xB015 : Object morph angle
      0xB020 : Position track
      0xB021 : Rotation track
      0xB022 : Scale track
      0xB023 : FOV track
      0xB024 : Roll track
      0xB025 : Color track
      0xB026 : Morph track
      0xB027 : Hotspot track
      0xB028 : Falloff track
      0xB029 : Hide track
      0xB030 : Hierarchy position


2. A chunk - What's that ?
==========================

1 - What is a chunk ?
--------------------

The 3D studio file format is compounded of several "chunks". What is a
"chunk" ? Well, that's quite simple.

Each chunk contains information : for example, it can contain colors,
images ... All tools which use the "chunk" method make file formats like
this:

  1st chunk
  2nd chunk
  3rd chunk
  ...
  nth chunk


2 - What is a "sub-chunk" ?
---------------------------

But, there are several problems with this format :
 - The data are all at same level (an image is as important as the name of
   an object ...)
 - A general concept can't group several things.

This is why there are "sub-chunks".

In fact, each chunk can contain several sub-chunks :

  1st chunk
    1st sub-chunk
    2nd sub-chunk
  2nd chunk
  3rd chunk
    1st sub-chunk
      1st sub-sub-chunk
  ...
  Nth chunk


3 - How to read chunks ?
------------------------

This is the representation of a chunk :

Offset   Length    Name

0        2         Chunk-ID
2        4         Chunk-length = 6+n+m
6        n         Data
6+n      m         Sub-chunks

So don't forget to read or skip the sub-chunks if the header and data size
is less than the chunk-length (6+n < chunk-length).


3. Data types
=============

Name        Description

word        2 byte
dword       4 byte
float       4 byte floating point number
strz        zero terminated string (C-string)
vector      3 floats (X,Y,Z)
BOOLEAN     a BOOLEAN chunk acts as a flag and contains no data or sub-chunks

degree      angle from 0 to 360 degree
rad         angle from 0 to 2*pi

Note: If X and Y are the horizontal plane and Z is the height in your
world, you don't have to exchange Y and Z. Some other infos say that you
have to exchange Y and Z only in the keyframer chunk, but you have to treat
all vectors the same way.


4. Chunks description
=====================

-----------------------------------------------------------------------------

                               Color chunks
                               ------------

These chunks are used several times in the format, they are "global
chunks".

-----------------------------------------------------------------------------
Chunk #    : 0x0010
Name       : Rgb color (float format)
Level      : global chunk
Size       : 12
Format     :

  float    red
  float    green
  float    blue

This chunk contains 3 floats : the red, green and blue components of a
color. The values range from 0.0 to 1.0 (full intensity).

-----------------------------------------------------------------------------
Chunk #    : 0x0011
Name       : Rgb color (byte format)
Level      : global chunk
Size       : 3
Format     :

  byte     red
  byte     green
  byte     blue

This chunk contains 3 bytes : the red, green and blue components of a
color. The values range from 0 to 255 (full intensity).

-----------------------------------------------------------------------------
Chunk #    : 0x0012
Name       : Rgb color gamma corrected (byte format)
Level      : global chunk
Size       : 3
Format     :

  byte     red
  byte     green
  byte     blue

This chunk contains 3 bytes : the red, green and blue components of a gamma

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -