|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Blender plugin that extends the glTF 2.0 exporter with two custom extensions for Vulkan Schnee Engine data.
File: AirHockey/Blender/pythonScripts/ExporterPlugin/
The exporter adds two glTF extensions:
Per-object metadata attached to glTF nodes. Contains mesh behavior, lighting settings, and lightmap configuration.
Per-material shader configuration attached to glTF materials. Contains shader type, parameters, and PBR texture/factor data.
Install as a standard Blender addon via Edit > Preferences > Add-ons > Install.... Requires the io_scene_gltf2 addon (Blender's built-in glTF exporter).
The plugin adds a "Vulkan Schnee Engine" panel to the glTF export dialog:
| Option | Description |
|---|---|
| Export Engine Properties | Enables VULKAN_SCHNEE_engine_properties and VULKAN_SCHNEE_materials extensions. Default: enabled. |
| Validate Properties | Runs pre-export validation and logs issues to console. Default: enabled. |
| Copy Baked Lightmaps | Copies lightmaps/ folder from .blend directory to export directory. Default: disabled. |
Exported for each mesh object. Reads properties from the editor plugin's vulkan_schnee_properties object attribute.
meshProperties:
lightingProperties:
lightmapProperties (only present if hasLightmaps is true):
If vulkan_schnee_properties does not exist, the exporter checks for legacy custom properties:
Materials without properties get a basic metadata-only extension.
Exported for each material. Reads shader node data from Vulkan Schnee shader nodes in the material's node tree.
File: AirHockey/Blender/pythonScripts/ExporterPlugin/MaterialExtension.py
Shader types correspond to Vulkan Schnee shader nodes defined in the editor plugin:
| Shader Type | Description | Debug Modes | Tone Mapping |
|---|---|---|---|
| diffuseFlatColor | Solid color | None | None |
| diffuseShader | Basic texture | None | None |
| movableDiffuseShader | Full PBR + SH lighting | 0-5 | Reinhard/ACES |
| normalsShader | Normal visualization | Fixed (1) | None |
| staticLightmap | Baked lightmap (UV2) | 0-2, 6 | Reinhard/ACES |
| l0Shader | SH L0 only (ambient) | Fixed (3) | None |
| l1Shader | SH L1 only (directional) | Fixed (4) | None |
| l2Shader | SH L2 only (quadratic) | Fixed (5) | None |
| dynamicTextures | Full PBR + SH (ACES) | 0-5 | ACES |
Debug Modes:
The exporter automatically maps Vulkan Schnee shader node inputs to standard glTF PBR fields:
Texture Mappings:
| VS Input Socket | glTF Field | glTF UV Attribute |
|---|---|---|
| Base Color | pbrMetallicRoughness.baseColorTexture | TEXCOORD_0 |
| Roughness | pbrMetallicRoughness.metallicRoughnessTexture | TEXCOORD_0 |
| Metallic | (same as Roughness) | TEXCOORD_0 |
| Normal Map | normalTexture | TEXCOORD_0 |
| Emissive | emissiveTexture | TEXCOORD_0 |
| Lightmap Texture | (stored in extension only) | TEXCOORD_1 |
Factor Mappings:
| VS Input Socket | glTF Field |
|---|---|
| Base Color (unconnected) | pbrMetallicRoughness.baseColorFactor |
| Roughness Factor | pbrMetallicRoughness.roughnessFactor |
| Metallic Factor | pbrMetallicRoughness.metallicFactor |
| Normal Scale | normalTexture.scale |
| Emissive Factor | emissiveFactor |
glTF requires metallic and roughness in a single texture (green=roughness, blue=metallic). The exporter uses the roughness texture if both are connected. Separate metallic textures generate a warning.
The exporter searches the material's node tree for Vulkan Schnee shader nodes:
If multiple nodes exist, the first is used. Materials without VS nodes get a default diffuseFlatColor shader with "defaulted": true in metadata.
When "Validate Properties" is enabled, the exporter runs pre-export checks:
Object Validation:
Material Validation:
Validation warnings print to the Blender system console (Window > Toggle System Console on Windows).
The plugin implements the glTF2ExportUserExtension interface:
| Hook | Purpose |
|---|---|
| gather_gltf_extensions_hook() | Registers extension names in extensionsUsed |
| gather_node_hook() | Exports VULKAN_SCHNEE_engine_properties per object |
| gather_material_hook() | Exports VULKAN_SCHNEE_materials per material |
| pre_export_hook() | Validates scene and logs statistics |
| post_export_hook() | Copies lightmap files to export directory |
When "Copy Baked Lightmaps" is enabled:
The engine reads these extensions in GltfLoader.cpp:
VULKAN_SCHNEE_engine_properties:
VULKAN_SCHNEE_materials:
See GltfLoader for complete import implementation.
After modifying exporter code:
This rebuilds the plugin zip for distribution. Reload the plugin in Blender to test changes.