Custom Asset Importing: Difference between revisions
Created page with "At some point you may want to import a new model, texture, sound, etc. This can be done one of two ways - manually via scripting, or by using the built in mod asset importer feature. I suggest the latter, unless you want to do something funky. === Asset Manifest === Every mod can have an asset manifest file defined. This lists out all assets you want to import. TODO === Supported Importers === <u>SimpleModel:</u> Imports a GLTF file as a gameobject. You can define a..." |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
Every mod can have an asset manifest file defined. This lists out all assets you want to import. | Every mod can have an asset manifest file defined. This lists out all assets you want to import. | ||
Create a file called manifest.txt in your mod directory. | |||
= | ''Example Asset Manifest''<syntaxhighlight lang="json"> | ||
{ | |||
"assets": [ | |||
{ | |||
"assetId": "testmod.dog", | |||
"type": "texture", | |||
"properties": [ | |||
{ | |||
"name": "path", | |||
"value": "Assets/dog.png" | |||
} | |||
] | |||
} | |||
] | |||
} | |||
</syntaxhighlight> | |||
=== Built in Importers === | |||
There are several built in importers to load up your assets. Most of them are pretty self explanatory! | |||
{| class="wikitable" | |||
|+ | |||
!Name | |||
!Description | |||
!ID | |||
!Properties | |||
|- | |||
|GLTFScene | |||
|Imports a GLTF file as a GameObject. Ideal for weapons, items, simple objects. | |||
You can define a built in material to use, and it will automatically apply said material + hook up included textures. | |||
|gltf_scene | |||
|path: the path to the gltf file | |||
shader: (optional) the shader id to import. | |||
|- | |||
|Texture | |||
|Imports a .png or .jpeg as a Texture2D | |||
|texture | |||
|path: the path to the image file | |||
|- | |||
|AudioClip | |||
|Imports a .mp3, .wav, or .ogg as an ArdenAudioClip | |||
|audio_clip | |||
|path: the path to the audio file | |||
|- | |||
|AssetBundle | |||
|Imports a unity asset bundle. | |||
|asset_bundle | |||
|path: the path to the asset bundle file | |||
|} | |||
==== GLTFScene ==== | |||
A GLTF scene / model importer. Will import the GLTF object as a gameobject. | |||
Supports material applying using ModMaterialResolver. | |||
Built on the [https://docs.unity3d.com/Packages/[email protected]/manual/index.html GLTFFast] library. | |||
<u>Properties</u> | |||
{| class="wikitable" | |||
|+ | |||
!Property | |||
!Required | |||
!Default | |||
!Description | |||
|- | |||
|path | |||
|YES | |||
| - | |||
|The path to the gltf / glb file | |||
|- | |||
|shader | |||
|NO | |||
|"Ardenfall/SimpleDiffuse" | |||
|Defines the shader to be imported. | |||
Only a single shader per scene is supported at the moment. | |||
See Common Shaders for a list of shaders to try out. | |||
If you leave it blank, will not import any materials. | |||
|} | |||
=== Common Shaders === | |||
==== SimpleDiffuse ==== | |||
''"Ardenfall/Simple Diffuse"'' | |||
The most common shader used in Ardenfall. An opaque shader that supports: | |||
- Texture, Color, Cullmode, Cutoff | |||
- Specularity, Fake Specularity | |||
- Emission Texture, Emission Color, Emission Fading, Time of Day Emission | |||
- Pivot Rotation Animation | |||
- Vertex Wind Animation | |||
- Fresnel | |||
- Triplaner Texture | |||
'''SimpleDiffuse Transparent''' | |||
''"Ardenfall/Simple Diffuse Transparent"'' | |||
A version of the Simple Diffuse shader that is transparent. | |||
'''EnchantableItem''' | |||
''"Ardenfall/Enchantable Item Diffuse"'' | |||
The shader used for items that have enchanted glows. (Weapons) | |||
==== CharacterSkin ==== | |||
''"Ardenfall/Avatar/Character Skin"'' | |||
The shader used for characters (humanoid skin, monsters bodies). | |||
'''CharacterClothing''' | |||
''"Ardenfall/Avatar/Character Clothing"'' | |||
The shader used for character clothing/armor. | |||
=== Example: A Custom Weapon === | === Example: A Custom Weapon === | ||
TODO | TODO | ||
Latest revision as of 13:38, 23 May 2026
At some point you may want to import a new model, texture, sound, etc.
This can be done one of two ways - manually via scripting, or by using the built in mod asset importer feature. I suggest the latter, unless you want to do something funky.
Asset Manifest
Every mod can have an asset manifest file defined. This lists out all assets you want to import.
Create a file called manifest.txt in your mod directory.
Example Asset Manifest
{
"assets": [
{
"assetId": "testmod.dog",
"type": "texture",
"properties": [
{
"name": "path",
"value": "Assets/dog.png"
}
]
}
]
}Built in Importers
There are several built in importers to load up your assets. Most of them are pretty self explanatory!
| Name | Description | ID | Properties |
|---|---|---|---|
| GLTFScene | Imports a GLTF file as a GameObject. Ideal for weapons, items, simple objects.
You can define a built in material to use, and it will automatically apply said material + hook up included textures. |
gltf_scene | path: the path to the gltf file
shader: (optional) the shader id to import. |
| Texture | Imports a .png or .jpeg as a Texture2D | texture | path: the path to the image file |
| AudioClip | Imports a .mp3, .wav, or .ogg as an ArdenAudioClip | audio_clip | path: the path to the audio file |
| AssetBundle | Imports a unity asset bundle. | asset_bundle | path: the path to the asset bundle file |
GLTFScene
A GLTF scene / model importer. Will import the GLTF object as a gameobject.
Supports material applying using ModMaterialResolver.
Built on the GLTFFast library.
Properties
| Property | Required | Default | Description |
|---|---|---|---|
| path | YES | - | The path to the gltf / glb file |
| shader | NO | "Ardenfall/SimpleDiffuse" | Defines the shader to be imported.
Only a single shader per scene is supported at the moment. See Common Shaders for a list of shaders to try out. If you leave it blank, will not import any materials. |
Common Shaders
SimpleDiffuse
"Ardenfall/Simple Diffuse"
The most common shader used in Ardenfall. An opaque shader that supports:
- Texture, Color, Cullmode, Cutoff
- Specularity, Fake Specularity
- Emission Texture, Emission Color, Emission Fading, Time of Day Emission
- Pivot Rotation Animation
- Vertex Wind Animation
- Fresnel
- Triplaner Texture
SimpleDiffuse Transparent
"Ardenfall/Simple Diffuse Transparent"
A version of the Simple Diffuse shader that is transparent.
EnchantableItem
"Ardenfall/Enchantable Item Diffuse"
The shader used for items that have enchanted glows. (Weapons)
CharacterSkin
"Ardenfall/Avatar/Character Skin"
The shader used for characters (humanoid skin, monsters bodies).
CharacterClothing
"Ardenfall/Avatar/Character Clothing"
The shader used for character clothing/armor.
Example: A Custom Weapon
TODO