Graphics.AddingAModel - lordmundi/wikidoctest GitHub Wiki

Adding a Model

« Adding a node | EDGE User’s Guide | Adding a camera »

Simple directions

  1. Edit userdata/configs/user_models.cfg

  2. Add the node into the MODELS block inside the SCENE_LOAD block exactly as specified in the article "Adding a node" except include the filename of the model in the "model();" attribute. For example:

    node(example_model); xyz( 0.0, 10.0, 0.0 ); model( example_model.ac ); parent( EARTH_CENTER );

NOTE: A data node is the same as a model node except the "model( filename );" field is missing in the declaration for a data node.

NOTE: The information for a node (such as xyz, pyr, etc.) can be overwritten if a BASE_STATE is specified to be loaded at startup. If the node exists in the state file, the state file will have authority over the definition in the config file and might explain why editing the node in the config is not showing up in the scene.

What's really going on

When adding a model to the scene, EDGE will notice a new model not in its cache and begin to crunch it and perform triangle meshing. It will eventually get the model put into EDGE's native format and optimized for rendering in the scene.

This all happens IF there is a model loader available to load the incoming model. Currently there are a few model loaders delivered with the package such as SSM, HSL, AC3D, and OpenFlight. SSM is EDGE's native format. The AC3D format is becoming the most popular format for outside models. Also, blender can export to AC3D. See this page for more info about exporting to AC3D from blender.

Most of the time, all you need to add to your MODELS block is something like the following:

node(FG_TEST); model(coffeecup.ac); xyz(0,0,0); pyr(0,0,0); parent(FG_TEST_BASE);

This will create a node in the scene called "FG_TEST". It is associated with a model called "coffeecup.ac". It is positioned directly on top of the FG_TEST_BASE node, as indicated by an xyz of "0, 0, 0" and a pyr of "0, 0, 0".

Restarting EDGE now should notice a new model and should update the model cache if the autosave is turned on. This file is commonly called "cache/eng_graph.update".

NOTE: If you have any trouble loading in your model, you could try deleting this file and letting EDGE rebuild the entire thing again.

That is pretty much it for most models. If you want to add a data node to the scene (i.e., a node with no model attached), simply omit the "model" portion of the above line.

Also, the native unit for EDGE is inches (by virtue of all the models we use, not the renderer itself). See this page for modeling guidelines.

« Adding a node | EDGE User’s Guide | Adding a camera »