forked from cgvr/DeltaVR
Compare commits
6 Commits
40cd5060df
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 48b9f12802 | |||
| ad6954884b | |||
| 4292750b65 | |||
| b3073e66df | |||
| afb8af4ee2 | |||
| 16a621c2b9 |
@@ -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.
Binary file not shown.
BIN
Assets/_PROJECT/Scenes/DeltaBuilding_base_copy_2.unity
LFS
Normal file
BIN
Assets/_PROJECT/Scenes/DeltaBuilding_base_copy_2.unity
LFS
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a90a45cf0824d14fb5a2b9f59951013
|
||||
guid: 9e16c783900f92a4c8942f7d34faa968
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
39
Assets/_PROJECT/Scripts/ModeGeneration/ConfigManager.cs
Normal file
39
Assets/_PROJECT/Scripts/ModeGeneration/ConfigManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
11
Assets/_PROJECT/Scripts/ModeGeneration/ConfigManager.cs.meta
Normal file
11
Assets/_PROJECT/Scripts/ModeGeneration/ConfigManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a9ed26713a3c4c4f8f6be3bbd4af5c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_PROJECT/Scripts/ModeGeneration/GameConfig.cs
Normal file
8
Assets/_PROJECT/Scripts/ModeGeneration/GameConfig.cs
Normal 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";
|
||||
}
|
||||
11
Assets/_PROJECT/Scripts/ModeGeneration/GameConfig.cs.meta
Normal file
11
Assets/_PROJECT/Scripts/ModeGeneration/GameConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5412d5465648e6c40bfe932c9098194b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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...");
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
|
||||
14
Assets/_PROJECT/glTFPbrMetallicRoughness.shadervariants
Normal file
14
Assets/_PROJECT/glTFPbrMetallicRoughness.shadervariants
Normal 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: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b852f2aeb9fb71a4aaab9e2d500dc3dc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 20000000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Reference in New Issue
Block a user