Skip to content
skrat edited this page Sep 13, 2010 · 14 revisions

Collada support

You can try out by fetching ‘collada’ branch.

Requirements

  • Extensions to SC language to allow
    • loading meshes, shaders, lights and camera from COLLADA’s digital asset exchange (DAE) files.
    • optionally autoload required shaders as used by geometry
    • batch import by requesting <visual_scene>1 and <node>1 element
  • Parser for DAE files
  • Ability to cross-reference library elements (geometries, nodes, materials, …)

Usage

There are 2 way you can use COLLADA data with Sunflow. One is to include geometry from DAE file in your SC.
Another is to provide Sunflow with DAE file on command line. This is the preferred way of rendering COLLADA.

DAE Parser

Parser picks instance of <visual_scene> from the main <scene> element. Optionally, it could be nice to have command line switch to choose which visual scene and which camera to render.

Image settings & Background color

You can specify image settings and background color (shader later) by providing <extra> element in you visual scene.

  ...
  <library_visual_scenes>
    <visual_scene id="VisualSceneNode" name="Mansion">
      <extra>
        <technique sid="sunflow">
         <background>
            <color>1.0 1.0 1.0</color>
          </ background>
          <image>
            <resolution>800 600</resolution>
            <aa>0 2</aa>
            <filter>gaussian</ filter>
          </ image>
        </ technique>
      </ extra>
      <node id="Camera" name="Camera">

sorry for XML formatting, github cannot handle XMLs in wiki

It supports following Sunflow properties (specified as XML elements with same names): resolution, sampler, samples, contrast, jitter, cache, filter

Global illumination

…it’s there.

Camera

Parser will pick up first camera from main scene. Sunflow’s thinlens camera is supported through core COLLADA’s <zfar> and <znear> elements (in camera).

In your SC file

You can instantiate geometry by defining object with ‘collada’ as a type:

object {
    shader orange
    type collada
    name Fruity
    filename path/to.dae
    id id-of-collada-geometry
}

Currently this imports only from COLLADA’s <triangles>1 element. You have to specify an ID of <geometry>1

1 As explained in COLLADA 1.4.1 spec link
[collada_spec]http://www.khronos.org/files/collada_spec_1_4.pdf

Clone this wiki locally