main
reng 3 months ago
parent 58fd68de91
commit 1f33a4be28
  1. 2
      Assets/Fonts/NotoSansTC-Regular SDF.asset
  2. 33
      Assets/Scenes/SampleScene.unity
  3. 2
      Assets/Scripts/OscHandler.cs
  4. 2
      Assets/Scripts/SetLightStrength.cs
  5. 47
      Assets/Scripts/UploadToGoogleDrive.cs
  6. 9
      Assets/Shaders/Material-light.mat
  7. 6
      Assets/Shaders/blur.shader
  8. 2
      Assets/Textures/DisplayTexture.renderTexture
  9. 6
      Assets/Textures/Postcard Texture.renderTexture
  10. 6
      Assets/Textures/Share Texture.renderTexture
  11. 2
      Assets/Textures/SpoutInputTexture.renderTexture
  12. 2
      Assets/Textures/SpoutOutputTexture.renderTexture
  13. 2
      Assets/Textures/VideoTexture.renderTexture
  14. 2
      Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user
  15. 2
      ProjectSettings/QualitySettings.asset

@ -155,7 +155,7 @@ Material:
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1} - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 1} - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.7294118}
m_BuildTextureStacks: [] m_BuildTextureStacks: []
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:

@ -1117,6 +1117,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 456a47e8e29ccff4b800fc02420f75ad, type: 3} m_Script: {fileID: 11500000, guid: 456a47e8e29ccff4b800fc02420f75ad, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
PrintBrightnessMultiplier: 1.2
renderTexture_postcard: {fileID: 8400000, guid: 35e8ac38ef95d18419a5a58ab9299adf, type: 2} renderTexture_postcard: {fileID: 8400000, guid: 35e8ac38ef95d18419a5a58ab9299adf, type: 2}
renderTexture_share: {fileID: 8400000, guid: 91633495c7c9dd040b09afd52966b6d4, type: 2} renderTexture_share: {fileID: 8400000, guid: 91633495c7c9dd040b09afd52966b6d4, type: 2}
OutputFolder: output OutputFolder: output
@ -1166,8 +1167,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 70, y: 0} m_AnchoredPosition: {x: 122.5, y: 0}
m_SizeDelta: {x: 140, y: 0} m_SizeDelta: {x: 245, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &366298495 --- !u!114 &366298495
MonoBehaviour: MonoBehaviour:
@ -3412,8 +3413,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 511.7143, y: -140} m_AnchoredPosition: {x: 783.4286, y: -245}
m_SizeDelta: {x: 170.57144, y: 0} m_SizeDelta: {x: 261.14288, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &696492449 --- !u!114 &696492449
MonoBehaviour: MonoBehaviour:
@ -3570,9 +3571,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 834012601375dd14aa63a60e116710ea, type: 3} m_Script: {fileID: 11500000, guid: 834012601375dd14aa63a60e116710ea, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
GradientEnd: 0.8 GradientEnd: 1.5
LightPositionY: 1.25 LightPositionY: 1.25
TopColor: {r: 1, g: 0.8584145, b: 0.5801887, a: 0.6666667} TopColor: {r: 1, g: 0.8584145, b: 0.5801887, a: 0.49803922}
BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0} BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0}
--- !u!114 &697235292 --- !u!114 &697235292
MonoBehaviour: MonoBehaviour:
@ -4068,8 +4069,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 106.60715, y: 0} m_AnchoredPosition: {x: 163.2143, y: 0}
m_SizeDelta: {x: 140, y: 0} m_SizeDelta: {x: 245, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &830016229 --- !u!114 &830016229
MonoBehaviour: MonoBehaviour:
@ -4764,8 +4765,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 70, y: 0} m_AnchoredPosition: {x: 122.5, y: 0}
m_SizeDelta: {x: 140, y: 0} m_SizeDelta: {x: 245, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1060364296 --- !u!114 &1060364296
MonoBehaviour: MonoBehaviour:
@ -5308,10 +5309,10 @@ RectTransform:
- {fileID: 555167254} - {fileID: 555167254}
m_Father: {fileID: 1317646465} m_Father: {fileID: 1317646465}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 617.5, y: -70} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 70} m_SizeDelta: {x: 70, y: 0}
m_Pivot: {x: 1, y: 0} m_Pivot: {x: 1, y: 0}
--- !u!114 &1255800684 --- !u!114 &1255800684
MonoBehaviour: MonoBehaviour:
@ -6769,8 +6770,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 319.82144, y: 0} m_AnchoredPosition: {x: 489.64288, y: 0}
m_SizeDelta: {x: 157.5, y: 0} m_SizeDelta: {x: 275.625, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1811530096 --- !u!114 &1811530096
MonoBehaviour: MonoBehaviour:

@ -263,7 +263,7 @@ public class OscHandler : MonoBehaviour
} }
private IEnumerator BreathFade(CanvasGroup canvasGroup, float maxAlpha=1f, float minAlpha=0.33f, private IEnumerator BreathFade(CanvasGroup canvasGroup, float maxAlpha=1f, float minAlpha=0.5f,
float fadeInDuration=1.2f, float fadeOutDuration=1.2f, int cycles=20) float fadeInDuration=1.2f, float fadeOutDuration=1.2f, int cycles=20)
{ {
for (int i = 0; i < cycles; i++) for (int i = 0; i < cycles; i++)

@ -39,7 +39,7 @@ public class SetLightStrength : MonoBehaviour
if (material != null) if (material != null)
{ {
material.SetFloat("_GradientEnd", GradientEnd); material.SetFloat("_GradientEnd", GradientEnd);
material.SetFloat("_LightPositionY", LightPositionY); material.SetVector("_LightPosition", new float4(0.5f, LightPositionY, 0f, 0f));
material.SetColor("_TopColor", TopColor); material.SetColor("_TopColor", TopColor);
material.SetColor("_BottomColor", BottomColor); material.SetColor("_BottomColor", BottomColor);
} }

@ -11,7 +11,7 @@ using Google.Apis.Services;
public class UploadToGoogleDrive : MonoBehaviour public class UploadToGoogleDrive : MonoBehaviour
{ {
public float PrintBrightnessMultiplier = 1.2f;
public class UploadRequest public class UploadRequest
{ {
public string uploadDest; public string uploadDest;
@ -121,17 +121,17 @@ public class UploadToGoogleDrive : MonoBehaviour
discard = discard, discard = discard,
default_image = default_image default_image = default_image
}; };
StartCoroutine(ExportAfterFrame(latest_input)); StartCoroutine(ExportAfterFrame(latest_input));
} }
private IEnumerator ExportAfterFrame(UploadRequest uploadRequest) private IEnumerator ExportAfterFrame(UploadRequest uploadRequest)
{ {
// Wait for the end of the current frame, after all Update and LateUpdate calls have finished. // Wait for the end of the current frame, after all Update and LateUpdate calls have finished.
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
// Now, call the Export function. // Now, call the Export function.
Export(uploadRequest); Export(uploadRequest);
} }
public void Export(UploadRequest uploadRequest = null) public void Export(UploadRequest uploadRequest = null)
{ {
@ -154,7 +154,7 @@ private IEnumerator ExportAfterFrame(UploadRequest uploadRequest)
{ {
return; return;
} }
if (string.IsNullOrEmpty(filename)) if (string.IsNullOrEmpty(filename))
{ {
Debug.LogError("Filename cannot be null or empty."); Debug.LogError("Filename cannot be null or empty.");
@ -196,6 +196,27 @@ private IEnumerator ExportAfterFrame(UploadRequest uploadRequest)
Texture2D tex = new Texture2D(rt.width, rt.height, TextureFormat.RGBA32, false); Texture2D tex = new Texture2D(rt.width, rt.height, TextureFormat.RGBA32, false);
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
// Apply gamma correction (sRGB conversion) to each pixel
for (int y = 0; y < tex.height; y++)
{
for (int x = 0; x < tex.width; x++)
{
Color linearColor = tex.GetPixel(x, y);
Color sRGBColor = new Color(
Mathf.LinearToGammaSpace(linearColor.r),
Mathf.LinearToGammaSpace(linearColor.g),
Mathf.LinearToGammaSpace(linearColor.b),
linearColor.a
);
sRGBColor.r *= PrintBrightnessMultiplier;
                sRGBColor.g *= PrintBrightnessMultiplier;
sRGBColor.b *= PrintBrightnessMultiplier;
tex.SetPixel(x, y, sRGBColor);
}
}
tex.Apply(); tex.Apply();
byte[] bytes = tex.EncodeToPNG(); byte[] bytes = tex.EncodeToPNG();
@ -223,7 +244,7 @@ private IEnumerator ExportAfterFrame(UploadRequest uploadRequest)
void upload(string _uploadFile, string _fileId, string type, bool needToPrint = true) void upload(string _uploadFile, string _fileId, string type, bool needToPrint = true)
{ {
if(GoogleDriveUtils.service == null) if (GoogleDriveUtils.service == null)
{ {
Debug.Log("service is null, setting up service again."); Debug.Log("service is null, setting up service again.");
setupService(); setupService();
@ -250,7 +271,7 @@ private IEnumerator ExportAfterFrame(UploadRequest uploadRequest)
if (type == "print") if (type == "print")
{ {
if(needToPrint) if (needToPrint)
writeToFirebase("prints", System.DateTime.Now.ToString("yyyyMMdd_hhmmss"), url, type); writeToFirebase("prints", System.DateTime.Now.ToString("yyyyMMdd_hhmmss"), url, type);
} }
else else

@ -68,7 +68,7 @@ Material:
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.5 - _Glossiness: 0.5
- _GlossyReflections: 1 - _GlossyReflections: 1
- _GradientEnd: 0.8 - _GradientEnd: 1.5
- _Metallic: 0 - _Metallic: 0
- _Mode: 0 - _Mode: 0
- _NoiseScale1: 12 - _NoiseScale1: 12
@ -78,13 +78,14 @@ Material:
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1
- _Strength: 0.00052288384 - _Strength: 0
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0} - _BottomColor: {r: 0.5377358, g: 0.4067989, b: 0.24096651, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _LightPostion: {r: 0.5, g: 1.5, b: 0, a: 0} - _LightPosition: {r: 0.5, g: 1.25, b: 0, a: 0}
- _TopColor: {r: 1, g: 0.8584145, b: 0.5801887, a: 0.6666667} - _LightPostion: {r: 0.5, g: 1.25, b: 0, a: 0}
- _TopColor: {r: 1, g: 0.8584145, b: 0.58018863, a: 0.49803922}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

@ -9,7 +9,7 @@ Shader "Unlit/LightEffect"
_TopColor("Top Color", Color) = (1,1,1,1) _TopColor("Top Color", Color) = (1,1,1,1)
_BottomColor("Bottom Color", Color) = (0,0,0,0) _BottomColor("Bottom Color", Color) = (0,0,0,0)
_GradientEnd("Gradient End Position", Range(0,1)) = 1 _GradientEnd("Gradient End Position", Range(0,1)) = 1
_LightPostion("Light Position", Vector) = (0.5, 1.0, 0, 0) _LightPosition("Light Position", Vector) = (0.5, 1.0, 0, 0)
_NoiseScale1("Noise Scale 1", Float) = 12.0 _NoiseScale1("Noise Scale 1", Float) = 12.0
_NoiseScale2("Noise Scale 2", Float) = 2.0 _NoiseScale2("Noise Scale 2", Float) = 2.0
} }
@ -45,7 +45,7 @@ Shader "Unlit/LightEffect"
float4 _TopColor; float4 _TopColor;
float4 _BottomColor; float4 _BottomColor;
float _GradientEnd; float _GradientEnd;
float4 _LightPostion; float4 _LightPosition;
float _NoiseScale1; float _NoiseScale1;
float _NoiseScale2; float _NoiseScale2;
@ -102,7 +102,7 @@ Shader "Unlit/LightEffect"
// float t = saturate(i.uv.y / max(_GradientEnd, 0.0001)); // float t = saturate(i.uv.y / max(_GradientEnd, 0.0001));
// float2 center = float2(0.5, 1.0); // float2 center = float2(0.5, 1.0);
float noiseValue = noise(i.uv*_NoiseScale1 + float2(_Time.x*1.3, _Time.y*0.2)); float noiseValue = noise(i.uv*_NoiseScale1 + float2(_Time.x*1.3, _Time.y*0.2));
float2 uvNorm = (i.uv - _LightPostion.xy + 0.1*float2(noiseValue, noiseValue)); float2 uvNorm = (i.uv - _LightPosition.xy + 0.1*float2(noiseValue, noiseValue));
//uvNorm.x /= (_GradientEnd); // scale x to match circle aspect //uvNorm.x /= (_GradientEnd); // scale x to match circle aspect
float dist = 1.0 - length(uvNorm); float dist = 1.0 - length(uvNorm);
// dist=1.0-(pow(1.0 - dist, 2.0)); // Sharpen the edge // dist=1.0-(pow(1.0 - dist, 2.0)); // Sharpen the edge

@ -16,7 +16,7 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 1080 m_Width: 1080
m_Height: 1920 m_Height: 1920
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 94 m_DepthStencilFormat: 94
m_ColorFormat: 8 m_ColorFormat: 8

@ -16,13 +16,13 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 1241 m_Width: 1241
m_Height: 1754 m_Height: 1754
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 94 m_DepthStencilFormat: 94
m_ColorFormat: 4 m_ColorFormat: 8
m_MipMap: 0 m_MipMap: 0
m_GenerateMips: 1 m_GenerateMips: 1
m_SRGB: 1 m_SRGB: 0
m_UseDynamicScale: 0 m_UseDynamicScale: 0
m_BindMS: 0 m_BindMS: 0
m_EnableCompatibleFormat: 1 m_EnableCompatibleFormat: 1

@ -16,13 +16,13 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 1080 m_Width: 1080
m_Height: 1920 m_Height: 1920
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 94 m_DepthStencilFormat: 94
m_ColorFormat: 4 m_ColorFormat: 8
m_MipMap: 0 m_MipMap: 0
m_GenerateMips: 1 m_GenerateMips: 1
m_SRGB: 1 m_SRGB: 0
m_UseDynamicScale: 0 m_UseDynamicScale: 0
m_BindMS: 0 m_BindMS: 0
m_EnableCompatibleFormat: 1 m_EnableCompatibleFormat: 1

@ -16,7 +16,7 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 512 m_Width: 512
m_Height: 512 m_Height: 512
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 94 m_DepthStencilFormat: 94
m_ColorFormat: 59 m_ColorFormat: 59

@ -16,7 +16,7 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 512 m_Width: 512
m_Height: 512 m_Height: 512
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 0 m_DepthStencilFormat: 0
m_ColorFormat: 8 m_ColorFormat: 8

@ -16,7 +16,7 @@ RenderTexture:
serializedVersion: 5 serializedVersion: 5
m_Width: 256 m_Width: 256
m_Height: 256 m_Height: 256
m_AntiAliasing: 1 m_AntiAliasing: 8
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 94 m_DepthStencilFormat: 94
m_ColorFormat: 8 m_ColorFormat: 8

@ -1 +1 @@
{"access_token":"ya29.a0AS3H6NxTo2AL8j0SLr4KTpeYurgScqMCuE-f76GyCxdD0-1XcS0b8UMGj8BBdsZM8OtjghVI2xwidFE0CzXNJB7aIl5upWbCCKNGsTz-yYtmLTYGWP9fZKgyJc_r7ZO_Pi1UjSA4akOofa8Ps2cvtRqFgIT5yOzik5o7fjJF977YBIc5J4jy6MfgPoRFnLculQ3j199baCgYKAR0SARESFQHGX2MiirKW6ocuL43XzDKEwrXDcA0207","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-09-13T11:10:22.416+08:00","IssuedUtc":"2025-09-13T03:10:22.416Z"} {"access_token":"ya29.a0AS3H6NyFVBEDi4XN5hswszzpP642SUWFSALfzA-Zn_xxA-BHd6sARV6_4xdwPOU6eq-FCYc-PTrMa1is1XXkuigjg66gluYqUdYgs3ai_mNgMY0q49nWBy9fE-jgH8F0lT9ZAaPyZomCnw-EKZZ2fmjvQIS3BsrtbLuBnXlaLlKz7smNPYn3oNzKxp6xDIZkFzRRBnhwaCgYKAWwSARESFQHGX2MitZVeQGetQ96x8A2Pd4z2_g0207","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-09-13T18:25:08.132+08:00","IssuedUtc":"2025-09-13T10:25:08.132Z"}

@ -267,7 +267,7 @@ QualitySettings:
globalTextureMipmapLimit: 0 globalTextureMipmapLimit: 0
textureMipmapLimitSettings: [] textureMipmapLimitSettings: []
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 2 antiAliasing: 8
softParticles: 1 softParticles: 1
softVegetation: 1 softVegetation: 1
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1

Loading…
Cancel
Save