GPU优化

This commit is contained in:
SoulliesOfficial
2026-04-06 09:32:56 -04:00
parent 1bc9af280b
commit f4068baf4a
108 changed files with 2813 additions and 1073 deletions

View File

@@ -14,6 +14,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
public float timeAngle = 0.1f;
public float stepA = 0.25f;
public float stepB = 0.24f;
public float baseSpeed = 0.2f;
public bool enableOuterBorder = true;
public float outerBorderColorR = 1f;
@@ -32,7 +33,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
public DTMRandomGridFloor_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
string themeBundleName, string objectName, bool isStatic,
float patternSizeX, float patternSizeY, float gridDensity,
float timeAngle, float stepA, float stepB,
float timeAngle, float stepA, float stepB, float baseSpeed,
bool enableOuterBorder, Color outerColor, float outerBorderWidth,
float fadeFar = 100f, float fadeNear = 20f)
: base(elementName, elementGuid, tags, attachedElement, themeBundleName, objectName, isStatic)
@@ -43,7 +44,8 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
this.timeAngle = timeAngle;
this.stepA = stepA;
this.stepB = stepB;
this.baseSpeed = baseSpeed;
this.enableOuterBorder = enableOuterBorder;
this.outerBorderColorR = outerColor.r;
this.outerBorderColorG = outerColor.g;
@@ -62,7 +64,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
matchedElement = DTMRandomGridFloor.GenerateElement(elementName, elementGuid, tags, false,
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic,
patternSizeX, patternSizeY, gridDensity,
timeAngle, stepA, stepB,
timeAngle, stepA, stepB, baseSpeed,
enableOuterBorder, outerColor, outerBorderWidth,
fadeFar, fadeNear);
}

View File

@@ -13,8 +13,9 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
public float gridDensity = 1.0f;
public float timeAngle = 1.0f;
public float stepA = 0.293f;
public float stepB = 0.345f;
public float stepA = 0.25f;
public float stepB = 0.24f;
public float baseSpeed = 0.2f;
public float seamRotation = -90f;
public float seamFadeWidth = 0.2f;
@@ -29,7 +30,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
matchedElement = DTMRandomGridTube.GenerateElement(elementName, elementGuid, tags, false,
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic,
patternSizeX, patternSizeY, gridDensity, timeAngle,
stepA, stepB,
stepA, stepB, baseSpeed,
seamRotation, seamFadeWidth, seamFadeSmoothness,
fadeFar, fadeNear, tubeRadius);
}

View File

@@ -11,6 +11,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public float patternSizeX;
public float patternSizeY;
public float gridDensity;
public float baseSpeed;
public float timeAngle;
public float stepA;
public float stepB;
@@ -30,7 +31,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
bool isStatic,
float patternSizeX, float patternSizeY, float gridDensity,
float timeAngle, float stepA, float stepB,
float timeAngle, float stepA, float stepB,float baseSpeed,
bool enableOuterBorder,
Color outerBorderColor,
float outerBorderWidth,
@@ -46,6 +47,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
randomGridFloor.timeAngle = timeAngle;
randomGridFloor.stepA = stepA;
randomGridFloor.stepB = stepB;
randomGridFloor.baseSpeed = baseSpeed;
randomGridFloor.enableOuterBorder = enableOuterBorder;
randomGridFloor.outerBorderColor = outerBorderColor;
@@ -86,6 +88,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
mat.SetVector("_PatternSize", new Vector4(patternSizeX, patternSizeY, 0, 0));
mat.SetFloat("_GridDensity", gridDensity);
mat.SetFloat("_TimeAngle", timeAngle);
mat.SetFloat("_BaseSpeed", baseSpeed);
mat.SetFloat("_StepA", stepA);
mat.SetFloat("_StepB", stepB);

View File

@@ -8,21 +8,22 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
public partial class DTMRandomGridTube : EnvironmentObject
{
#region [] Exposed Fields
public float patternSizeX = 2.0f;
public float patternSizeY = 2.0f;
public float gridDensity = 1.0f;
public float timeAngle = 1.0f;
public float patternSizeX;
public float patternSizeY;
public float gridDensity;
public float timeAngle;
public float stepA = 0.293f;
public float stepB = 0.345f;
public float stepA;
public float stepB;
public float baseSpeed;
public float seamRotation = -90f;
public float seamFadeWidth = 0.2f;
public float seamFadeSmoothness = 1.0f;
public float seamRotation;
public float seamFadeWidth;
public float seamFadeSmoothness;
public float fadeFar = 100f;
public float fadeNear = 20f;
public float tubeRadius = 10f;
public float fadeFar;
public float fadeNear;
public float tubeRadius;
public Renderer meshRenderer;
#endregion
@@ -32,7 +33,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
bool isStatic,
float patternSizeX, float patternSizeY, float gridDensity,
float timeAngle, float stepA, float stepB,
float timeAngle, float stepA, float stepB, float baseSpeed,
float seamRotation, float seamFadeWidth, float seamFadeSmoothness,
float fadeFar, float fadeNear, float tubeRadius)
{
@@ -46,6 +47,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
randomGridTube.stepA = stepA;
randomGridTube.stepB = stepB;
randomGridTube.baseSpeed = baseSpeed;
randomGridTube.seamRotation = seamRotation;
randomGridTube.seamFadeWidth = seamFadeWidth;
@@ -94,6 +96,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
mat.SetFloat("_StepA", stepA);
mat.SetFloat("_StepB", stepB);
mat.SetFloat("_BaseSpeed", baseSpeed);
mat.SetFloat("_SeamRotation", seamRotation);
mat.SetFloat("_SeamFadeWidth", seamFadeWidth);

View File

@@ -94,7 +94,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
// 实例化所有材质(避免修改共享材质)
foreach (var rend in renderers)
{
rend.InitializeShader();
//rend.InitializeShader();
}
sparks.gameObject.SetActive(false);
@@ -132,6 +132,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
base.Refresh();
Color baseColor = colorSubmodule.currentBaseColor;
Color emissionColor = colorSubmodule.GetCurrentEmissionColor();
// --- 粒子系统颜色 ---
// headPoint 和 sparksS 降至 baseColor 的四分之一
@@ -146,6 +147,11 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
var main = ps.main;
main.startColor = desaturatedColor;
var customData = ps.customData;
customData.SetVector(ParticleSystemCustomData.Custom1, 0, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.r));
customData.SetVector(ParticleSystemCustomData.Custom1, 1, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.g));
customData.SetVector(ParticleSystemCustomData.Custom1, 2, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.b));
customData.SetVector(ParticleSystemCustomData.Custom1, 3, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionIntensity));
}
}
@@ -156,6 +162,11 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
var main = ps.main;
main.startColor = desaturatedColor;
var customData = ps.customData;
customData.SetVector(ParticleSystemCustomData.Custom1, 0, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.r));
customData.SetVector(ParticleSystemCustomData.Custom1, 1, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.g));
customData.SetVector(ParticleSystemCustomData.Custom1, 2, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.b));
customData.SetVector(ParticleSystemCustomData.Custom1, 3, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionIntensity));
}
}
@@ -167,6 +178,11 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
var main = ps.main;
main.startColor = baseColor;
var customData = ps.customData;
customData.SetVector(ParticleSystemCustomData.Custom1, 0, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.r));
customData.SetVector(ParticleSystemCustomData.Custom1, 1, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.g));
customData.SetVector(ParticleSystemCustomData.Custom1, 2, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionColor.b));
customData.SetVector(ParticleSystemCustomData.Custom1, 3, new ParticleSystem.MinMaxCurve(colorSubmodule.currentEmissionIntensity));
}
}
@@ -176,22 +192,7 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
Gradient combinedGradient = BuildTrailColorGradient(baseColor, trailAlphaGradient);
trailRenderer.colorGradient = combinedGradient;
}
// --- BlendUnlit Renderer 材质属性BaseColor + EmissionColor---
Color emissionColor = colorSubmodule.GetCurrentEmissionColor();
foreach (var rend in renderers)
{
if (rend == null) continue;
if (colorSubmodule.emissionEnabled)
{
rend.material.EnableKeyword("_EMISSION_ON");
rend.material.SetColor("_EmissionColor", emissionColor);
}
else
{
rend.material.DisableKeyword("_EMISSION_ON");
}
trailRenderer.material.SetColor("_EmissionColor", emissionColor);
}
}