POV-Ray : Newsgroups : povray.beta-test : Wavefront OBJ import : Wavefront OBJ import Server Time
24 Apr 2024 02:20:35 EDT (-0400)
  Wavefront OBJ import  
From: clipka
Date: 13 Sep 2016 20:08:07
Message: <57d894e7$1@news.povray.org>
Source code:

https://github.com/c-lipka/povray/tree/feature/obj_import

Syntax is as follows:

    mesh {
      obj FILENAME
      [ OBJ_TEXTURE_LIST ]
      [ inside_vector VECTOR ]
    }

    OBJ_TEXTURE_LIST:
      texture_list {
        [ OBJ_TEXTURE_LIST_ITEM ... ]
      }

    OBJ_TEXTURE_LIST_ITEM:
      STRING texture { TEXTURE } |   (A)
      STRING material { TEXTURE } |
      prefix STRING |                (B)
      suffix STRING

At present, associated .mtl files will /not/ be evaluated; instead,
textures must be defined using one of the following means:

(A) in the texture_list, as a list of the individual material names as
used in the .obj file and the respective texture definition to use; or

(B) before the `mesh` statement, by defining texture variables with
corresponding names. For some ease of use, a pre- and suffix can be
defined that will be added to the material name as used in the .obj file.

For additional ease of use, materials can be used instead of textures;
however, in that case only the texture is taken from the material, while
the interior_texture and interior are ignored.


e.g.

    #declare MyTexture = texture { ... }
    #declare MyMaterial = material { ... }

    mesh {
      obj "MyMesh.obj"
      texture_list {
        "Foo" texture { MyTexture }
        "Bar" material { MyMaterial }
        prefix "Tx"
        suffix "_"
      }
      inside_vector y
    }

will map the material name "Foo" in the .obj file to `MyTexture` and the
material name "Bar" to `MyMaterial`, while any other name, say, `Fnord`
or `Uqbar`, would be mapped to `TxFnord_` and `TxUqbar_`, respectively.


OBJ import provides rudimentary support for non-triangular polygons, but
currently just blindly cuts up such polygons into triangles, relying on
the polygons to be nicely planar and convex. This may also affect the
apparent curvature of such polygons.


That said, I have a hunch that someone might like this feature.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.