Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce72082

Browse files
committed
Initial commit
0 parents  commit ce72082

File tree

244 files changed

+22362
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+22362
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
# MemoryCaptures can get excessive in size.
14+
# They also could contain extremely sensitive data
15+
/[Mm]emoryCaptures/
16+
17+
# Recordings can get excessive in size
18+
/[Rr]ecordings/
19+
20+
# Uncomment this line if you wish to ignore the asset store tools plugin
21+
# /[Aa]ssets/AssetStoreTools*
22+
23+
# Autogenerated Jetbrains Rider plugin
24+
/[Aa]ssets/Plugins/Editor/JetBrains*
25+
26+
# Visual Studio cache directory
27+
.vs/
28+
29+
# Gradle cache directory
30+
.gradle/
31+
32+
# Autogenerated VS/MD/Consulo solution and project files
33+
ExportedObj/
34+
.consulo/
35+
*.csproj
36+
*.unityproj
37+
*.sln
38+
*.suo
39+
*.tmp
40+
*.user
41+
*.userprefs
42+
*.pidb
43+
*.booproj
44+
*.svd
45+
*.pdb
46+
*.mdb
47+
*.opendb
48+
*.VC.db
49+
50+
# Unity3D generated meta files
51+
*.pidb.meta
52+
*.pdb.meta
53+
*.mdb.meta
54+
55+
# Unity3D generated file on crash reports
56+
sysinfo.txt
57+
58+
# Builds
59+
*.apk
60+
*.aab
61+
*.unitypackage
62+
*.app
63+
64+
# Crashlytics generated file
65+
crashlytics-build.properties
66+
67+
# Packed Addressables
68+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
69+
70+
# Temporary auto-generated Android Assets
71+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
72+
/[Aa]ssets/[Ss]treamingAssets/aa/*

.vsconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Assets/BasicSphereImpostor.shader

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
Shader "Basic Sphere Impostor"
2+
{
3+
Properties
4+
{
5+
}
6+
SubShader
7+
{
8+
Tags { "RenderType"="AlphaTest" "DisableBatching"="True" }
9+
LOD 100
10+
11+
Pass
12+
{
13+
Tags { "LightMode" = "ForwardBase" }
14+
15+
CGPROGRAM
16+
#pragma vertex vert
17+
#pragma fragment frag
18+
19+
#include "UnityCG.cginc"
20+
21+
struct appdata
22+
{
23+
float4 vertex : POSITION;
24+
};
25+
26+
struct v2f
27+
{
28+
float4 pos : SV_POSITION;
29+
float3 rayDir : TEXCOORD0;
30+
float3 rayOrigin : TEXCOORD1;
31+
};
32+
33+
v2f vert (appdata v)
34+
{
35+
v2f o;
36+
37+
// get world position of vertex
38+
// using float4(v.vertex.xyz, 1.0) instead of v.vertex to match Unity's code
39+
float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0));
40+
41+
// calculate and world space ray direction and origin for interpolation
42+
o.rayDir = worldPos - _WorldSpaceCameraPos.xyz;
43+
o.rayOrigin = _WorldSpaceCameraPos.xyz;
44+
45+
o.pos = UnityWorldToClipPos(worldPos);
46+
47+
return o;
48+
}
49+
50+
// https://www.iquilezles.org/www/articles/spherefunctions/spherefunctions.htm
51+
float sphIntersect( float3 ro, float3 rd, float4 sph )
52+
{
53+
float3 oc = ro - sph.xyz;
54+
float b = dot( oc, rd );
55+
float c = dot( oc, oc ) - sph.w*sph.w;
56+
float h = b*b - c;
57+
if( h<0.0 ) return -1.0;
58+
h = sqrt( h );
59+
return -b - h;
60+
}
61+
62+
half3 _LightColor0;
63+
64+
half4 frag (v2f i, out float outDepth : SV_Depth) : SV_Target
65+
{
66+
// ray origin
67+
float3 rayOrigin = i.rayOrigin;
68+
69+
// normalize ray vector
70+
float3 rayDir = normalize(i.rayDir);
71+
72+
// sphere position
73+
float3 spherePos = unity_ObjectToWorld._m03_m13_m23;
74+
75+
// ray box intersection
76+
float rayHit = sphIntersect(rayOrigin, rayDir, float4(spherePos, 0.5));
77+
78+
// above function returns -1 if there's no intersection
79+
clip(rayHit);
80+
81+
// calculate world space position from ray, front hit ray length, and ray origin
82+
float3 worldPos = rayDir * rayHit + rayOrigin;
83+
84+
// world space surface normal
85+
float3 worldNormal = normalize(worldPos - spherePos);
86+
87+
// basic lighting
88+
half3 worldLightDir = _WorldSpaceLightPos0.xyz;
89+
half ndotl = saturate(dot(worldNormal, worldLightDir));
90+
half3 lighting = _LightColor0 * ndotl;
91+
92+
// ambient lighting
93+
half3 ambient = ShadeSH9(float4(worldNormal, 1));
94+
lighting += ambient;
95+
96+
// output modified depth
97+
float4 clipPos = UnityWorldToClipPos(worldPos);
98+
outDepth = clipPos.z / clipPos.w;
99+
100+
return half4(lighting, 1.0);
101+
}
102+
ENDCG
103+
}
104+
}
105+
}

Assets/BasicSphereImpostor.shader.meta

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
32 KB
Binary file not shown.

Assets/Plugins/GFSDK_Aftermath_Lib.x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
4.53 MB
Binary file not shown.

Assets/Plugins/NvFlexDebugCUDA_x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/NvFlexDebugD3D_x64.dll

2.17 MB
Binary file not shown.

Assets/Plugins/NvFlexDebugD3D_x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
590 KB
Binary file not shown.

Assets/Plugins/NvFlexDeviceDebug_x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
142 KB
Binary file not shown.

Assets/Plugins/NvFlexDeviceRelease_x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.16 MB
Binary file not shown.

Assets/Plugins/NvFlexExtDebugCUDA_x64.dll.meta

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1 MB
Binary file not shown.

0 commit comments

Comments
 (0)