Neural Hair Dynamics

Documentation & File Structure Overview for Fab Publishing

🇬🇧 English Documentation

This plugin contains 21 core active files (excluding generated binaries, intermediate build files, and local backups). It is split into a Runtime module (compiled into the final game) and an Editor module (tools specifically for the Unreal Editor).

Quick Start Guide

1. Enable Plugin: Open the Unreal Engine Plugin Browser (Edit -> Plugins), find "Pasma Engine — Neural Hair Dynamics", and enable it.
2. Open Editor: Click on the Window tab at the top of the UE interface. Find "Pasma Hair Editor" in the dropdown list (it might be near the very bottom) and open it.
3. Create & Bake: In the native editor that opens, create your hair simulation by painting roots. When ready, click the "Bake & Save Asset" button. This will generate a data asset in /Game/PasmaHair/Baked.
4. Add Component: Open your character or interactive object blueprint, and add the custom component named Pasma Hair Dynamics.
5. Assign Asset: In the component's Details panel, under the "Asset" category, insert the baked asset you just created.
6. Play & Test: Inside the blueprint viewport, the hair is invisible to save performance. Click Play in the editor to see the hair in action (make sure your character is not placed underground!).

UI & Controls Overview

Auto Roots
Automatically generates a grid of hair roots based on your physical grid density settings.
Clear All
Deletes all currently painted roots from the mesh.
Find ONNX
Automatically locates the required AI model data asset in the project files for simulation.
Bake & Save Asset
Saves your current painted roots and physics settings into a game-ready Data Asset.
Extra Physics (Checkbox)
⚠️ IMPORTANT: This is NOT the AI simulation. Checking this box adds the standard Unreal Engine physics engine solver on top of the neural network. It is NOT recommended to turn this on during normal AI simulation, as it can cause extreme instability.

1. Root & Configuration Files

Pasma_Engine_Neural_Hair_Dynamics.uplugin
The main plugin descriptor file. It defines the plugin's metadata, its modules (Runtime & Editor), and its dependencies (e.g., NNERuntimeORT).
Config/FilterPlugin.ini
Configuration file that dictates which files and folders should be included or excluded when packaging the plugin.
Resources/Icon128.png / horse_m_icon.png
Standard icon files used to display the plugin in the UE Plugin Browser and custom UI elements.

2. Content Files

Content/ONNX_Date/AIHair_Volumetric.uasset
The pre-trained Neural Network (ONNX model) imported as a UE asset, used to drive the volumetric hair simulations.

3. Runtime Module

Source/Pasma_Engine_Neural_Hair_Dynamics/ — This code runs in the actual game and is packaged with the final build.

Pasma_Engine_Neural_Hair_Dynamics.Build.cs
Unreal Build Tool (UBT) configuration script defining the module's dependencies (Engine, Core, NNE, etc.).
Public/..h / Private/..cpp
Pasma_Engine_Neural_Hair_Dynamics: The primary module entry point. Handles module initialization and shutdown in the engine.
PasmaHairDynamicsComponent
The main Actor Component. Attached to characters/meshes to simulate and render hair dynamically at runtime using the ONNX network.
PasmaHairBakedAsset
Defines the custom Data Asset class that stores baked hair data (painted roots, settings, colors) created by the user in the editor.
PasmaHairModelLocator
A utility class designed to search the project directories for .onnx files or specific imported NNE Model Data assets.
PasmaHairSolver.h
Contains mathematical algorithms and physics logic for hair strand simulation and constraint solving.
PasmaHairTypes.h
A shared header file containing common USTRUCTs and UENUMs (like FPasmaHairSimSettings) used across different classes.

4. Editor Module

Source/Pasma_Engine_Neural_Hair_DynamicsEditor/ — This code runs ONLY in the Unreal Editor. It provides the UI and tools to create/bake hair. It is not included in the shipped game.

Pasma_Engine_Neural_Hair_DynamicsEditor.Build.cs
UBT configuration for the editor module, linking editor-specific dependencies like Slate, UnrealEd, and ToolMenus.
Public/..h / Private/..cpp
Pasma_Engine_Neural_Hair_DynamicsEditor: The editor module entry point. Registers custom UIs, menus, and tools upon engine startup.
Pasma_Engine_Neural_Hair_DynamicsEditorCommands
Defines custom keyboard shortcuts and toolbar/menu commands to launch the hair editor.
SPasmaHairEditorWidget
The core Slate UI widget. This is the custom editor window where users adjust brush sizes, paint hair roots, tweak physics settings, and trigger the baking process.
SPasmaHairPreviewViewport
A custom 3D Slate viewport embedded inside the Editor Widget. It handles drawing the mesh, the painted roots, brush gizmos, and real-time previews of the hair simulation.

🇺🇦 Українська Документація

Цей плагін містить 21 основний файл (за винятком згенерованих бінарників, тимчасових файлів збірки та локальних бекапів). Він розділений на модуль Runtime (компілюється у фінальну гру) та модуль Editor (інструменти виключно для редактора Unreal).

Гайд з першого запуску

1. Активація: Відкрийте браузер плагінів (Edit -> Plugins), знайдіть "Pasma Engine — Neural Hair Dynamics" та увімкніть його.
2. Запуск Редактора: Натисніть вкладку Window (Вікно) на верхній панелі Unreal Engine. Знайдіть у списку "Pasma Hair Editor" (він може бути в самому кінці списку) та відкрийте його.
3. Створення та Запікання: У відкритому нативному редакторі створіть свою симуляцію волосся, малюючи коріння. Після цього натисніть кнопку "Bake & Save Asset". Згенерований дата-ассет з'явиться у теці /Game/PasmaHair/Baked.
4. Додавання Компонента: Відкрийте свого персонажа або інтерактивний об'єкт та додайте кастомний компонент з назвою Pasma Hair Dynamics.
5. Призначення Ассету: У налаштуваннях компонента, в категорії "Asset", оберіть ваш щойно створений запечений ассет.
6. Запуск Гри: Всередині редактора блюпрінтів волосся невидиме задля економії ресурсів. Запустіть гру (кнопка Play), і ви побачите його на об'єкті (якщо тільки ви випадково не розмістили його під землею!).

Огляд Інтерфейсу та Кнопок

Auto Roots
Автоматично генерує сітку коріння волосся на основі ваших налаштувань щільності.
Clear All
Видаляє все намальоване коріння з моделі.
Find ONNX
Автоматично знаходить нейромережеву модель, необхідну для запуску симуляції.
Bake & Save Asset
Запікає та зберігає ваш поточний результат у готовий для гри Data Asset.
Extra Physics (Галочка)
⚠️ ВАЖЛИВО: Це НЕ симуляція штучного інтелекту. Увімкнення цієї опції додає стандартний фізичний рушій Unreal Engine поверх нейромережі. Її НЕ рекомендовано вмикати під час звичайної симуляції, оскільки це може викликати екстремальну нестабільність.

1. Кореневі та Конфігураційні Файли

Pasma_Engine_Neural_Hair_Dynamics.uplugin
Головний файл дескриптора плагіна. Визначає метадані, модулі (Runtime та Editor) та залежності (наприклад, NNERuntimeORT).
Config/FilterPlugin.ini
Файл конфігурації, який вказує, які файли слід включати або виключати під час пакування плагіна.
Resources/Icon128.png / horse_m_icon.png
Стандартні іконки, які використовуються для відображення плагіна в браузері плагінів UE та в кастомному інтерфейсі.

2. Файли Контенту

Content/ONNX_Date/AIHair_Volumetric.uasset
Навчена нейромережа (ONNX модель), імпортована як ассет UE, яка керує волюметричною симуляцією волосся.

3. Модуль Runtime

Source/Pasma_Engine_Neural_Hair_Dynamics/ — Цей код працює у самій грі та пакується у фінальний білд.

Pasma_Engine_Neural_Hair_Dynamics.Build.cs
Скрипт конфігурації Unreal Build Tool (UBT), що визначає залежності модуля (Engine, Core, NNE тощо).
Public/..h / Private/..cpp
Pasma_Engine_Neural_Hair_Dynamics: Головна точка входу модуля. Відповідає за ініціалізацію та вимкнення модуля в рушії.
PasmaHairDynamicsComponent
Головний Actor Component. Додається до персонажів/мешів для динамічної симуляції та рендерингу волосся під час гри (використовуючи ONNX).
PasmaHairBakedAsset
Описує клас кастомного Data Asset, який зберігає запечені дані волосся (намальоване коріння, налаштування, кольори), створені користувачем у редакторі.
PasmaHairModelLocator
Допоміжний клас, призначений для пошуку .onnx файлів або імпортованих NNE ассетів у директоріях проекту.
PasmaHairSolver.h
Містить математичні алгоритми та логіку фізики для симуляції пасом волосся та вирішення обмежень.
PasmaHairTypes.h
Спільний заголовний файл, що містить загальні USTRUCT та UENUM (як-от FPasmaHairSimSettings), які використовуються в різних класах.

4. Модуль Editor

Source/Pasma_Engine_Neural_Hair_DynamicsEditor/ — Цей код працює ТІЛЬКИ в редакторі Unreal. Він надає інтерфейс та інструменти для створення/запікання волосся. У зібрану гру він не потрапляє.

Pasma_Engine_Neural_Hair_DynamicsEditor.Build.cs
UBT конфігурація для модулю редактора, що підключає залежності для UI, такі як Slate, UnrealEd та ToolMenus.
Public/..h / Private/..cpp
Pasma_Engine_Neural_Hair_DynamicsEditor: Точка входу модуля редактора. Реєструє кастомні UI, меню та інструменти під час запуску рушія.
Pasma_Engine_Neural_Hair_DynamicsEditorCommands
Визначає кастомні комбінації клавіш та команди меню/тулбару для запуску редактора волосся.
SPasmaHairEditorWidget
Основний UI віджет (Slate). Це кастомне вікно редактора, де користувачі налаштовують пензлі, малюють коріння волосся, змінюють параметри фізики та запускають процес запікання.
SPasmaHairPreviewViewport
Кастомний 3D в'юпорт (Slate), вбудований у віджет редактора. Він відповідає за відмальовку 3D моделі, коріння, ґізмо пензля та реал-тайм попередній перегляд симуляції волосся.