重新导入obi

This commit is contained in:
2026-04-06 11:35:18 +08:00
parent 05fa2d6e5e
commit ae3002a0e2
1643 changed files with 232496 additions and 13 deletions

View File

@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ee7737c43f5734f87be9e49d1bbfba78, type: 3}
m_Name: DefaultRopeSection
m_EditorClassIdentifier:
vertices:
- {x: 1, y: 0}
- {x: 0.70710677, y: 0.70710677}
- {x: -0.00000004371139, y: 1}
- {x: -0.70710677, y: 0.70710677}
- {x: -1, y: -0.00000008742278}
- {x: -0.70710665, y: -0.7071069}
- {x: 0.000000011924881, y: -1}
- {x: 0.707107, y: -0.70710653}
- {x: 1, y: 0.00000017484555}
snapX: 32
snapY: 32

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a0bc36a59515f413e90e10895929c938
labels:
- ObiRope
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bd46757354fbf4182af57f2913e20fc1
folderAsset: yes
timeCreated: 1474532461
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b90d3c214c99743b0865fc0e0d1f1a15
timeCreated: 1474532476
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: a3476527001d2494a88fa4236e8dbf0b
timeCreated: 1525627614
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: 98f1105e6aebd46a1878df08ab79b5d7
timeCreated: 1482234525
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: 06f4c4a011cc740c08e92ac6806b7353
timeCreated: 1482234676
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: c237f5e557ded47598c1e8e4c650aeda
timeCreated: 1474532609
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: 8b6df8323f27749f58cbd0563786435b
timeCreated: 1525630909
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 40f10b6d47dcf4fe5a4851bad844fa57
folderAsset: yes
timeCreated: 1445286974
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DistanceFieldRendering
m_Shader: {fileID: 4800000, guid: 8447096d1e8064b37939be221dd9afb5, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Volume:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Absorption: 1
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _MaxSteps: 300
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StepSize: 0.01
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _AABBMax: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _AABBMin: {r: -0.5, g: -0.5, b: -0.5, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _InsideColor: {r: 1, g: 1, b: 1, a: 1}
- _OutsideColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f6bf1245292ed43c78875db43ca1aad3
timeCreated: 1515780549
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,66 @@
Shader "Obi/DistanceFieldSlice"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
half4 frag (v2f i) : SV_Target
{
half dist = tex2D(_MainTex, i.uv).x-0.5; // signed distance
half adist = abs(dist); // absolute distance
half isofunc = sin(adist*40); // isolines function
// antialiased isolines:
half change = fwidth(isofunc);
half isolines = smoothstep(-change,change,isofunc);
// antialiazed sign:
change = fwidth(dist);
half sign = smoothstep(-change,change,dist);
half final = (1-adist) * (0.85+isolines*0.15);
return half4(final,final*sign,final*sign,1);
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8447096d1e8064b37939be221dd9afb5
timeCreated: 1515783007
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: InstancedStandard
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8fbd9c5f957b8434883cdfce9d6a3c27, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2b7dfa8ebb76247318ce5b7df4b97484
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,85 @@
#ifndef OBIELLIPSOIDS_INCLUDED
#define OBIELLIPSOIDS_INCLUDED
float _RadiusScale;
// Eye ray origin in world space.
// Works both for orthographic and perspective cameras.
float3 WorldEye(float3 worldPos){
if ((UNITY_MATRIX_P[3].x == 0.0) && (UNITY_MATRIX_P[3].y == 0.0) && (UNITY_MATRIX_P[3].z == 0.0)){
return mul(UNITY_MATRIX_I_V,float4(mul(UNITY_MATRIX_V, float4(worldPos,1)).xy,0,1)).xyz;
}else
return UNITY_MATRIX_I_V._m03_m13_m23;
}
// Returns visible ellipsoid radius and offset from center, given the eye position in parameter space.
// Works both for orthographic and perspective cameras.
float VisibleEllipsoidCircleRadius(float3 eye, out float3 m){
if ((UNITY_MATRIX_P[3].x == 0.0) && (UNITY_MATRIX_P[3].y == 0.0) && (UNITY_MATRIX_P[3].z == 0.0)){
m = float3(0,0,0);
return 1;
}else{
float t = 1/dot(eye,eye);
m = t * eye;
return sqrt(1-t);
}
}
// Performs accurate raycasting of a spherical impostor.
// Works both for orthographic and perspective cameras.
float IntersectEllipsoid(float3 v, float4 mapping, float3 a2, float3 a3, out float3 eyePos, out float3 eyeNormal)
{
float r2 = dot(mapping.xy, mapping.xy);
float iq = 1 - r2/mapping.w;
clip(iq); // the ray does not intersect the sphere.
float sqrtiq = sqrt(iq);
float lambda = 1/(1 + mapping.z * sqrtiq);
eyePos = lambda * v;
eyeNormal = normalize(a2 + lambda * a3);
// return gaussian-falloff thickness.
return 2 * sqrtiq * exp(-r2*2.0f);
}
void BuildParameterSpaceMatrices(float4 t0, float4 t1, float4 t2, out float3x3 P, out float3x3 IP)
{
// build 3x3 orientation matrix and its inverse;
float3x3 IO = float3x3(t0.xyz,t1.xyz,t2.xyz);
float3x3 O = transpose(IO);
// build 3x3 scaling matrix and its inverse:
float3x3 S = float3x3(_RadiusScale*t0.w,0,0,0,_RadiusScale*t1.w,0,0,0,_RadiusScale*t2.w);
float3x3 IS = float3x3(1/(_RadiusScale*t0.w),0,0,0,1/(_RadiusScale*t1.w),0,0,0,1/(_RadiusScale*t2.w));
// build 3x3 transformation matrix and its inverse:
P = mul(mul(O,S),IO);
IP = mul(mul(O,IS),IO);
}
float BuildEllipsoidBillboard(float3 center, float3 corner, float3x3 P, float3x3 IP, out float3 worldPos, out float3 view, out float3 eye)
{
// eye position and quad vectors in parameter space:
eye = mul(IP,WorldEye(center) - center);
float3 u = normalize(cross(-eye,UNITY_MATRIX_V[1].xyz));
float3 k = normalize(cross(-eye,u));
// visible circle radius and offset from center in the direction of the view ray:
float3 m;
float radius = VisibleEllipsoidCircleRadius(eye,m);
// world position of the billboard corner, and view vector to it:
worldPos = center + mul(P, m) + radius * (mul(P,u)* corner.x + mul(P,k)* corner.y);
view = worldPos - WorldEye(worldPos);
return radius;
}
void BuildAuxiliaryNormalVectors(float3 center, float3 worldPos, float3 view, float3x3 P, float3x3 IP, out float3 a2, out float3 a3)
{
a2 = mul((float3x3)UNITY_MATRIX_V,mul(IP,mul(IP,WorldEye(worldPos) - center))); //T^-2 * (eye - center)
a3 = mul((float3x3)UNITY_MATRIX_V,mul(IP,mul(IP,view))); //T^-2 * A[0]
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 083c49fc96643477889bfd68e70cf998
timeCreated: 1445285630
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#ifndef OBILIGHTINGBUILTIN_INCLUDED
#define OBILIGHTINGBUILTIN_INCLUDED
#include "UnityCG.cginc"
#include "UnityStandardUtils.cginc"
#include "AutoLight.cginc"
half3 SampleSphereAmbient(float3 eyeNormal, float3 eyePos)
{
#if UNITY_SHOULD_SAMPLE_SH
half3 worldNormal = mul(transpose((float3x3)UNITY_MATRIX_V),eyeNormal);
half3 worldPos = mul(_Camera_to_World,half4(eyePos,1.0));
return ShadeSHPerPixel(half4(worldNormal, 1.0),half3(0,0,0),worldPos);
#else
return UNITY_LIGHTMODEL_AMBIENT;
#endif
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 135872c7cdf2b43bf89b8c57d067d4de
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
#ifndef OBIPARTICLES_INCLUDED
#define OBIPARTICLES_INCLUDED
float _RadiusScale;
float3 BillboardSphereNormals(float2 texcoords)
{
float3 n;
n.xy = texcoords*2.0-1.0;
float r2 = dot(n.xy, n.xy);
clip (1 - r2); // clip pixels outside circle
n.z = sqrt(1.0 - r2);
return n;
}
float BillboardSphereThickness(float2 texcoords)
{
float2 n = texcoords*2.0-1.0;
float r2 = dot(n.xy, n.xy);
clip (1 - r2); // clip pixels outside circle
return sqrt(1.0 - r2)*2.0f*exp(-r2*2.0f);
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e4575c757879646c793ff2b434b83e74
timeCreated: 1445285630
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
#ifndef OBIUTILS_INCLUDED
#define OBIUTILS_INCLUDED
float4x4 _Camera_to_World;
// abstract texture declaration/sampling over built-in and SRPs:
#ifndef TEXTURE2D
#define TEXTURE2D(name) sampler2D name
#endif
#ifndef TEXTURE2D_HALF
#define TEXTURE2D_HALF(name) sampler2D_half name
#endif
#ifndef TEXTURE2D_FLOAT
#define TEXTURE2D_FLOAT(name) sampler2D_float name
#endif
#ifndef SAMPLE_TEXTURE2D
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName,coord2)
#endif
#ifndef SAMPLER
#define SAMPLER(samplerName)
#endif
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fe1b10a99f88a45a09abf1a13d62b63f
timeCreated: 1445285630
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Particle
m_Shader: {fileID: 4800000, guid: 87908c483837f4df49e97fa1aa0dacda, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Glossiness: 0.5
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _RadiusScale: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb972beb020dd4ff5ab78835f4393522
timeCreated: 1444705309
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,215 @@
Shader "Obi/Particles" {
Properties {
_Color ("Particle color", Color) = (1,1,1,1)
_RadiusScale("Radius scale",float) = 1
}
SubShader {
Pass {
Name "ParticleFwdBase"
Tags {"Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" "LightMode" = "ForwardBase"}
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_fwdbase nolightmap
#include "ObiEllipsoids.cginc"
#include "ObiUtils.cginc"
#include "ObiLightingBuiltIn.cginc"
fixed4 _Color;
fixed4 _LightColor0;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
fixed4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
float4 t1 : TEXCOORD1; // ellipsoid t2 vector
float4 t2 : TEXCOORD2; // ellipsoid t3 vector
};
struct v2f
{
float4 pos : SV_POSITION;
fixed4 color : COLOR;
float4 mapping : TEXCOORD0;
float3 viewRay : TEXCOORD1;
float3 lightDir : TEXCOORD2;
float3 a2 : TEXCOORD3;
float3 a3 : TEXCOORD4;
LIGHTING_COORDS(5,6)
};
struct fout
{
half4 color : SV_Target;
float depth : SV_Depth;
};
v2f vert(vin v)
{
float3x3 P, IP;
BuildParameterSpaceMatrices(v.t0,v.t1,v.t2,P,IP);
float3 worldPos;
float3 view;
float3 eye;
float radius = BuildEllipsoidBillboard(v.vertex,v.corner,P,IP,worldPos,view,eye);
v2f o;
o.pos = mul(UNITY_MATRIX_VP, float4(worldPos,v.vertex.w));
o.mapping = float4(v.corner.xy,1/length(eye),radius); // A[1]
o.viewRay = mul((float3x3)UNITY_MATRIX_V,view); // A[0]
o.color = v.color * _Color;
BuildAuxiliaryNormalVectors(v.vertex,worldPos,view,P,IP,o.a2,o.a3);
o.lightDir = mul((float3x3)UNITY_MATRIX_MV, ObjSpaceLightDir(v.vertex));
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
fout frag(v2f i)
{
fout fo;
fo.color = half4(0,0,0,i.color.a);
// generate sphere normals:
float3 p,n;
IntersectEllipsoid(i.viewRay,i.mapping, i.a2,i.a3,p, n);
// clip space position:
float4 pos = mul(UNITY_MATRIX_P,float4(p,1.0));
// simple lighting: ambient
half3 amb = SampleSphereAmbient(n,p);
// simple lighting: diffuse
float ndotl = saturate( dot( n, normalize(i.lightDir) ) );
UNITY_LIGHT_ATTENUATION(atten,i,0);
// final lit color:
fo.color.rgb = i.color * (_LightColor0 * ndotl * atten + amb);
// normalized device coordinates:
fo.depth = pos.z/pos.w;
// in openGL calculated depth range is <-1,1> map it to <0,1>
#if SHADER_API_OPENGL || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3
fo.depth = 0.5*fo.depth + 0.5;
#endif
return fo;
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
Fog {Mode Off}
ZWrite On ZTest LEqual
CGPROGRAM
#pragma vertex ellipsoidShadowVS
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster nolightmap
#include "ObiEllipsoids.cginc"
#include "ObiUtils.cginc"
#include "ObiLightingBuiltIn.cginc"
sampler3D _DitherMaskLOD;
fixed4 _Color;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
fixed4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
float4 t1 : TEXCOORD1; // ellipsoid t2 vector
float4 t2 : TEXCOORD2; // ellipsoid t3 vector
};
struct v2f {
fixed4 color : COLOR;
float4 mapping : TEXCOORD0;
float3 viewRay : TEXCOORD1;
};
struct fout
{
half4 color : SV_Target;
float depth : SV_Depth;
};
v2f ellipsoidShadowVS( vin v , out float4 outpos : SV_POSITION )// clip space position output
{
float3x3 P, IP;
BuildParameterSpaceMatrices(v.t0,v.t1,v.t2,P,IP);
float3 worldPos;
float3 view;
float3 eye;
float radius = BuildEllipsoidBillboard(v.vertex,v.corner,P,IP,worldPos,view,eye);
v2f o;
outpos = mul(UNITY_MATRIX_VP, float4(worldPos,v.vertex.w));
o.mapping = float4(v.corner.xy,1/length(eye),radius); // A[1]
o.viewRay = mul((float3x3)UNITY_MATRIX_V,view); // A[0]
o.color = v.color * _Color;
return o;
}
fout frag( v2f i , UNITY_VPOS_TYPE vpos : VPOS)
{
fout fo;
float3 p,n;
IntersectEllipsoid(i.viewRay,i.mapping, float3(0,0,0),float3(0,0,0),p, n);
// project camera space position.
float4 pos = UnityApplyLinearShadowBias( mul(UNITY_MATRIX_P,float4(p,1.0)) );
fo.color = pos.z/pos.w; //similar to what SHADOW_CASTER_FRAGMENT does in case there's no depth buffer.
fo.depth = pos.z/pos.w;
// in openGL calculated depth range is <-1,1> map it to <0,1>
#if SHADER_API_OPENGL || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3
fo.depth = fo.depth*0.5+0.5;
#endif
// Use dither mask for alpha blended shadows, based on pixel position xy
// and alpha level. Our dither texture is 4x4x16.
half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,i.color.a*0.9375)).a;
clip (alphaRef - 0.01);
return fo;
}
ENDCG
}
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 801733041f66b49e1b3c2101471db877
timeCreated: 1438934781
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,131 @@
Shader "Obi/Simple Particles" {
Properties {
_Color ("Particle color", Color) = (1,1,1,1)
}
SubShader {
Pass {
Name "ParticleFwdBase"
Tags {"Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" "LightMode" = "ForwardBase"}
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_fwdbase nolightmap
#include "ObiParticles.cginc"
#include "ObiUtils.cginc"
#include "ObiLightingBuiltIn.cginc"
fixed4 _Color;
fixed4 _LightColor0;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
fixed4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f
{
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float3 lightDir : TEXCOORD1;
LIGHTING_COORDS(3,4)
};
v2f vert(vin v)
{
v2f o;
// particle positions are passed in world space, no need to use modelview matrix, just view.
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius; // multiply by size.
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
o.color = v.color * _Color;
o.lightDir = mul ((float3x3)UNITY_MATRIX_MV, ObjSpaceLightDir(v.vertex));
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
// generate sphere normals:
float3 n = BillboardSphereNormals(i.texcoord);
// simple lighting: diffuse
float ndotl = saturate( dot( n, normalize(i.lightDir) ) );
// final lit color:
return fixed4(i.color.rgb * (_LightColor0 * ndotl + UNITY_LIGHTMODEL_AMBIENT),i.color.a);
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
Fog {Mode Off}
ZWrite On ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster nolightmap
#include "ObiParticles.cginc"
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f {
float4 pos : POSITION;
float3 texcoord : TEXCOORD0;
};
v2f vert( vin v )
{
v2f o;
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius;
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
return o;
}
fixed4 frag( v2f i ) : SV_Target
{
float3 n = BillboardSphereNormals(i.texcoord);
return fixed4(0,0,0,0);
}
ENDCG
}
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 87908c483837f4df49e97fa1aa0dacda
timeCreated: 1489574725
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
Shader "Standard (Vertex Colors)" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
float4 vcolor : COLOR;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color * IN.vcolor;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 96c602bba0bc94471862812f91285c9a
timeCreated: 1505116095
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7377795ea5bbd404ba97de2909380e01
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@
#ifndef OBILIGHTINGBUILTURP_INCLUDED
#define OBILIGHTINGBUILTURP_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
half3 SampleSphereAmbient(float3 eyeNormal)
{
half3 worldNormal = mul(UNITY_MATRIX_I_V,half4(eyeNormal,0.0));
return SampleSH(worldNormal);
}
float3 ObjSpaceLightDir(in float4 modelPos)
{
float3 lightPos = mul(unity_WorldToObject,_MainLightPosition).xyz;
float3 lightVector = lightPos.xyz - modelPos * _MainLightPosition.w;
return lightVector;
}
float3 WorldSpaceLightDir(in float4 modelPos)
{
float3 vertexPos = mul(unity_ObjectToWorld, modelPos).xyz;
float3 lightVector = _MainLightPosition.xyz - vertexPos * _MainLightPosition.w;
return lightVector;
}
half Attenuation(float3 eyePos)
{
half3 worldPos = mul(UNITY_MATRIX_I_V,half4(eyePos,1.0));
float4 shadowCoord = TransformWorldToShadowCoord(worldPos);
Light mainLight = GetMainLight(shadowCoord);
return mainLight.shadowAttenuation * mainLight.distanceAttenuation;
}
#endif

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2231c15aefcd6484e9857cbb64ad8cd7
timeCreated: 1445285630
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,236 @@
Shader "Obi/URP/Particles" {
Properties {
_Color ("Particle color", Color) = (1,1,1,1)
_RadiusScale("Radius scale",float) = 1
}
SubShader {
Tags{"RenderPipeline" = "UniversalRenderPipeline"}
Pass {
Name "ParticleFwdBase"
Tags {"Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" "LightMode" = "UniversalForward"}
Blend SrcAlpha OneMinusSrcAlpha
HLSLPROGRAM
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile _ _SHADOWS_SOFT
#include "../ObiUtils.cginc"
#include "ObiLightingURP.cginc"
#include "../ObiEllipsoids.cginc"
float4 _Color;
float4 _LightColor0;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
float4 t1 : TEXCOORD1; // ellipsoid t2 vector
float4 t2 : TEXCOORD2; // ellipsoid t3 vector
};
struct v2f
{
float4 pos : SV_POSITION;
float4 color : COLOR;
float4 mapping : TEXCOORD0;
float3 viewRay : TEXCOORD1;
float3 lightDir : TEXCOORD2;
float3 a2 : TEXCOORD3;
float3 a3 : TEXCOORD4;
};
struct fout
{
half4 color : SV_Target;
float depth : SV_Depth;
};
v2f vert(vin v)
{
float3x3 P, IP;
BuildParameterSpaceMatrices(v.t0,v.t1,v.t2,P,IP);
float3 worldPos;
float3 view;
float3 eye;
float radius = BuildEllipsoidBillboard(v.vertex,v.corner,P,IP,worldPos,view,eye);
v2f o;
o.pos = mul(UNITY_MATRIX_VP, float4(worldPos,v.vertex.w));
o.mapping = float4(v.corner.xy,1/length(eye),radius); // A[1]
o.viewRay = mul((float3x3)UNITY_MATRIX_V,view); // A[0]
o.color = v.color * _Color;
BuildAuxiliaryNormalVectors(v.vertex,worldPos,view,P,IP,o.a2,o.a3);
o.lightDir = mul((float3x3)UNITY_MATRIX_MV, ObjSpaceLightDir(v.vertex));
return o;
}
fout frag(v2f i)
{
fout fo;
fo.color = half4(0,0,0,i.color.a);
// generate sphere normals:
float3 p,n;
IntersectEllipsoid(i.viewRay,i.mapping, i.a2,i.a3, p, n);
// clip space position:
float4 pos = mul(UNITY_MATRIX_P,float4(p,1.0));
// simple lighting: ambient
half3 amb = SampleSphereAmbient(n);
// simple lighting: diffuse
float ndotl = saturate( dot( n, normalize(i.lightDir) ) );
float atten = Attenuation(p);
// final lit color:
fo.color.rgb = i.color * (_LightColor0 * ndotl * atten + amb);
// normalized device coordinates:
fo.depth = pos.z/pos.w;
// in openGL calculated depth range is <-1,1> map it to <0,1>
#if SHADER_API_OPENGL || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3
fo.depth = 0.5 * fo.depth + 0.5;
#endif
return fo;
}
ENDHLSL
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
Fog {Mode Off}
ZWrite On ZTest LEqual
HLSLPROGRAM
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex ellipsoidShadowVS
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#include "../ObiUtils.cginc"
#include "ObiLightingURP.cginc"
#include "../ObiEllipsoids.cginc"
sampler3D _DitherMaskLOD;
float4 _Color;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
float4 t1 : TEXCOORD1; // ellipsoid t2 vector
float4 t2 : TEXCOORD2; // ellipsoid t3 vector
};
struct v2f {
float4 color : COLOR;
float4 mapping : TEXCOORD0;
float3 viewRay : TEXCOORD1;
float3 lightDir : TEXCOORD2;
float3 a2 : TEXCOORD3;
float3 a3 : TEXCOORD4;
};
struct fout
{
half4 color : SV_Target;
float depth : SV_Depth;
};
v2f ellipsoidShadowVS( vin v , out float4 outpos : SV_POSITION )// clip space position output
{
float3x3 P, IP;
BuildParameterSpaceMatrices(v.t0,v.t1,v.t2,P,IP);
float3 worldPos;
float3 view;
float3 eye;
float radius = BuildEllipsoidBillboard(v.vertex,v.corner,P,IP,worldPos,view,eye);
v2f o;
outpos = mul(UNITY_MATRIX_VP, float4(worldPos,v.vertex.w));
o.mapping = float4(v.corner.xy,1/length(eye),radius); // A[1]
o.viewRay = mul((float3x3)UNITY_MATRIX_V,view); // A[0]
o.color = v.color * _Color;
BuildAuxiliaryNormalVectors(v.vertex,worldPos,view,P,IP,o.a2,o.a3);
o.lightDir = WorldSpaceLightDir(v.vertex);
return o;
}
fout frag( v2f i )
{
fout fo;
float3 p,n;
IntersectEllipsoid(i.viewRay,i.mapping,i.a2,i.a3,p, n);
// calculate world space position and normal:
float4 wnormal = mul(UNITY_MATRIX_I_V,float4(n,0));
float4 wpos = mul(UNITY_MATRIX_I_V,float4(p,1));
// calculate clip space position.
float4 clipPos = TransformWorldToHClip(ApplyShadowBias(wpos, wnormal, normalize(i.lightDir)));
#if UNITY_REVERSED_Z
clipPos.z = min(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE);
#else
clipPos.z = max(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE);
#endif
fo.color = clipPos.z/clipPos.w; //similar to what SHADOW_CASTER_FRAGMENT does in case there's no depth buffer.
fo.depth = clipPos.z/clipPos.w;
// in openGL calculated depth range is <-1,1> map it to <0,1>
#if SHADER_API_OPENGL || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3
fo.depth = fo.depth*0.5+0.5;
#endif
return fo;
}
ENDHLSL
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 28641a0edd6e047c6af7e3c6b342c81a
timeCreated: 1438934781
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,145 @@
Shader "Obi/URP/Simple Particles" {
Properties {
_Color ("Particle color", Color) = (1,1,1,1)
}
SubShader {
Tags{"RenderPipeline" = "UniversalRenderPipeline"}
Pass {
Name "ParticleFwdBase"
Tags {"Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" "LightMode" = "UniversalForward"}
Blend SrcAlpha OneMinusSrcAlpha
HLSLPROGRAM
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile _ _SHADOWS_SOFT
#include "../ObiUtils.cginc"
#include "ObiLightingURP.cginc"
#include "../ObiParticles.cginc"
float4 _Color;
float4 _LightColor0;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f
{
float4 pos : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
float3 lightDir : TEXCOORD1;
};
v2f vert(vin v)
{
v2f o;
// particle positions are passed in world space, no need to use modelview matrix, just view.
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius; // multiply by size.
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
o.color = v.color * _Color;
o.lightDir = mul ((float3x3)UNITY_MATRIX_MV, ObjSpaceLightDir(v.vertex));
return o;
}
float4 frag(v2f i) : SV_Target
{
// generate sphere normals:
float3 n = BillboardSphereNormals(i.texcoord);
// simple lighting: ambient
half3 amb = SampleSphereAmbient(n);
// simple lighting: diffuse
float ndotl = saturate( dot( n, normalize(i.lightDir) ) );
// final lit color:
return float4(i.color.rgb * (_LightColor0 * ndotl + amb),i.color.a);
}
ENDHLSL
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
Fog {Mode Off}
ZWrite On ZTest LEqual
HLSLPROGRAM
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#include "../ObiUtils.cginc"
#include "ObiLightingURP.cginc"
#include "../ObiParticles.cginc"
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f {
float4 pos : POSITION;
float3 texcoord : TEXCOORD0;
};
v2f vert( vin v )
{
v2f o;
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius;
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
return o;
}
float4 frag( v2f i ) : SV_Target
{
float3 n = BillboardSphereNormals(i.texcoord);
return float4(0,0,0,0);
}
ENDHLSL
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a8c46db5ccc10489cba075e7a9172ca6
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 568ceb11f52ec4d36abc82bcf61af795
timeCreated: 1461823723
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant: