Automating Shader Setup
Using Blender, you can automate the import of certain texture maps and most shader settings by saving them directly into the FBX file. This setup works on a per-material-slot basis.
After the initial setup, this can significantly reduce import time, especially if you plan to upload the asset multiple times, places or if it requires a lot of configuration.
This is completely optional. All materials and settings can still be adjusted manually when importing or editing the asset in-game.

Import Texture Maps Guide
Some PBR texture maps can be automatically imported if they are set up correctly in Blender. Currently, only a limited number of maps support auto-import; any others must be assigned manually during the import process.
Supported Auto-Import Maps
The following texture maps can be automatically imported:
Albedo
Normal
Roughness
Metalness
Emissive Map
How Auto-Import Works
To enable auto-import, connect your texture files to the correct inputs on the Principled BSDF shader in Blender. When the material is imported, Sansar will automatically assign these textures to their corresponding map slots, if they are supported by the shader.
You can use the Node Wrangler Blender add-on to set this up automatically when proper texture naming is used. Alternatively, you can connect the textures manually by following this guide.

In blender, make sure you have at least one material slot assigned to your model, additional materials will need setting up also in the same way. Click on the Shading tab at the top (you can open additional windows)

In the Shading window, you will need a principled BSDF, this should be added by default but if not you can add one.

In the shader node window add a
Image Texturenode for each map and aNormal Mapnode.

With your nodes added, now add your maps to each node, naming doesn't matter as it uses the BSDF connection to determine the maps use.

Once your maps are added, connect the nodes to the BSDF by clicking and dragging the sockets to each slot, make sure to include the
Normal Mapnode.

When you export your model, the texture file paths will be embedded into the FBX so Sansar can locate and import them automatically.
Your texture maps must be saved somewhere on your computer. During export, choose one of the following options:
Match – Use this if the textures are already saved in the correct location.
Copy – Use this if the textures are packed inside the Blender file and need to be extracted during export.

Import Settings Guide
Assigning The Shader
This section covers assigning the selected shader associated with the material slot.

In Blender, open the material Properties Panel

Choose the material slot you want to set up. Each slot is configured individually, so you’ll need to set up each one you want to control. Any options you leave unchanged will fall back to Sansar’s defaults, and can still be modified during import.

In the Custom Properties Tab of the material select New and then open the Edit Property panel by pressing the cog icon.

Change the type to String and change the Property name to be Sansar_MaterialType then click OK make sure to include the capitals.

Now enter the System Name (not the Display Name) of the shader you want to assign to this material slot. This should be typed into the input field on the main Properties panel, not in the previous setup window.
If you try to input an unrecognized name or a Display Name the import will fail with a error.

Example input: OpaqueSingleLayer for the Standard Shader.

The following is a list of the shader's Display Name and its System Name.
Finally when you export your object make sure to use .FBX and tick the Custom Properties box.

Now when you import to sansar the material slots shader will automatically be assigned to your defined shader.
Assigning Shader Settings
This section explains how to assign shader settings such as sliders, toggle boxes, and input fields.
These settings use one of the following data types: Float, Integer, or Bool.

Each shader has its own set of available settings. You must first assign the shader you want to use before configuring any settings. If you add a setting that is not supported by the selected shader, it will be ignored.
NOTE: Follow the guide above to assign your shader before continuing.
Choose the material slot you want to configure. Each material slot is set up individually, so you must repeat this process for every slot you want to control. Any settings you do not configure will fall back to Sansar’s default values and can still be adjusted during import.
Make sure your shader is assigned first—you should see it listed in the material’s Custom Properties.

In the material’s Custom Properties tab, click New to create a property, you can add multiple. Then open the Edit Property panel by clicking the cog icon next to the new property.

Using the Shader Lookup Table, find the shader and property you want to configure. Take note of the property’s System Name, Type, and Range.

Choose the property Type that matches the shader setting you want to control.

Table Key
Float – Float A single number value. Can include decimal values (for example:
1.5,0.025).Float3 – Float Array A group of numbers used together. Any
Floatfollowed by a number indicates how many values are required. Example:1.0, 0.5, 0.0Some settings expect additional values even if they are not actively used—leave these extra values set to0.Integer – Integer A whole number only. While floats may be accepted, the shader will only use whole numbers (for example:
1,10).Bool – Boolean A simple on/off setting.
Set the property’s System Name, include capitals, along with any Minimum and Maximum values based on the shader’s Range. You only need to define the limits you plan to use, but it is best practice to match the full supported range.
You do not need to set the Default Value here, this is done in the main properties panel instead.
Once done click OK

In the main panel you can now add your number values to the fields.

You can add as many properties as you need, you do not need to add them if you do not need to control on import as they will just be defaulted if no property is given.
The order these appear in blender is not importent, just make sure you always have your shader defined.
Finally when you export as .FBX make sure to enable the Custom Properties box.

Now when you import to sansar the material slots shader will automatically be assigned to your defined shader and any sliders settings or bools will be setup!
Settings Lookup Table
A full table of the shaders settings names ranges and types is available here Shader Lookup Table
Troubleshooting
Settings not working:
Make sure to check for capitals or extra spaces.
You are using the system names, and the correct type.
Your shader was defined.
Last updated