Scene3D is a collection of assets to help you developing 3D games with the Defold game engine. Use included prefabs to quickly prototype structures, levels, and to test game mechanics. Try out ideas quickly!
The built-in example scene is available β¨to play onlineβ¨. Controls:
WASD
to run or drive, SPACE
to jump. Mouse to look. 4
to switch between character/car.5
to reload current scene, 6
to load next scene, 0
to toggle photo mode (move the mouse to look, WASD
to fly, SPACE
to go up, C
to go down, M
to copy camera settings).1
to toggle physics debug, 2
to toggle profiler.Follow further developments:
update
functions have been called and physics objects have been moved.0
to capture controls and observe the scene. The mode controls: move the mouse to look, WASD
to fly, SPACE
to go up, C
to go down, M
to copy camera settings, Enter
to take a screenshot.basic_color.material
- colors your model + the simplest shading. The mesh should have the "color" stream.basic_grid_*.material
- it puts a texture on your objects without having to make UVβs.basic_unlit.material
- the simplest possible textured material. sky.material
is the same but with a different tag.primitive_*.material
- no textures, only applies tint on your model.Some materials have a tint from the palette: Nickel, Timberwolf, Pacific Blue, Verdigris, Middle Blue Green, Medium Champagne, Maximum Yellow Red, Atomic Tangerine, Salmon, Candy Pink.
Included shaders don't apply gamma correction.
β οΈ Work in progress β οΈ
Scene3D uses the metric system, i.e. metres as its default unit for measuring distance/length, i.e. 1 unit is 1 meter.
vmath.vector3(0, 0, -1)
.Use it in your own project by adding this project as a Defold library dependency. Open your game.project
file and in the dependencies field under project add the link to the ZIP file.
mouse_look.script
or the debug_ui.collection
prefab).Scene3D can use the following dependencies if you include them in your project:
playground
: a playable level with a first-person character controller and a car. Loaded first.basic_3d
: use it as a template to start developing a new 3D project/scene.shadows
: a scene to test shadows.blocksbuster
: a re-creation of popular hyper-casual game mechanics.math3d.lua
The table briefly describes the included helper math functions. The source code of math3d.lua
has more detailed explanation.
Lua Function | Description | Corresponding Unity API |
---|---|---|
Quaternions | ||
math3d.euler_x(q) |
Returns the Euler angle representation of a rotation, in degrees - X. | Quaternion.eulerAngles.x |
math3d.euler_y(q) |
Returns the Euler angle representation of a rotation, in degrees - Y. | Quaternion.eulerAngles.y |
math3d.euler_z(q) |
Returns the Euler angle representation of a rotation, in degrees - Z. | Quaternion.eulerAngles.z |
math3d.quat_inv(q) |
Returns the inverse of rotation. | Quaternion.Inverse |
math3d.quat_look_rotation(forward, upwards) |
Creates a rotation with the specified forward and upwards directions. | Quaternion.LookRotation |
Math | ||
math3d.clamp(x, min, max) |
Clamps the given x between the given minimum float and maximum float values. | Mathf.Clamp |
math3d.clamp01(x) |
Clamps x between 0 and 1 and returns value. | Mathf.Clamp |
math3d.delta_angle(a, b) |
Calculates the shortest difference between two given angles (in degrees). | Mathf.DeltaAngle |
math3d.inverse_lerp(t, a, b) |
Calculates the lerp parameter between of two values. | Mathf.InverseLerp |
math3d.lerp(t, a, b, [dt]) |
Linearly interpolates between a and b by t . The parameter t is clamped to the range [0, 1] . |
Mathf.Lerp |
math3d.lerp_angle(t, a, b, [dt]) |
Same as vmath.lerp but makes sure the values interpolate correctly when they wrap around 360 degrees. |
Mathf.LerpAngle |
math3d.limited_lerp(t, a, b, max_step) |
Same as vmath.lerp but max_step limits the increment of value. |
- |
math3d.move_towards(a, b, max_delta) |
Moves the a value towards b . |
Mathf.MoveTowards |
math3d.ping_pong(t, length) |
Pingpongs the value t, so that it is never larger than length and never smaller than 0. | Mathf.PingPong |
math3d.repeat_(t, length) |
Loops the value t, so that it is never larger than length and never smaller than 0. | Mathf.Repeat |
math3d.sign(x) |
Returns the sign of x. | Mathf.Sign |
math3d.smooth_step(x, min, max) |
Interpolates between min and max with smoothing at the limits. | Mathf.SmoothStep |
math3d.smooth_damp(a, b, cur_velocity, smooth_time, max_speed, dt) |
Gradually changes a value towards a desired goal over time. | Mathf.SmoothDamp |
math3d.smooth_damp_angle(a, b, cur_velocity, smooth_time, max_speed, dt) |
Gradually changes an angle given in degrees towards a desired goal angle over time. | Mathf.SmoothDampAngle |
Camera | ||
render3d.screen_to_world(x, y, z, [world_coord]) |
Transforms a point from screen space into world space. | Camera.ScreenToWorldPoint |
Noise | ||
scene3d.simplex_noise2(x, y) |
Generates 2D Perlin noise. Output range is [0, 1]. | Mathf.PerlinNoise |
TODO
... Add information about the over-use of scripts and how to optimize them. ... Add info about shaders optimization, downsizing meshes buffers.
The following issues are critical for the further development of Scene3D. Please put πππ on them!
ππ First off, thanks for taking the time to contribute! ππ
Scene3D tries to follow the principles:
When creating a bug report, please include as many details as possible. If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
Please, follow code formatting style of the project:
snake_case
when naming files, Lua variables, objects, functions, and instances.Artsiom Trubchyk (@aglitchman) is the current Scene3D owner within Indiesoft and is responsible for the open source repository.
The content and sources are licensed under the MIT license.