1
0
forked from cgvr/DeltaVR

6 Commits

Author SHA1 Message Date
48b9f12802 make copy of main scene 2026-01-25 12:11:53 +02:00
ad6954884b trellis and invokeAI urls configurable in config 2026-01-19 18:55:25 +02:00
4292750b65 update TODO 2026-01-17 08:30:25 +00:00
b3073e66df update TODO 2026-01-16 18:33:48 +00:00
afb8af4ee2 unique seed for model generation 2026-01-16 18:35:00 +02:00
16a621c2b9 include gltf shader in build + add TODO list 2026-01-16 18:26:37 +02:00
14 changed files with 115 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
### TODO
* glTF loading: vahetada ära shader Universal render pipelin Lit, mitte panna buildi kaasa glTf oma
* shape scanner initialisation correct number of confs
* user flow: grab item? mida krabada
* user prefs: settinguid meelde jätta
@@ -10,7 +11,6 @@
* mitte lihtsalt ontriggerenter ja -exit, sest kui mitu objekti lähevad samal ajal sisse
* mustad kiired on halvasti nähtavad pruuni materjali taustal
* kui üks config completed, siis mängijale aru saada: sound effect, "loading"
* mudeli genereerimine: randomly generated unique seed, mitte 42
* mikri vana tekst ei kao ära
* archery range:
* kui midagi laeb (wire aktiivne), siis particle'id voolavad mööda toru
@@ -21,8 +21,8 @@
* klaas on näha temast eespool
* pööramine kaamera poole - sujuvalt (slerp)
* küsida Danielilt asukoha kohta
* proovida läppari peal käima saada
### Notes
* TRELLIS: added functionality to specify texture baking optimisation total steps as an argument (`texture_opt_total_steps`), to replace the hardcoded 2500. But this is not tracked in Git (because modified this https://github.com/IgorAherne/trellis-stable-projectorz/releases/tag/latest)
* Custom Shader Variant Collection to include glTF-pbrMetallicRoughness shader in build

Binary file not shown.

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8a90a45cf0824d14fb5a2b9f59951013
guid: 9e16c783900f92a4c8942f7d34faa968
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,39 @@
using System.IO;
using UnityEngine;
public class ConfigManager : MonoBehaviour
{
public GameConfig Config { get; private set; }
public static ConfigManager Instance { get; private set; }
private static string configPath => Path.Combine(Application.persistentDataPath, "config.json");
private void Awake()
{
Instance = this;
LoadConfig();
}
public void LoadConfig()
{
if (File.Exists(configPath))
{
string json = File.ReadAllText(configPath);
Config = JsonUtility.FromJson<GameConfig>(json);
}
else
{
// Create config with default values
Config = new GameConfig();
SaveConfig();
}
Debug.Log("Loaded config from: " + configPath);
}
public void SaveConfig()
{
string json = JsonUtility.ToJson(Config, true);
File.WriteAllText(configPath, json);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6a9ed26713a3c4c4f8f6be3bbd4af5c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
[System.Serializable]
public class GameConfig
{
public string invokeAIUrl = "http://192.168.0.53:9090";
public string invokeAIModelKey = "81d45960-08a0-4b8c-a48b-e7d73b21bfe2";
public string TrellisUrl = "http://192.168.0.53:7960";
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5412d5465648e6c40bfe932c9098194b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -14,9 +14,7 @@ public class InvokeAiClient : MonoBehaviour
{
public static InvokeAiClient Instance { get; private set; }
public string INVOKEAI_BASE_URL;
public string DEFAULT_QUEUE_ID = "default";
public string MODEL_KEY;
public string promptSuffix = ", single object, front and side fully visible, realistic style, plain neutral background, clear details, soft studio lighting, true-to-scale";
private HttpClient httpClient;
@@ -27,7 +25,7 @@ public class InvokeAiClient : MonoBehaviour
{
Timeout = TimeSpan.FromSeconds(120)
};
httpClient.BaseAddress = new Uri(INVOKEAI_BASE_URL);
httpClient.BaseAddress = new Uri(ConfigManager.Instance.Config.invokeAIUrl);
Instance = this;
}
@@ -520,13 +518,14 @@ public class InvokeAiClient : MonoBehaviour
public async Task<byte[]> GenerateImage(string prompt)
{
string modelKey = ConfigManager.Instance.Config.invokeAIModelKey;
string refinedPrompt = prompt + promptSuffix;
JObject args = new JObject()
{
["prompt"] = refinedPrompt,
["width"] = 512,
["height"] = 512,
["model_key"] = MODEL_KEY,
["model_key"] = modelKey,
};
UnityEngine.Debug.Log("Starting image generation...");

View File

@@ -2,7 +2,6 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
@@ -10,16 +9,16 @@ public class TrellisClient : MonoBehaviour
{
public static TrellisClient Instance { get; private set; }
public string TRELLIS_BASE_URL;
private HttpClient httpClient;
private void Awake()
{
httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(TRELLIS_BASE_URL);
httpClient.BaseAddress = new Uri(ConfigManager.Instance.Config.TrellisUrl);
Instance = this;
TestConnection();
}
// Start is called before the first frame update
@@ -34,12 +33,19 @@ public class TrellisClient : MonoBehaviour
}
private async void TestConnection()
{
var statusResp = await httpClient.GetAsync("status");
Debug.Log("Trellis status: " + statusResp.StatusCode);
}
public async Task<byte[]> GenerateModel(
string imageBase64,
int seed = 42,
int pollIntervalMs = 1000)
{
int seed = UnityEngine.Random.Range(0, 999999);
// --- Set generation parameters (form-encoded, like Python requests.post(data=params)) ---
var form = new Dictionary<string, string>
{

View File

@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!200 &20000000
ShaderVariantCollection:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: glTFPbrMetallicRoughness
m_Shaders:
- first: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122,
type: 3}
second:
variants: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b852f2aeb9fb71a4aaab9e2d500dc3dc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 20000000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.