feat: HouseOfLeaves synchro & moving blocs

This commit is contained in:
Alexandre Coirier
2026-06-16 18:00:59 +02:00
parent de466efa05
commit e88717bbd2
8 changed files with 8801 additions and 157 deletions
@@ -117,7 +117,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Progression: 0.84
- _Progression: 0.73
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,110 @@
fileFormatVersion: 2
guid: 18535463c48e03645a59cf6275b6a1d2
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 0
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
generateMeshLods: 0
meshLodGenerationFlags: 0
maximumMeshLod: -1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+88 -2
View File
@@ -1,12 +1,98 @@
using OctoCore.Components;
using UnityEngine;
public class SandController : MonoBehaviour
{
[System.Serializable]
public class References
{
public Renderer SandRenderer;
public float Duration = 15;
public Transform[] GlitchBlocksLeft;
public Transform[] GlitchBlocksRight;
public Transform[] GlitchBlocksTop;
}
[System.Serializable]
public class Settings
{
public float Duration = 25;
public float Delay = 2;
}
[SerializeField] private References _references;
[SerializeField] private Settings _settings;
private float _time;
private Vector3[] _movesMultiplier = new Vector3[3] { Vector3.left, Vector3.right, Vector3.up };
private Vector3[] _movesOffset = new Vector3[3] { new Vector3(-2.02f, 1.5f, 0), new Vector3(2.02f, 1.5f, 0), new Vector3(0, 3.52f, 0) };
void Start()
{
_time = -_settings.Delay;
for (int i = 0; i < _references.GlitchBlocksLeft.Length; i++)
SetBlocScale(_references.GlitchBlocksLeft[i], 0);
for (int i = 0; i < _references.GlitchBlocksRight.Length; i++)
SetBlocScale(_references.GlitchBlocksRight[i], 1);
for (int i = 0; i < _references.GlitchBlocksTop.Length; i++)
SetBlocScale(_references.GlitchBlocksTop[i], 2);
}
void Update()
{
SandRenderer.material.SetFloat("_Progression", Time.timeSinceLevelLoad / Duration);
_time += Time.deltaTime;
float progression = Mathf.Clamp01(_time / _settings.Duration);
_references.SandRenderer.material.SetFloat("_Progression", progression);
if (!OctoPlayer.Instance)
return;
Vector3 targetPos = _references.SandRenderer.transform.position;
targetPos.z = OctoPlayer.Instance.transform.position.z;
_references.SandRenderer.transform.position = targetPos;
//SandRenderer.transform.rotation = OctoPlayer.Instance.transform.rotation;
for (int i = 0; i < _references.GlitchBlocksLeft.Length; i++)
SetBlocPosition(_references.GlitchBlocksLeft[i], 0);
for (int i = 0; i < _references.GlitchBlocksRight.Length; i++)
SetBlocPosition(_references.GlitchBlocksRight[i], 1);
for (int i = 0; i < _references.GlitchBlocksTop.Length; i++)
SetBlocPosition(_references.GlitchBlocksTop[i], 2);
}
void SetBlocScale(Transform tr, int i)
{
tr.localScale = new Vector3(tr.localScale.x, tr.localScale.y, Mathf.Lerp(2, 4, i * 37.05f % 1));
}
void SetBlocPosition(Transform tr, int i)
{
Vector3 moveOffset = _movesOffset[i];
Vector3 moveMultiplier = _movesMultiplier[i];
float id = tr.GetSiblingIndex() + i * 9.12f;
float offset = _time * Mathf.Lerp(1, 1.3f, _time);
offset *= Mathf.Lerp(3, 8, id * 6.23f % 1);
offset += id * 17.23f;
offset = Mathf.Cos(offset);
offset = Mathf.Clamp01(offset * 6 - 2);
//float amplitude = Time.timeSinceLevelLoad * Mathf.Lerp(.03f, .02f, id * 6.23f % 1);
float amplitude = id * 23.18f % 1;
amplitude *= Mathf.Clamp01(_time);
amplitude *= 1 + _time * .05f;
amplitude *= .3f;
amplitude = Mathf.Clamp01(amplitude);
Vector3 targetPos = moveOffset - moveMultiplier * offset * amplitude;
targetPos.z = tr.localPosition.z;
tr.localPosition = targetPos;
}
}
@@ -72,12 +72,18 @@ void Sand_float
out float Alpha
)
{
float t = Progression;
t -= RidgedNoise3D(PositionWS, .3, 1, 2, .5) * .3;
float depth = length(PositionWS - _WorldSpaceCameraPos.xyz);
float arkMask = 0;
float t = Progression;
t -= RidgedNoise3D(PositionWS, .3, 1, 2, .5) * .3;
t -= pow(smoothstep(0, 100, depth), .5) * .6;
//t += pow(abs(PositionWS.x), 3) * .02;
//t -= pow(saturate(1 - abs(PositionWS.x * .5)), 2) * .3;
t += .15;
t = saturate(t);
// Sand
float sandLayers = 6;
@@ -100,14 +106,19 @@ void Sand_float
// Output
Color = ColorRemapLinear(saturate(pow(smoothstep(5, 30, depth * sandPatern), .5)), ColorA, ColorB, ColorC, ColorD, ColorE);
Position = PositionWS;
Position.y += sandMask;
Position.y *= 1 + saturate(pow(abs(PositionWS.x * .5), 3)) * lerp(-.2, 1.4, sandMask);
float n = PerlinNoise3D(Position, 50);
Color = ColorRemapLinear(saturate(pow(smoothstep(5, 30, (Position.z - _WorldSpaceCameraPos.z * .8) * sandPatern), .5)), ColorA, ColorB, ColorC, ColorD, ColorE);
Color *= lerp(1, n, smoothstep(30, 0, depth));
Height = sandMask;
Alpha = smoothstep(1, .5, abs(smoothstep(-20, 20, PositionWS.x) * 2 - 1));
Alpha = 1 - /*smoothstep(1.5, 1.3, abs(PositionWS.x)) **/ smoothstep(0, .3, abs(Position.y));
}
void HouseOfLeaves_float
@@ -267,10 +267,10 @@ void EnkiBillalFullscreen_float
// DISTORTION
float distortAtten = pow(smoothstep(5, 20, depthMeters), 2);
float nDistort0 = FBMNoise3D(positionWS * float3(1, 2.0, 1) - time * .1 - np0 * .5 + np3 * 3, 1.5, 1, 2, .5) * 2 - 1;
float nDistort1 = FBMNoise3D(positionWS * float3(1, 1.5, 1) - time * .1 - np0 * .5 + np4 * 3, 1.5, 1, 2, .5) * 2 - 1;
float nDistort0 = FBMNoise3D(positionWS * float3(1, 2.0, 1) - time * .2 - np0 * .5, 1.5, 1, 2, .5) * 2 - 1;
float nDistort1 = FBMNoise3D(positionWS * float3(1, 1.5, 1) - time * .2 - np0 * .5, 1.5, 1, 2, .5) * 2 - 1;
float2 uvDistort0 = uv0 + nDistort0 * .005;
float2 uvDistort1 = uv0 + nDistort1 * .015;
float2 uvDistort1 = uv0 + nDistort1 * .025;
float3 sceneColor2 = SampleSceneColor(uvDistort0);
sceneColor2 = lerp(sceneColor2, SampleSceneColor(uvDistort1), .3);
float3 cDistort = saturate(sceneColor2 - sceneColor) * distortAtten;
@@ -317,7 +317,7 @@ void EnkiBillalFullscreen_float
//c = lerp(c, sceneColor2, (greyscale + smoothstep(5, 35, depthMeters) * .8) * .5);
//c += sceneColor2 * greyscale * .5;
c = lerp(c, outlineColor, outline);
c += cDistort * 1;
c += cDistort * 1.5;
//c = ((c + 1) * (sceneColor2 + 0));
//c = smoothstep(-.1, 0, np2);
//c = greyscale;