Skip to content

Commit 9953841

Browse files
committed
Documentation, examples, bug fix
+Fixed bug in new AddForObjectForTracking method (thanks to the user @JSeco181 :) +Added shader rewind showcase +Updated documentation
1 parent 2d72638 commit 9953841

12 files changed

Lines changed: 646 additions & 5 deletions

File tree

-73.4 KB
Binary file not shown.

Assets/TimeRewinder/ExampleScene/Shader.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 6
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: FlowingStripes
11+
m_Shader: {fileID: 4800000, guid: 4a584982aa207ee4ebbc212218ef9362, type: 3}
12+
m_ShaderKeywords:
13+
m_LightmapFlags: 4
14+
m_EnableInstancingVariants: 0
15+
m_DoubleSidedGI: 0
16+
m_CustomRenderQueue: -1
17+
stringTagMap: {}
18+
disabledShaderPasses: []
19+
m_SavedProperties:
20+
serializedVersion: 3
21+
m_TexEnvs:
22+
- _BumpMap:
23+
m_Texture: {fileID: 0}
24+
m_Scale: {x: 1, y: 1}
25+
m_Offset: {x: 0, y: 0}
26+
- _DetailAlbedoMap:
27+
m_Texture: {fileID: 0}
28+
m_Scale: {x: 1, y: 1}
29+
m_Offset: {x: 0, y: 0}
30+
- _DetailMask:
31+
m_Texture: {fileID: 0}
32+
m_Scale: {x: 1, y: 1}
33+
m_Offset: {x: 0, y: 0}
34+
- _DetailNormalMap:
35+
m_Texture: {fileID: 0}
36+
m_Scale: {x: 1, y: 1}
37+
m_Offset: {x: 0, y: 0}
38+
- _EmissionMap:
39+
m_Texture: {fileID: 0}
40+
m_Scale: {x: 1, y: 1}
41+
m_Offset: {x: 0, y: 0}
42+
- _MainTex:
43+
m_Texture: {fileID: 0}
44+
m_Scale: {x: 1, y: 1}
45+
m_Offset: {x: 0, y: 0}
46+
- _MetallicGlossMap:
47+
m_Texture: {fileID: 0}
48+
m_Scale: {x: 1, y: 1}
49+
m_Offset: {x: 0, y: 0}
50+
- _OcclusionMap:
51+
m_Texture: {fileID: 0}
52+
m_Scale: {x: 1, y: 1}
53+
m_Offset: {x: 0, y: 0}
54+
- _ParallaxMap:
55+
m_Texture: {fileID: 0}
56+
m_Scale: {x: 1, y: 1}
57+
m_Offset: {x: 0, y: 0}
58+
m_Floats:
59+
- _BumpScale: 1
60+
- _Cutoff: 0.5
61+
- _DetailNormalMapScale: 1
62+
- _DstBlend: 0
63+
- _GlossMapScale: 1
64+
- _Glossiness: 0.5
65+
- _GlossyReflections: 1
66+
- _Metallic: 0
67+
- _Mode: 0
68+
- _OcclusionStrength: 1
69+
- _OwnTime: 1
70+
- _Parallax: 0.02
71+
- _SmoothnessTextureChannel: 0
72+
- _SpecularHighlights: 1
73+
- _Speed: 1
74+
- _SrcBlend: 1
75+
- _UVSec: 0
76+
- _ZWrite: 1
77+
m_Colors:
78+
- _Color: {r: 1, g: 1, b: 1, a: 1}
79+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80+
- _MainColor: {r: 1, g: 0.97702324, b: 0, a: 1}
81+
m_BuildTextureStacks: []

Assets/TimeRewinder/ExampleScene/Shader/FlowingStripes.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Shader "Custom/ScrollingStripes"
2+
{
3+
Properties
4+
{
5+
_MainColor("Color", Color) = (1,1,1,1)
6+
_Speed("Speed", float) = 1.0
7+
_OwnTime("Time",float) =1
8+
}
9+
SubShader
10+
{
11+
Tags { "RenderType" = "Opaque" }
12+
LOD 100
13+
14+
Pass
15+
{
16+
CGPROGRAM
17+
#pragma vertex vert
18+
#pragma fragment frag
19+
20+
struct appdata
21+
{
22+
float4 vertex : POSITION;
23+
float2 uv : TEXCOORD0;
24+
};
25+
26+
struct v2f
27+
{
28+
float2 uv : TEXCOORD0;
29+
float4 vertex : SV_POSITION;
30+
};
31+
sampler2D _MainTex;
32+
33+
CBUFFER_START(UnityPerMaterial)
34+
float4 _MainTex_ST;
35+
float4 _MainColor;
36+
float _Speed;
37+
float _OwnTime;
38+
CBUFFER_END
39+
40+
v2f vert(appdata v)
41+
{
42+
v2f o;
43+
o.vertex = UnityObjectToClipPos(v.vertex);
44+
o.uv = v.uv;
45+
return o;
46+
}
47+
48+
half4 frag(v2f i) : SV_Target
49+
{
50+
float2 uv = i.uv + float2(0, _OwnTime * _Speed);
51+
float stripeValue = frac(uv.y * 20.0); // Generate a value that oscillates between 0 and 1
52+
53+
// Adjust the value so that the black stripe is half as thick as the colored stripe
54+
float adjustedStripeValue = stripeValue < 0.5 ? 1.0 : 0.0;
55+
56+
half4 color = lerp(half4(0,0,0,1), _MainColor, adjustedStripeValue);
57+
return color;
58+
}
59+
60+
61+
ENDCG
62+
}
63+
}
64+
}

Assets/TimeRewinder/ExampleScene/Shader/FlowingStripes.shader.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)