Last active
February 22, 2024 02:53
-
-
Save Nobuyuki-Kobayashi/44b9fee09f2985886745ef7121b3e502 to your computer and use it in GitHub Desktop.
Unity:QualitySettings/Shadows内のShadow Distance/Shadow Cascades/Cascade splitsなどをシーンから設定する.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// QualitySettings/Shadows内のShadow Distance/Shadow Cascades/Cascade splitsをシーンから設定する. | |
// | |
// | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
namespace UnityChan | |
{ | |
[ExecuteInEditMode] | |
public class SetShadowQuality : MonoBehaviour { | |
public enum CascadeMode { | |
Zero = 0, | |
Two = 2, | |
Four = 4, | |
} | |
public ShadowProjection shadowProjection = ShadowProjection.CloseFit; | |
public float shadowDistance = 150.0f; | |
public CascadeMode cascadeMode = CascadeMode.Four; | |
public float twoCascadeSetting = 33.3f; | |
public Vector3 fourCascadeSetting = new Vector3(6.7f,13.3f,26.7f); | |
private Vector3 settingFor4Cascades; | |
// Use this for initialization | |
void Start () { | |
} | |
void Update() | |
{ | |
settingFor4Cascades = new Vector3((fourCascadeSetting.x)/100f, | |
(fourCascadeSetting.x + fourCascadeSetting.y)/100f, | |
(fourCascadeSetting.x + fourCascadeSetting.y + fourCascadeSetting.z)/100f); | |
} | |
void LateUpdate () { | |
QualitySettings.shadowProjection = shadowProjection; | |
QualitySettings.shadowDistance = shadowDistance; | |
QualitySettings.shadowCascades = (int)cascadeMode; | |
QualitySettings.shadowCascade2Split = twoCascadeSetting/100f; | |
QualitySettings.shadowCascade4Split = settingFor4Cascades; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment