Using models

The box and sphere primitives are easy to use, however, in most cases, we'd like to use other models for the visualization.

Luxinia is using its own 3D format for displaying objects. You can either use one of the exporter plugins for 3DS Max or Cinema 4D to export a model, or you can use the convertool that we provide to convert a model from a different format.

Step 1: Converting

The hardway: Using the Console

(for the simple way, see here)

The plugins for the 3D editors are fairly easy to use, so I will describe here how to use the converter. First, you will need to download the luxinia tools from the download section and extract it to a path on your HD, i.e. c:luxtools. As an example model, I will use here a spaceship model. I've exported it to the 3DS format, as it is very likely that any other modeller supports this format.

You can convert the 3DS file by opening cmd.exe (Start→Execute) and change to the directory where the model file is located.

I assume that the target file is located in c:luxtoolsluxf3dt33.3ds

  1. Change to the directory where the model file is located by typing
    cd luxtoolsluxf3dt33.3ds
  2. convert the file by typing
    luxf3d t33.3ds t33.f3d

The file is then converted and a new file named t33.f3d is created.

The output will look like this:

 
Luxinia F3D Tool 2.2
====================
by Christoph 'CrazyButcher' Kubisch

Arguments:
t33.f3d

MODEL: t33.3ds
Loading .3ds ...

Loading and internal conversion finished

MODEL: t33.f3d
Writing .f3d ...
Writing Meshes
mesh: 1 instance: 0,0,0 helpers: 0
        MESH:1,W_rfel
                Parent: 0,MESH
                material: 2
                vertices: 299,indices: 1056,groups: 1
Writing Materials
materials: 2
        MATERIAL:1,W_rfel
                shadername: (null)
        MATERIAL:2,ships/t33.jpg
                shadername: t33small.tga
Writing Skins
skins: 0
MODEL: DONE

Create a directory named modelds in your project directory (where main.lua is located) and copy the file t33.f3d and the texture named t33small.tga into that directory.

Step 2: Displaying the model

This is quite easy. First we need to load the model, then we'll link it with our actor, just like with the primitives we used earlier.

view = UtilFunctions.simplerenderqueue()
view.rClear:colorvalue(0.0,0.0,0.0,0) 

actor = actornode.new("t33",0,10,0)
actor:rotdeg(40,-20,40)
t33 = model.load "t33.f3d"
actor.l3d = l3dmodel.new("t33",t33)
actor.l3d:linkinterface(actor)

The result will look like this: