Browse Source

updated projection 360 code

main
cailean 9 months ago
parent
commit
b04d4e10a0
  1. 10
      Assets/10_URPEquirectangularCamera/CubeMapMat.mat
  2. 13
      Assets/10_URPEquirectangularCamera/CubemapCamera.prefab
  3. 13
      Assets/10_URPEquirectangularCamera/Scripts/ShaderManiuplation.cs
  4. 19
      Assets/6_Scenes/Beep.unity
  5. 8
      Assets/7_Scripts/Recording/RenderText.cs

10
Assets/10_URPEquirectangularCamera/CubeMapMat.mat

@ -21,7 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: CubeMapMat m_Name: CubeMapMat
m_Shader: {fileID: 4800000, guid: 6f992fe900ba1b54980ea05599f47164, type: 3} m_Shader: {fileID: 4800000, guid: a97045f26d2947649b9d75d57ac0b255, type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -108,10 +108,10 @@ Material:
- _DivideY: 3.5 - _DivideY: 3.5
- _DstBlend: 0 - _DstBlend: 0
- _EnvironmentReflections: 1 - _EnvironmentReflections: 1
- _EquiRotation: 0.125 - _EquiRotation: 3.5
- _EquiRotationY: 5.13 - _EquiRotationY: 0.85
- _FOVScale_X: 1.5 - _FOVScale_X: 0.9
- _FOVScale_Y: 0.2 - _FOVScale_Y: 0.3
- _FocalLength: 2.73 - _FocalLength: 2.73
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0

13
Assets/10_URPEquirectangularCamera/CubemapCamera.prefab

@ -389,12 +389,15 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 933460690440954431} m_GameObject: {fileID: 933460690440954431}
m_Enabled: 0 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 376cbea962fc8f945b32baff202fbc5e, type: 3} m_Script: {fileID: 11500000, guid: 376cbea962fc8f945b32baff202fbc5e, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Direction: 0 m_Direction: 1
m_ProjectionType: 1 m_ProjectionType: 0
m_GnomicCameraHeight: -20 m_GnomicCameraHeight: -25
m_SqueezedCameraHeight: 0 m_SqueezedCameraHeight: -25
m_SqueezedResolutionIndex: 21
m_GnomiocResolutionIndexLarge: 0
m_GnomiocResolutionIndexSmall: 0

13
Assets/10_URPEquirectangularCamera/Scripts/ShaderManiuplation.cs

@ -40,6 +40,10 @@ public class ShaderManiuplation : MonoBehaviour
public float m_GnomicCameraHeight; public float m_GnomicCameraHeight;
public float m_SqueezedCameraHeight; public float m_SqueezedCameraHeight;
public int m_SqueezedResolutionIndex = 0;
public int m_GnomiocResolutionIndexLarge = 0;
public int m_GnomiocResolutionIndexSmall = 0;
// Game View Parameters // Game View Parameters
Type gameView; Type gameView;
PropertyInfo selectedSizeIndex; PropertyInfo selectedSizeIndex;
@ -59,11 +63,11 @@ public class ShaderManiuplation : MonoBehaviour
if (m_ProjectionType == ProjectionType.Squeeze) if (m_ProjectionType == ProjectionType.Squeeze)
{ {
SetShaderSqueezed(21, 0.85f, 2.5f, 3.5f, 4f, m_SqueezedCameraHeight); SetShaderSqueezed(m_SqueezedResolutionIndex, 0.85f, 2.5f, 3.5f, 4f, m_SqueezedCameraHeight);
} }
else if (m_ProjectionType == ProjectionType.Gnomic) else if (m_ProjectionType == ProjectionType.Gnomic)
{ {
SetShaderGnomic(28, 1.5f, 0.2f, 5.13f, 0.125f, m_GnomicCameraHeight); SetShaderGnomic(m_GnomiocResolutionIndexLarge, 1.5f, 0.2f, 5.13f, 0.125f, m_GnomicCameraHeight);
} }
} }
} }
@ -86,14 +90,14 @@ public class ShaderManiuplation : MonoBehaviour
if (m_Direction == EquilateralDirection.Left || m_Direction == EquilateralDirection.Right) if (m_Direction == EquilateralDirection.Left || m_Direction == EquilateralDirection.Right)
{ {
ChangeGameViewResolution(29); ChangeGameViewResolution(m_GnomiocResolutionIndexLarge);
xFOV = 0.9f; xFOV = 0.9f;
yFOV = 0.3f; yFOV = 0.3f;
yRotation = 5.23f; yRotation = 5.23f;
} }
else else
{ {
ChangeGameViewResolution(resolutionPreset); ChangeGameViewResolution(m_GnomiocResolutionIndexSmall);
} }
mat.SetFloat("_EquiRotation", xRotation + SetDirection()); mat.SetFloat("_EquiRotation", xRotation + SetDirection());
@ -157,7 +161,6 @@ public class ShaderManiuplation : MonoBehaviour
void ChangeGameViewResolution(int index) void ChangeGameViewResolution(int index)
{ {
Debug.Log($"{index}");
selectedSizeIndex.SetValue(window, index, null); selectedSizeIndex.SetValue(window, index, null);
} }

19
Assets/6_Scenes/Beep.unity

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 7710.423, g: 8946.3955, b: 9699.29, a: 1} m_IndirectSpecularColor: {r: 7710.4307, g: 8946.3955, b: 9699.29, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -2760,7 +2760,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 513050371} m_GameObject: {fileID: 513050371}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.11070082, y: 0.8887488, z: -0.29751557, w: 0.3306893} m_LocalRotation: {x: 0.110700816, y: 0.88874876, z: -0.29751557, w: 0.3306893}
m_LocalPosition: {x: 5.3480835, y: -3.2973547, z: 10.518677} m_LocalPosition: {x: 5.3480835, y: -3.2973547, z: 10.518677}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -4878,7 +4878,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!4 &834841056 --- !u!4 &834841056
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7011,16 +7011,6 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 834841056} m_TransformParent: {fileID: 834841056}
m_Modifications: m_Modifications:
- target: {fileID: 723609760478697510, guid: 547378ae4bbaf4b4ba24e3243bcd0838,
type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 723609760478697510, guid: 547378ae4bbaf4b4ba24e3243bcd0838,
type: 3}
propertyPath: m_GnomicCameraHeight
value: -25
objectReference: {fileID: 0}
- target: {fileID: 933460690407818085, guid: 547378ae4bbaf4b4ba24e3243bcd0838, - target: {fileID: 933460690407818085, guid: 547378ae4bbaf4b4ba24e3243bcd0838,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -7099,7 +7089,7 @@ PrefabInstance:
- target: {fileID: 933460690440954431, guid: 547378ae4bbaf4b4ba24e3243bcd0838, - target: {fileID: 933460690440954431, guid: 547378ae4bbaf4b4ba24e3243bcd0838,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
@ -8817,6 +8807,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_CaptureFrameRate: 30 m_CaptureFrameRate: 30
m_YHeight: 0
outputDirectory: SampleRecordings/Projection outputDirectory: SampleRecordings/Projection
texture: {fileID: 0} texture: {fileID: 0}
m_ProjectionType: 3 m_ProjectionType: 3

8
Assets/7_Scripts/Recording/RenderText.cs

@ -1,3 +1,4 @@
using NUnit.Framework;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -10,6 +11,7 @@ public class RenderText : MonoBehaviour
{ {
int frame = 60; int frame = 60;
public int m_CaptureFrameRate; public int m_CaptureFrameRate;
public float m_YHeight = 0;
public string outputDirectory = "SampleRecordings/Projection"; public string outputDirectory = "SampleRecordings/Projection";
[HideInInspector] [HideInInspector]
@ -19,8 +21,6 @@ public class RenderText : MonoBehaviour
public bool m_Record = false; public bool m_Record = false;
int txt_W; int txt_W;
int txt_H; int txt_H;
@ -197,7 +197,7 @@ public class RenderText : MonoBehaviour
void CycleThroughOrientations(int frameCount, float m_HeightY) void CycleThroughOrientations(int frameCount, float m_HeightY)
{ {
m_CubeMapPrefab.transform.localPosition = new Vector3(m_CubeMapPrefab.transform.localPosition.x, m_HeightY, m_CubeMapPrefab.transform.localPosition.z); m_CubeMapPrefab.transform.localPosition = new Vector3(m_CubeMapPrefab.transform.localPosition.x, m_YHeight, m_CubeMapPrefab.transform.localPosition.z);
if (m_ProjectionType != ProjectionType.CroppedFOV) if (m_ProjectionType != ProjectionType.CroppedFOV)
{ {
material.SetFloat("_EquiRotation", x_Rotation * frameCount); material.SetFloat("_EquiRotation", x_Rotation * frameCount);
@ -311,7 +311,7 @@ public class RenderText : MonoBehaviour
m_Record = true; m_Record = true;
} }
if (Input.GetKeyUp(KeyCode.S)) if (Input.GetKeyUp(KeyCode.T))
{ {
m_Record = false; m_Record = false;
} }

Loading…
Cancel
Save