Skip to content

Commit

Permalink
Merge branch 'feat/linked-wearables-v2' of github.com:decentraland/do…
Browse files Browse the repository at this point in the history
…cumentation into feat/linked-wearables-v2
  • Loading branch information
LautaroPetaccio committed Nov 4, 2024
2 parents a832829 + 4a462bb commit 50cb14e
Show file tree
Hide file tree
Showing 25 changed files with 218 additions and 187 deletions.
16 changes: 9 additions & 7 deletions content/creator/3d-modeling/3d-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ When importing 3D models into Decentraland, it's important to make sure they're

Please note that all models, shaders, and textures must comply with the **[scene limitations](https://docs.decentraland.org/creator/development-guide/scene-limitations/)**.

# **Supported 3D Model Formats**
## **Supported 3D Model Formats**

All 3D models in Decentraland must be in glTF format. **[glTF](https://www.khronos.org/gltf)** (GL Transmission Format) is an open project by Khronos providing a common, extensible format for 3D assets that is both efficient and highly interoperable with modern web technologies.

Expand All @@ -32,9 +32,11 @@ The following aspects of a 3D model can either be embedded in a *glTF* file or
- Textures can either be embedded or referenced from an external image file.
- Binary data about geometry, animations, and other buffer-related aspects of the model can either be embedded or referenced from an external *.bin* file.

> **📔 Note**: Animations *must* be embedded inside the *glTF* file to use in Decentraland.
{{< hint warning >}}
**📔 Note**: Animations *must* be embedded inside the *glTF* file to use in Decentraland. Also, each model is only allowed to have 1 UV map.
{{< /hint >}}

# **Why We Use glTF**
## **Why We Use glTF**

We use glTF because it provides a powerful set of features that includes:

Expand All @@ -45,9 +47,9 @@ We use glTF because it provides a powerful set of features that includes:

Compared to *COLLADA*, the supported features are very similar. However, because glTF focuses on providing a “transmission format” rather than an editor format, it is more interoperable with web technologies.

# **Export And Convert glTF**
## **Export And Convert glTF**

## **Export To glTF From Blender**
### **Export To glTF From Blender**

Blender has a native gltf exporter.

Expand Down Expand Up @@ -103,7 +105,7 @@ We recommend using these tools:
- **[Blackthread](https://blackthread.io/gltf-converter)**: This the most complete web based tool. Less robust than the CLI, but a lot easier to use.
- **[Modelconverter](https://modelconverter.com/convert.html)**: Another easy-to-use web based tool.

# **Preview a glTF Model**
## **Preview a glTF Model**

A quick and easy way to preview the contents of a glTF model before importing it into a scene is to use the **[Babylon.js Sandbox](https://sandbox.babylonjs.com/)**. Just drag and drop the glTF file (and its *.bin* file if applicable) into the canvas to view the model.

Expand All @@ -123,7 +125,7 @@ This tool can be especially useful for large files containing multiple models, t

<img src="/images/3d-models-and-animations/3d-essentials/05-gltf-report.png" width="600" />

# **Optimize a glTF**
## **Optimize a glTF**

The following tool offers some optimizations that will make 3D models lighter and faster to download for players in your scene.

Expand Down
31 changes: 13 additions & 18 deletions content/creator/3d-modeling/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ If you have a more complex model, such as a person, creature or machinery, then

For either method, though, all animations of a 3D model must be embedded inside its _glTF_ file since you can’t reference animations in separate files.

### **Creating An Animation**
## Creating An Animation

This is how you create animations using Blender.

**Object Animation**
### Object Animation

- Make sure you have the **_Dope Sheet_** > **_Action Editor_** tab open and click on **_New_** to add an animation clip.
- Rename it as you see fit and make sure to  toggle **_Fake User_** (the shield icon) so your animation is saved.
Expand All @@ -37,7 +37,7 @@ This is how you create animations using Blender.

_Creating an animation clip and adding keyframes._

**Rig Animation**
### Rig Animation

For a rig animation, you’ll need an armature. If you want to do it yourself, see [Create a Rig](https://www.notion.so/686e6f59a1604585b059f990a36b2d55) for instructions on how to set up a consistent armature.

Expand All @@ -55,7 +55,7 @@ If you’re new to the animation process, check out this tutorial with some nice

[![Video Preview](https://img.youtube.com/vi/-iWslh4uQIk/maxresdefault.jpg)](https://youtu.be/-iWslh4uQIk)

### Skinned Animations vs Transform Animations
## Skinned Animations vs Transform Animations

**Transform animations are typically better than skinned mesh animations for performance because they involve less overhead in terms of computational resources required to display the animation.**

Expand All @@ -67,15 +67,15 @@ Additionally, transform animations can often be pre-calculated and stored in a m

Overall, while skinned mesh animation can produce more detailed and realistic animations, transform animations are often preferred for performance-critical applications such as video games.

### Creating and Exporting Multiple Animation Clips
## Creating and Exporting Multiple Animation Clips

You can have as many animations clips as you want for you model. You can check on how to create, browse and delete animations in [this section here](https://www.notion.so/5e962e5d54a24bcb9b906748007eb4cc).

In the video below, you will learn how to export multiple animations from Blender in a single GLB file.

[![Video Preview](https://img.youtube.com/vi/YxAB4bujO_w/maxresdefault.jpg)](https://www.youtube.com/watch?v=YxAB4bujO_w&ab_channel=Decentraland)

### Exporting Many Animations as a Single One
## Exporting Many Animations as a Single One

Unlike in a skeletal animation, where you can rig multiple objects and combine their animations in a single animation clip, in object animation you can’t do that. The animations will be exported separately and only one object will play at a time. A solution for that is merging many animations into a single one, so you have an animation clip that has all objects moving at the same time.

Expand All @@ -93,14 +93,11 @@ _Settings to export multiple animations as a single one._

Keep in mind that this will only work if the objects have a single animation each. If the objects have multiple animation clips, it’s best to export them separately.

### **Hint!**

{{< hint warning >}}
💡 _Instead of creating your own animations, you can also download generic animations and apply them to your model. For example, for 3D characters with human-like characteristics, you can download free or paid animations from [Mixamo](https://www.mixamo.com/#/)._

{{< hint info >}}
**💡 Tip**: Instead of creating your own animations, you can also download generic animations and apply them to your model. For example, for 3D characters with human-like characteristics, you can download free or paid animations from [Mixamo](https://www.mixamo.com/#/).
{{< /hint >}}

### Sampling
## Sampling

Sometimes your animation file might end up being too heavy due to the amount of animations or the combination of animation+model.

Expand All @@ -114,18 +111,16 @@ You can find the **_Sampling Rate_** in the export settings, under **_Animation_

<img src="/images/3d-models-and-animations/animations/05_sampling_rate.png" width="600"/>

### Hint!

{{< hint warning >}}
💡 _If the number of frames of the animation can be divided by the sampling rate, that’s a good thing! It means that the final frame will be baked, preserving the transition from end to start of the animation._
{{< hint info >}}
**💡 Tip**: If the number of frames of the animation can be divided by the sampling rate, that’s a good thing! It means that the final frame will be baked, preserving the transition from end to start of the animation.
{{< /hint >}}

### Implementing Animations
## Implementing Animations

This document covers how to add animations into a 3D model. See **[handle animations](https://docs.decentraland.org/creator/development-guide/3d-model-animations/)**
 for instructions on how to activate and handle animations in a scene.

### Best Practices for Animation
## Best Practices for Animations

- Keep the armature as simple as possible, only create bones for the parts of the model that you intend to animate. Bones can affect performance, so make sure to only add what’s actually necessary.
- If the animation is going to loop in your scene, make sure the final pose is identical to the starting one for better transition.
Expand Down
46 changes: 21 additions & 25 deletions content/creator/3d-modeling/colliders.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ For example, to create a collider for a lamp post you can create a simple box ob

<img src="/images/3d-models-and-animations/3d-essentials/25-collider.png" width="600" />

In this case, we can name the box “LampPost_collider” and export both the tree and the box as a single *__gltf* model. The *__collider_* tag alerts the Decentraland world engine that the box object belongs to the collection of colliders, making the collider mesh invisible.
In this case, we can name the box “LampPost*collider” and export both the tree and the box as a single *\_\_gltf* model. The \*\_\_collider*\* tag alerts the Decentraland world engine that the box object belongs to the collection of colliders, making the collider mesh invisible.

Whenever a player views the lamp post model in your scene, they will see the complex model for your lamp. However, when they walk into it, they will collide with the box, not the tree.

# **Player Spatial Constraints**
## Player Spatial Constraints

When you design models that are meant for players to walk around in, you need to keep in mind the following reference measurements:

Expand All @@ -39,9 +39,9 @@ When you design models that are meant for players to walk around in, you need to

Whenever a player views the tree model in your scene, they will see the complex model for your tree. However, when they walk into your tree, they will collide with the box, not the tree.

## **Add A Collider To a Staircase**
### Add A Collider To a Staircase

Stairs are a very common use-case for collider objects. In order for players to climb stairs, there must be a corresponding _collider object that the players are able to step on.
Stairs are a very common use-case for collider objects. In order for players to climb stairs, there must be a corresponding \_collider object that the players are able to step on.

We recommend using a ramp object for your stair colliders, this provides a much better experience when walking up or down. When they climb up your stairs, it will appear as a smooth ascent or descent, instead of requiring them to “jump” up each individual step.

Expand All @@ -51,7 +51,7 @@ Using a ramp object also avoids creating unnecessary geometry, saving room for o

<img src="/images/3d-models-and-animations/3d-essentials/26-collider-2.png" width="600" />

2. Name the ramp object something similar to S*tair_collider*. It must end in _*collider*.
2. Name the ramp object something similar to S*tair_collider*. It must end in \__collider_.
3. Overlay the ramp object to the stairs so that they occupy the same space.

<img src="/images/3d-models-and-animations/3d-essentials/27-collider.png" width="600" />
Expand All @@ -60,56 +60,52 @@ Using a ramp object also avoids creating unnecessary geometry, saving room for o

Now when players view the stairs in your scene, they’ll see the more elaborate model of the stairs, but when they climb them, they’ll collide with the ramp.

# **Optimizing Colliders**
## Optimizing Colliders

- Prefer using **Box**, **Sphere** and **Capsule** collision meshes, because it will be more performant on loading and at runtime.
- Consider approximating complex collision mesh by several Primitive collision meshes (**Box**/**Sphere**/**Capsule**)

<img src="/images/3d-models-and-animations/3d-essentials/28-optimizing-colliders.png" width="600" />
<img src="/images/3d-models-and-animations/3d-essentials/28-optimizing-colliders.png" width="600" />

_Example: Collider for Ring can be composed as several Capsule or Box colliders_
_Example: Collider for Ring can be composed as several Capsule or Box colliders_

- Put collision mesh inside the Hierarchy of the object to which it is related. For example Spaceship_collider can be a child inside Spaceship parent (from Hierarchy point of view)

## **Convex vs Concave Colliders**
### Convex vs Concave Colliders

If using arbitrary mesh collider is the only possibility, then make collision mesh Convex (not Concave). It will prevent strange physics situations, like stuttering, stuckings inside the collider or clipping through it. Note, that it is often possible to mimic concave mesh by several convex meshes.

<img src="/images/3d-models-and-animations/3d-essentials/29-convex-collider.png" width="600" />
<img src="/images/3d-models-and-animations/3d-essentials/29-convex-collider.png" width="600" />

# **Collision Naming**
## Collision Naming

**Use meaningful names. Name should give context of where the asset is used or to which part of the object it relates.**
**Use meaningful names. Name should give context of where the asset is used or to which part of the object it relates.**

For asset naming we use mix of `PascalCase` and `snake_case`, which we can call `PascalSnake_case`. Basic rules there - new word or word after separator (`_`) starts with **Capital letter.**

Collison Mesh is the mesh which is used as reference for creating a collider in the Explorer
Collision Mesh is the mesh which is used as reference for creating a collider in the Explorer

- It follows same principles as Meshes above, but has `_collider` suffix at the end
**Examples:**
🟢 **Prefer** names - `Tram_Wheel_LeftFront_collider`
🔴 **Avoid** names - `Primitive.001_Collider`, `collider (1)`, `Cylinder.007_collider`,

**Examples:**
🟢 **Prefer** names - `Tram_Wheel_LeftFront_collider`
🔴 **Avoid** names - `Primitive.001_Collider`, `collider (1)`, `Cylinder.007_collider`,

{{< hint warning >}}
**🔥Optimization Tip🔥**

If collider can be approximated by Box, Sphere or Capsule shape then use additional suffix with one of these 3 possible variations _box, _sphere or _capsule.
If a collider can be approximated by a Box, Sphere or Capsule shape then use additional suffix with one of these 3 possible variations \_box, \_sphere or \_capsule.
Using these 3 shapes instead of arbitrary mesh for collision detection will increase your scene performance and loading time 💪🚀

Examples: 🟢 Teater_MainWall_North_collider_box, Fountain_Statue_collider_sphere
Examples: 🟢 Teater_MainWall_North_collider_box, Fountain_Statue_collider_sphere
{{< /hint >}}

# **Best Practices For Colliders**
## Best Practices For Colliders

- **Always use the smallest number of triangles possible when creating colliders.** Avoid making a copy of a complex object to use as a collider. Simple colliders guarantee a good user-experience in and keep your scene within the triangle limitations.
- **Collider objects shouldn’t have any material**, as players of your scene will never see it. Colliders are invisible to players.
- **All collider objects names must end with _*collider*.** For example, T*ree_collider*.
- **All collider objects names must end with \__collider_.** For example, T*ree_collider*.
- **If you use a *plane* as a collider, it will only block in one direction.** If you want colliders to block from both sides, for example for a wall, you need to create two planes with their normals facing in opposite directions.
- When duplicating collider objects, pay attention to their names. Some programs append a _*1* to the end of the filename to avoid duplicates, for example *tree_collider_1*. Objects that are named like this will be interpreted by the Decentraland World Engine as normal objects, not colliders.
- When duplicating collider objects, pay attention to their names. Some programs append a \_*1* to the end of the filename to avoid duplicates, for example *tree_collider_1*. Objects that are named like this will be interpreted by the Decentraland World Engine as normal objects, not colliders.
- You can avoid adding a collider mesh if you add an invisible `MeshCollider` component to the entity, that approximates the shape of the 3D model.
- You can also avoid adding a collider mesh if you configure the `GLTFContainer` component to use the visible geometry as a collider. See **[Colliders on 3D models](https://docs.decentraland.org/creator/development-guide/sdk7/colliders/#colliders-on-3d-models)** .
- If you’re creating a 3D model with many mesh shapes that each need their collider, there are some handy add-ons that can help. For Blender you can use the batch rename option inside Blender **[](https://github.com/Weisl/simple_renaming_panel)**to automatically add a `_collider` suffix to all mesh names in a group. More about this tool on “**Using Blender to rename assets” section**



Loading

0 comments on commit 50cb14e

Please sign in to comment.