Author: MastaMan
Date: June 16, 2023
Updated on: June 21, 2023

Best Practices for Playcanvas

Over a long period of time in Playcanvas and working as a team, we have collected the best practices that we apply in each of our projects.

Name of objects

Correct names are the path from chaos to order.
We recommend that you follow the following rules in the names:

Asset Type

Prefix

Example

Static Mesh

SM_

SM_Floor

Dynamic Mesh

DM_

DM_Fish

Materials

M_

M_Roof_Rust

Textures

T_

T_Brick_D

Sounds

S_

S_Swirl

Fonts

Font_

Font_Raleway

For all textures you need to add a postfix in the name.

For example:
T_Texture_Name_N
T_Texture_Name_AO

Texture Type

Postfix

Example

Ambient Occlusion

_AO

T_Wall_AO

Diffuse

_D

T_Concrete_D

Metalness

_M

T_Door_Handle_M

Glossiness

_G

T_Paint_G

Roughness

_R

T_Toy_R

Emissive

_E

T_Pendant_Spot_E

Normal

_N

T_Barelief_N

Light Map

_LM

T_House_LM

Important!
Do not use spaces in titles. Replace spaces with underscores "_".

Name of materials

Consider an example for SM_Car_03, which has 3 IDs.

In 3Ds Max we can name materials whatever we want, but for Playcanvas proper naming is a must.

For example:
M_Car_03_0
M_Car_03_1
M_Car_03_2

The ID at the end of the title shows the order of the Id in the Multimaterial in 3Ds Max.

Export objects

To export objects from 3Ds Max, you must use only the FBX format.

The export settings are shown below.

export from 3dsmax fbx to playcanvas settings
Loading...

Import to Playcanvas

Models are imported by simply dragging and dropping FBX files onto the Assets panel.

After import, *.glb files will be automatically created, which we will use in our work in the future.

Important!
Removing all FBX files from Assets should be done only at the very end of the project!

Folder structure

📁 Mesh - folder for objects. You need to create a separate folder for each FBX file.

For example:
SM_Floor_01 (folder)
SM_Walls (folder)
SM_Kitchen_Appliciance_01 (folder)
SM_Sofa_01 (folder)

Such folders may contain their own unique textures and materials that are related to a particular FBX.

📁 Textures - folder with various textures.

📁 Cubemap - folder for cubemap images and materials.

📁 Scripts - folder for scripts.

Texture optimization

All textures must strictly match the size and be a multiple of 2.

For example:
4096x4096
2048x2048
1024x1024
512x512
256x256

Don't forget to apply compression when you save pictures in Photoshop.

Use File → Save for Web and set the quality to 90%.

I also recommend using the JPEG Optimize utility, which allows you to compress images several times without losing quality.

Download JPEG Optimize and detailed instructions are available for Patreon subscribers.

Patreon

You can also use Playcanvas built-in features and use BASIS compression in the Asset Inspector.

Transparency

In order for transparency to display correctly on all devices, you must use a black and white map.

black white map opacity for playcanvas
Loading...

Cubemap

Cubemap is a special type of texture assets. They are formed from 6 texture resources, where each texture represents a face of a cube.

To convert 360° panoramas in cubemap, use the service:

https://matheowis.github.io/HDRI-to-CubeMap/
PlayCanvas Developer Resources
PlayCanvas Tutorials
3D Ground Playcanvas Articles

Editing an article

The author reserves the right to edit and supplement the article as needed.
In order not to miss updates, subscribe to Patreon!

Patreon


{{commentsMsg}}
  

No one has posted a comment yet
{{comment.lastname}} {{comment.name}} {{comment.date}}
{{comment.text}}
Sponsored content