1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2025-01-18 17:14:11 +01:00

fix vr camera issue; add 2nd tab to setting panel

This commit is contained in:
xpeng 2022-08-18 23:17:30 +02:00
parent 046ea77166
commit d2dfe88b46
19 changed files with 3330 additions and 107 deletions

View File

@ -41,7 +41,7 @@ LightingSettings:
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 64
m_PVRSampleCount: 96
m_PVRSampleCount: 128
m_PVREnvironmentSampleCount: 8
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 KiB

After

Width:  |  Height:  |  Size: 507 KiB

View File

@ -5,14 +5,7 @@ public class CameraSmooth : MonoBehaviour {
public Transform target;
public float smoothSpeed = 0.1f;
public Vector3 PositionOffset;
public int FPS = 60;
float elapsed;
Camera cam;
private void Start()
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = FPS;
}
void Update ()
{
transform.position = Vector3.Lerp(transform.position, target.position + PositionOffset, smoothSpeed);

View File

@ -0,0 +1,52 @@
using UnityEngine.UI;
using System.Collections.Generic;
using UnityEngine;
public class HapticSettingManager : MonoBehaviour
{
public List<Controllers> Controllers;
Slider Slider;
void Start()
{
Slider = GetComponent<Slider>();
switch (gameObject.name)
{
case "HpDuration":
GetHapticDuration();
break;
case "HpAmplitude":
GetHapticAmplitude();
break;
}
}
void GetHapticDuration()
{
if (JsonConfig.HasKey("HapticDuration"))
Slider.value = (float)JsonConfig.GetDouble("HapticDuration");
SetHapticDuration(Slider.value);
}
void GetHapticAmplitude()
{
if (JsonConfig.HasKey("HapticAmplitude"))
Slider.value = (float)JsonConfig.GetDouble("HapticAmplitude") * 10;
SetHapticAmplitude(Slider.value);
}
public void SetHapticDuration(float duration)
{
foreach (var controller in Controllers)
{
controller.duration = duration;
}
JsonConfig.SetDouble("HapticDuration", duration);
}
public void SetHapticAmplitude(float amplitude)
{
amplitude /= 10;
foreach (var controller in Controllers)
{
controller.amplitude = amplitude;
}
JsonConfig.SetDouble("HapticAmplitude", amplitude);
}
}

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LightSettingManager : MonoBehaviour
{
public List<Light> Lights;
public void OnStateChanges(bool isOn)
{
foreach (var light in Lights)
{
light.enabled = isOn;
}
}
}

View File

@ -46,6 +46,7 @@ public class NoneVRSettingManager : MonoBehaviour
}
public void GetNVRFPS()
{
QualitySettings.vSyncCount = 0;
if (JsonConfig.HasKey("NVRFPS"))
Dropdown.value = JsonConfig.GetInt("NVRFPS");
SetNVRFPS();
@ -65,14 +66,17 @@ public class NoneVRSettingManager : MonoBehaviour
switch (Dropdown.value)
{
case 0:
NVRCameraObj.SetActive(false);
if (NVRCameraObj.activeSelf)
NVRCameraObj.SetActive(false);
break;
case 1:
NVRCameraObj.SetActive(true);
if (!NVRCameraObj.activeSelf)
NVRCameraObj.SetActive(true);
CameraSmooth.target = NVRCameraTargetFP;
break;
case 2:
NVRCameraObj.SetActive(true);
if (!NVRCameraObj.activeSelf)
NVRCameraObj.SetActive(true);
CameraSmooth.target = NVRCameraTargetTP;
break;
}
@ -88,25 +92,25 @@ public class NoneVRSettingManager : MonoBehaviour
switch (Dropdown.value)
{
case 0:
CameraSmooth.FPS = 15;
Application.targetFrameRate = 15;
break;
case 1:
CameraSmooth.FPS = 30;
Application.targetFrameRate = 30;
break;
case 2:
CameraSmooth.FPS = 45;
Application.targetFrameRate = 45;
break;
case 3:
CameraSmooth.FPS = 60;
Application.targetFrameRate = 60;
break;
case 4:
CameraSmooth.FPS = 90;
Application.targetFrameRate = 90;
break;
case 5:
CameraSmooth.FPS = 120;
Application.targetFrameRate = 120;
break;
case 6:
CameraSmooth.FPS = 144;
Application.targetFrameRate = 144;
break;
}
JsonConfig.SetInt("NVRFPS", Dropdown.value);

View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TabManager : MonoBehaviour
{
public GameObject Tab1Object;
public GameObject Tab2Object;
void Start()
{
OnTab1Click();
}
public void OnTab1Click()
{
Tab1Object.SetActive(true);
Tab2Object.SetActive(false);
}
public void OnTab2Click()
{
Tab1Object.SetActive(false);
Tab2Object.SetActive(true);
}
}

View File

@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class TouchSettingManager : MonoBehaviour
{
TMP_Dropdown Dropdown;
void Start()
{
Dropdown = GetComponent<TMP_Dropdown>();
GetTouchFPS();
}
void GetTouchFPS()
{
if (JsonConfig.HasKey("TouchFPS"))
Dropdown.value = JsonConfig.GetInt("TouchFPS");
SetTouchFPS();
}
public void SetTouchFPS()
{
switch (Dropdown.value)
{
case 0:
Time.fixedDeltaTime = 1 / 30;
break;
case 1:
Time.fixedDeltaTime = 1 / 60;
break;
case 2:
Time.fixedDeltaTime = 1 / 90;
break;
case 3:
Time.fixedDeltaTime = 1 / 120;
break;
case 4:
Time.fixedDeltaTime = 1 / 140;
break;
case 5:
Time.fixedDeltaTime = 1 / 160;
break;
case 6:
Time.fixedDeltaTime = 1 / 180;
break;
case 7:
Time.fixedDeltaTime = 1 / 200;
break;
}
JsonConfig.SetInt("TouchFPS", Dropdown.value);
}
}

View File

@ -55,4 +55,4 @@ MonoBehaviour:
m_AccurateGbufferNormals: 0
m_ClusteredRendering: 0
m_TileSize: 32
m_IntermediateTextureMode: 0
m_IntermediateTextureMode: 1

View File

@ -28,32 +28,32 @@ MonoBehaviour:
m_MSAA: 1
m_RenderScale: 1
m_UpscalingFilter: 3
m_FsrOverrideSharpness: 1
m_FsrSharpness: 1
m_MainLightRenderingMode: 0
m_MainLightShadowsSupported: 0
m_MainLightShadowmapResolution: 1024
m_FsrOverrideSharpness: 0
m_FsrSharpness: 0.92
m_MainLightRenderingMode: 1
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 2048
m_AdditionalLightsRenderingMode: 1
m_AdditionalLightsPerObjectLimit: 0
m_AdditionalLightShadowsSupported: 0
m_AdditionalLightsShadowmapResolution: 512
m_AdditionalLightsShadowResolutionTierLow: 128
m_AdditionalLightsShadowResolutionTierMedium: 256
m_AdditionalLightsShadowResolutionTierHigh: 512
m_AdditionalLightsShadowmapResolution: 2048
m_AdditionalLightsShadowResolutionTierLow: 256
m_AdditionalLightsShadowResolutionTierMedium: 512
m_AdditionalLightsShadowResolutionTierHigh: 1024
m_ReflectionProbeBlending: 0
m_ReflectionProbeBoxProjection: 0
m_ShadowDistance: 25
m_ShadowDistance: 50
m_ShadowCascadeCount: 1
m_Cascade2Split: 0.25
m_Cascade3Split: {x: 0.1, y: 0.3}
m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467}
m_CascadeBorder: 0.1
m_CascadeBorder: 0.2
m_ShadowDepthBias: 1
m_ShadowNormalBias: 1
m_SoftShadowsSupported: 0
m_ConservativeEnclosingSphere: 0
m_NumIterationsEnclosingSphere: 64
m_AdditionalLightsCookieResolution: 1024
m_AdditionalLightsCookieResolution: 2048
m_AdditionalLightsCookieFormat: 3
m_UseSRPBatcher: 1
m_SupportsDynamicBatching: 0
@ -62,7 +62,7 @@ MonoBehaviour:
m_DebugLevel: 0
m_UseAdaptivePerformance: 1
m_ColorGradingMode: 0
m_ColorGradingLutSize: 16
m_ColorGradingLutSize: 32
m_UseFastSRGBLinearConversion: 0
m_ShadowType: 1
m_LocalShadowsSupported: 0

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -144,6 +144,11 @@ PlayerSettings:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

View File

@ -24,9 +24,7 @@ Open Source VR Arcade Simulator
- https://github.com/Sucareto/Mai2Touch
## Build requirements
- Current Unity version: 2020.3.30f1
- [InputSimulator](https://www.nuget.org/packages/InputSimulator) (You need to extract the .dll file and put it in to assets folder)
- [uWindowCapture](https://github.com/hecomi/uWindowCapture) (just import/install it on your unity project)
- Current Unity version: 2021.3.2f1
## Supported platform
- All SteamVR device
@ -62,7 +60,7 @@ HandSize, HandPosition, PlayerHigh: in CM
CaptureFrameRate, TouchRefreshRate: in FPS
Capture1PlayerOnly: true (9:16 aspect ratio) or false (default) (2*9:16 aspect ratio)
Capture1P: true (9:16 aspect ratio) or false (default) (2*9:16 aspect ratio)
CameraSmooth: 0.0 - 1.0, 1.0 = no smoothing
@ -72,8 +70,6 @@ CameraPosition: in M
To enable 3rd person mod: set CameraSmooth to 0 then move your headset to where your camera wants to be. Then focus/select MaiDXR window to lock position. You can show your head by enabling the setting below.
ShowHeadCube: true or false
HapticDuration: in second
HapticAmplitude: 0.0 - 1.0, 1.0 = max vibration
@ -89,11 +85,12 @@ SelectButton and Button(1-4: top to bottom): Pls see [VK Code](https://docs.micr
- √ Add button light
- √ Add button vibration
- √ Add 3rd person camera
- Add 2p
- √ Add 2p
- Add Multiplay
- √ Add custom button
- √ Support 1p only capture
- Add visual touch and button feedback
- Add in game setting panel
- Add in game setting panel
Huge thanks to HelloKS and derole1