-
Notifications
You must be signed in to change notification settings - Fork 187
Adding 3D models
Garrett Guillotte edited this page Nov 1, 2024
·
6 revisions
EmptyEpsilon can use OBJ models. To make new OBJ models available for use:
-
Place the OBJ files and any textures in the
EmptyEpsilon/resources
directory. -
Add a
ModelData()
entry toEmptyEpsilon/scripts/model_data.lua
. For example, the following code:- adds a model named
gentest
from OBJ filegentest.obj
- uses
gentest.png
for its texture - uses
gentest_diffuse.png
for its specular/reflective map - uses
gentest_illumination.png
for its illumination map - scales the model up 24x
- sets its in-game radius to 120 meters
- adds two engine effect emitters
model = ModelData() model:setName("gentest") model:setMesh("gentest.obj") model:setTexture("gentest.png") model:setSpecular("gentest_diffuse.png") model:setIllumination("gentest_illumination.png") model:setScale(24) model:setRadius(120) model:addEngineEmitter(-13, -2.1500, 0.3, 0.2, 0.2, 1.0, 3.0) model:addEngineEmitter(-13, 2.1500, 0.3, 0.2, 0.2, 1.0, 3.0)
- adds a model named
-
Adjust the ModelData properties appropriately.
-
If you're exporting OBJ files from Blender, use the following settings:
-
If you need to rotate a model, do so from a 3D modeling program. Some example programs include:
- Blender (Windows, OS X, Linux)
- Misfit Model 3D (Windows; OS X and FreeBSD experimental)
Since model_data.lua
is a Lua script file, you can use scripting tools (such as loops) to easily add many similar models.
3D coordinates (Vector3f
) in these functions translate to -X, Y, Z
values in Blender.
- Positive X values in
model_data.lua
are forward of the center point. - Positive Y values are to the right of the center point.
- Positive Z values are above the center point.
-
:setName(string name)
: The model's name, which is used to refer to the model in ship template scripts. -
:setMesh(string mesh_name)
: The relative path to the mesh file withinresources
(orpacks
). -
:setTexture(string texture_name)
: The relative path to a texture file... -
:setSpecular(string specular_texture_name)
: ... specular map ... -
:setIllumination(string illumination_texture_name)
: ... and illumination map. -
:setRenderOffset(sf::Vector3f mesh_offset)
: Offset the mesh's position by this amount. Useful to recenter the model if its center point in the mesh file is not at0, 0, 0
. -
:setScale(float scale)
: Scale the mesh by this multiplier. -
:setRadius(float radius)
: Set the mesh's effective radius in in-game meters. -
:setCollisionBox(sf::Vector2f collision_box)
: -
:addBeamPosition(sf::Vector3f position)
: Add a visual beam emitter at this position on the model. -
:addTubePosition(sf::Vector3f position)
: Add a visual weapons tube at this position on the model. -
:addEngineEmitter(sf::Vector3f position, sf::Vector3f color, float scale)
: Add an engine emitter (visual effects trail) at this position on the model, with a RGB color (ie.1.0, 0.0, 0.0
for full red), and scale.
- Home
- Stations
- Main Screen/Captain
- 5-6 Player Crews
- 3-4 Player Crews
- 1 Player Crew
- Game Master
- Additional Stations and Views
- Setting up a Game
- Lore
- Expanding the Game
- Additional Features
- Building from Source