added splats & vertex snapping shader
This commit is contained in:
300
Assets/Shaders/Demo.mat
generated
Normal file
300
Assets/Shaders/Demo.mat
generated
Normal file
@@ -0,0 +1,300 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-9182826589664143878
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 13
|
||||
hdPluginSubTargetMaterialVersions:
|
||||
m_Keys: []
|
||||
m_Values:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Demo
|
||||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _DISABLE_SSR_TRANSPARENT
|
||||
- _NORMALMAP_TANGENT_SPACE
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2225
|
||||
stringTagMap:
|
||||
MotionVector: User
|
||||
disabledShaderPasses:
|
||||
- TransparentDepthPrepass
|
||||
- TransparentDepthPostpass
|
||||
- TransparentBackface
|
||||
- RayTracingPrepass
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- Texture2D_4450AB74:
|
||||
m_Texture: {fileID: 2800000, guid: b6a6551ec416c408e9353670dc7e6635, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
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}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmissionMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- Boolean_193028D2: 0
|
||||
- Boolean_3F1A8DAB: 0
|
||||
- Boolean_43476D73: 1
|
||||
- Boolean_7165A49C: 0
|
||||
- Boolean_85059BBE: 1
|
||||
- Boolean_8BBF99CD: 1
|
||||
- Boolean_D258FF8E: 0
|
||||
- Vector1_21C41D02: 256
|
||||
- Vector1_6F288C5B: 0.5
|
||||
- Vector1_B2CC132F: 10
|
||||
- Vector1_B9994903: 11
|
||||
- Vector1_E8746023: 1
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaRemapMax: 1
|
||||
- _AlphaRemapMin: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _Anisotropy: 0
|
||||
- _BlendMode: 0
|
||||
- _CoatMask: 0
|
||||
- _ConservativeDepthOffsetEnable: 0
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedGIMode: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1.5
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 1
|
||||
- _Metallic: 0
|
||||
- _MetallicRemapMax: 1
|
||||
- _MetallicRemapMin: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _ObjectSpaceUVMapping: 0
|
||||
- _ObjectSpaceUVMappingEmissive: 0
|
||||
- _OpaqueCullMode: 2
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _RayTracing: 0
|
||||
- _ReceivesSSR: 1
|
||||
- _ReceivesSSRTransparent: 0
|
||||
- _RefractionModel: 0
|
||||
- _RenderQueueType: 1
|
||||
- _RequireSplitLighting: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SpecularOcclusionMode: 1
|
||||
- _SrcBlend: 1
|
||||
- _StencilRef: 0
|
||||
- _StencilRefDepth: 8
|
||||
- _StencilRefDistortionVec: 4
|
||||
- _StencilRefGBuffer: 10
|
||||
- _StencilRefMV: 40
|
||||
- _StencilWriteMask: 6
|
||||
- _StencilWriteMaskDepth: 9
|
||||
- _StencilWriteMaskDistortionVec: 4
|
||||
- _StencilWriteMaskGBuffer: 15
|
||||
- _StencilWriteMaskMV: 41
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransmissionMask: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _TransparentZWrite: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _ZTestDepthEqualForOpaque: 3
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- Color_2E5415DE: {r: 1, g: 1, b: 1, a: 0}
|
||||
- Vector2_8044833E: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
8
Assets/Shaders/Demo.mat.meta
generated
Normal file
8
Assets/Shaders/Demo.mat.meta
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21daf69e5bdbbee4dbcf376746ef2f7e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3138
Assets/Shaders/Demo.shadergraph
Normal file
3138
Assets/Shaders/Demo.shadergraph
Normal file
File diff suppressed because it is too large
Load Diff
10
Assets/Shaders/Demo.shadergraph.meta
generated
Normal file
10
Assets/Shaders/Demo.shadergraph.meta
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8da30c3b74c073944b750388446f9e0c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
8
Assets/Shaders/HLSL.meta
generated
Normal file
8
Assets/Shaders/HLSL.meta
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a98fb509ee6f0f8418b1753b934d0d8e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
118
Assets/Shaders/HLSL/CustomLighting.hlsl
Normal file
118
Assets/Shaders/HLSL/CustomLighting.hlsl
Normal file
@@ -0,0 +1,118 @@
|
||||
#ifndef CUSTOM_LIGHTING_INCLUDED
|
||||
#define CUSTOM_LIGHTING_INCLUDED
|
||||
|
||||
void MainLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float DistanceAtten, out float ShadowAtten)
|
||||
{
|
||||
#if SHADERGRAPH_PREVIEW
|
||||
Direction = float3(0.5, 0.5, 0);
|
||||
Color = 1;
|
||||
DistanceAtten = 1;
|
||||
ShadowAtten = 1;
|
||||
#else
|
||||
#if SHADOWS_SCREEN
|
||||
float4 clipPos = TransformWorldToHClip(WorldPos);
|
||||
float4 shadowCoord = ComputeScreenPos(clipPos);
|
||||
#else
|
||||
float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
|
||||
#endif
|
||||
Light mainLight = GetMainLight(shadowCoord);
|
||||
Direction = mainLight.direction;
|
||||
Color = mainLight.color;
|
||||
DistanceAtten = mainLight.distanceAttenuation;
|
||||
ShadowAtten = mainLight.shadowAttenuation;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainLight_half(float3 WorldPos, out half3 Direction, out half3 Color, out half DistanceAtten, out half ShadowAtten)
|
||||
{
|
||||
#if SHADERGRAPH_PREVIEW
|
||||
Direction = half3(0.5, 0.5, 0);
|
||||
Color = 1;
|
||||
DistanceAtten = 1;
|
||||
ShadowAtten = 1;
|
||||
#else
|
||||
#if SHADOWS_SCREEN
|
||||
half4 clipPos = TransformWorldToHClip(WorldPos);
|
||||
half4 shadowCoord = ComputeScreenPos(clipPos);
|
||||
#else
|
||||
half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
|
||||
#endif
|
||||
Light mainLight = GetMainLight(shadowCoord);
|
||||
Direction = mainLight.direction;
|
||||
Color = mainLight.color;
|
||||
DistanceAtten = mainLight.distanceAttenuation;
|
||||
ShadowAtten = mainLight.shadowAttenuation;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DirectSpecular_float(float3 Specular, float Smoothness, float3 Direction, float3 Color, float3 WorldNormal, float3 WorldView, out float3 Out)
|
||||
{
|
||||
#if SHADERGRAPH_PREVIEW
|
||||
Out = 0;
|
||||
#else
|
||||
Smoothness = exp2(10 * Smoothness + 1);
|
||||
WorldNormal = normalize(WorldNormal);
|
||||
WorldView = SafeNormalize(WorldView);
|
||||
Out = LightingSpecular(Color, Direction, WorldNormal, WorldView, float4(Specular, 0), Smoothness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DirectSpecular_half(half3 Specular, half Smoothness, half3 Direction, half3 Color, half3 WorldNormal, half3 WorldView, out half3 Out)
|
||||
{
|
||||
#if SHADERGRAPH_PREVIEW
|
||||
Out = 0;
|
||||
#else
|
||||
Smoothness = exp2(10 * Smoothness + 1);
|
||||
WorldNormal = normalize(WorldNormal);
|
||||
WorldView = SafeNormalize(WorldView);
|
||||
Out = LightingSpecular(Color, Direction, WorldNormal, WorldView,half4(Specular, 0), Smoothness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AdditionalLights_float(float3 SpecColor, float Smoothness, float3 WorldPosition, float3 WorldNormal, float3 WorldView, out float3 Diffuse, out float3 Specular)
|
||||
{
|
||||
float3 diffuseColor = 0;
|
||||
float3 specularColor = 0;
|
||||
|
||||
#ifndef SHADERGRAPH_PREVIEW
|
||||
Smoothness = exp2(10 * Smoothness + 1);
|
||||
WorldNormal = normalize(WorldNormal);
|
||||
WorldView = SafeNormalize(WorldView);
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
for (int i = 0; i < pixelLightCount; ++i)
|
||||
{
|
||||
Light light = GetAdditionalLight(i, WorldPosition);
|
||||
half3 attenuatedLightColor = light.color * (light.distanceAttenuation * light.shadowAttenuation);
|
||||
diffuseColor += LightingLambert(attenuatedLightColor, light.direction, WorldNormal);
|
||||
specularColor += LightingSpecular(attenuatedLightColor, light.direction, WorldNormal, WorldView, float4(SpecColor, 0), Smoothness);
|
||||
}
|
||||
#endif
|
||||
|
||||
Diffuse = diffuseColor;
|
||||
Specular = specularColor;
|
||||
}
|
||||
|
||||
void AdditionalLights_half(half3 SpecColor, half Smoothness, half3 WorldPosition, half3 WorldNormal, half3 WorldView, out half3 Diffuse, out half3 Specular)
|
||||
{
|
||||
half3 diffuseColor = 0;
|
||||
half3 specularColor = 0;
|
||||
|
||||
#ifndef SHADERGRAPH_PREVIEW
|
||||
Smoothness = exp2(10 * Smoothness + 1);
|
||||
WorldNormal = normalize(WorldNormal);
|
||||
WorldView = SafeNormalize(WorldView);
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
for (int i = 0; i < pixelLightCount; ++i)
|
||||
{
|
||||
Light light = GetAdditionalLight(i, WorldPosition);
|
||||
half3 attenuatedLightColor = light.color * (light.distanceAttenuation * light.shadowAttenuation);
|
||||
diffuseColor += LightingLambert(attenuatedLightColor, light.direction, WorldNormal);
|
||||
specularColor += LightingSpecular(attenuatedLightColor, light.direction, WorldNormal, WorldView, half4(SpecColor, 0), Smoothness);
|
||||
}
|
||||
#endif
|
||||
|
||||
Diffuse = diffuseColor;
|
||||
Specular = specularColor;
|
||||
}
|
||||
|
||||
#endif
|
||||
9
Assets/Shaders/HLSL/CustomLighting.hlsl.meta
generated
Normal file
9
Assets/Shaders/HLSL/CustomLighting.hlsl.meta
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd96fa3ae441a2a43a4be1835e3752d0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/Shaders/cginc.meta
generated
Normal file
3
Assets/Shaders/cginc.meta
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 418b46fe3781488b870cae6b6f02262b
|
||||
timeCreated: 1587814505
|
||||
44
Assets/Shaders/cginc/DitheringPatterns.cginc
Normal file
44
Assets/Shaders/cginc/DitheringPatterns.cginc
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef DITHERING_PATTERNS_INCLUDED
|
||||
#define DITHERING_PATTERNS_INCLUDED
|
||||
|
||||
float4x4 binary = float4x4
|
||||
(
|
||||
0 , 1 , 0 , 1 ,
|
||||
1 , 0 , 1 , 0 ,
|
||||
0 , 1 , 0 , 1 ,
|
||||
1 , 0 , 1 , 0
|
||||
);
|
||||
|
||||
float4x4 binaryDecimal = float4x4
|
||||
(
|
||||
0.23 , 0.2 , 0.6 , 0.2 ,
|
||||
0.2 , 0.43 , 0.2 , 0.77,
|
||||
0.88 , 0.2 , 0.87 , 0.2 ,
|
||||
0.2 , 0.46 , 0.2 , 0
|
||||
);
|
||||
|
||||
float4x4 dotted = float4x4
|
||||
(
|
||||
-4.0, 0.0, -3.0, 1.0,
|
||||
2.0, -2.0, 3.0, -1.0,
|
||||
-3.0, 1.0, -4.0, 0.0,
|
||||
3.0, -1.0, 2.0, -2.0
|
||||
);
|
||||
|
||||
float4x4 hatched = float4x4
|
||||
(
|
||||
1 , 0 , 0 , 1 ,
|
||||
0 , 1 , 1 , 0 ,
|
||||
0 , 1 , 1 , 0 ,
|
||||
1 , 0 , 0 , 1
|
||||
);
|
||||
|
||||
float4x4 mono = float4x4
|
||||
(
|
||||
1 , 1 , 1 , 1 ,
|
||||
1 , 1 , 1 , 1 ,
|
||||
1 , 1 , 1 , 1 ,
|
||||
1 , 1 , 1 , 1
|
||||
);
|
||||
|
||||
#endif
|
||||
3
Assets/Shaders/cginc/DitheringPatterns.cginc.meta
generated
Normal file
3
Assets/Shaders/cginc/DitheringPatterns.cginc.meta
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc17ccdbbf9044d983e87e1c546c8d6a
|
||||
timeCreated: 1587814523
|
||||
129
Assets/Shaders/cginc/voronoi.cginc
Normal file
129
Assets/Shaders/cginc/voronoi.cginc
Normal file
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// Noise Shader Library for Unity - https://github.com/keijiro/NoiseShader
|
||||
//
|
||||
// Original work (webgl-noise) Copyright (C) 2011 Stefan Gustavson
|
||||
// Translation and modification was made by Keijiro Takahashi.
|
||||
//
|
||||
// This shader is based on the webgl-noise GLSL shader. For further details
|
||||
// of the original shader, please see the following description from the
|
||||
// original source code.
|
||||
//
|
||||
|
||||
//
|
||||
// GLSL textureless classic 2D noise "cnoise",
|
||||
// with an RSL-style periodic variant "pnoise".
|
||||
// Author: Stefan Gustavson (stefan.gustavson@liu.se)
|
||||
// Version: 2011-08-22
|
||||
//
|
||||
// Many thanks to Ian McEwan of Ashima Arts for the
|
||||
// ideas for permutation and gradient selection.
|
||||
//
|
||||
// Copyright (c) 2011 Stefan Gustavson. All rights reserved.
|
||||
// Distributed under the MIT license. See LICENSE file.
|
||||
// https://github.com/ashima/webgl-noise
|
||||
//
|
||||
|
||||
float4 mod(float4 x, float4 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 mod289(float4 x)
|
||||
{
|
||||
return x - floor(x / 289.0) * 289.0;
|
||||
}
|
||||
|
||||
float4 permute(float4 x)
|
||||
{
|
||||
return mod289(((x*34.0)+1.0)*x);
|
||||
}
|
||||
|
||||
float4 taylorInvSqrt(float4 r)
|
||||
{
|
||||
return (float4)1.79284291400159 - r * 0.85373472095314;
|
||||
}
|
||||
|
||||
float2 fade(float2 t) {
|
||||
return t*t*t*(t*(t*6.0-15.0)+10.0);
|
||||
}
|
||||
|
||||
// Classic Perlin noise
|
||||
float cnoise(float2 P)
|
||||
{
|
||||
float4 Pi = floor(P.xyxy) + float4(0.0, 0.0, 1.0, 1.0);
|
||||
float4 Pf = frac (P.xyxy) - float4(0.0, 0.0, 1.0, 1.0);
|
||||
Pi = mod289(Pi); // To avoid truncation effects in permutation
|
||||
float4 ix = Pi.xzxz;
|
||||
float4 iy = Pi.yyww;
|
||||
float4 fx = Pf.xzxz;
|
||||
float4 fy = Pf.yyww;
|
||||
|
||||
float4 i = permute(permute(ix) + iy);
|
||||
|
||||
float4 gx = frac(i / 41.0) * 2.0 - 1.0 ;
|
||||
float4 gy = abs(gx) - 0.5 ;
|
||||
float4 tx = floor(gx + 0.5);
|
||||
gx = gx - tx;
|
||||
|
||||
float2 g00 = float2(gx.x,gy.x);
|
||||
float2 g10 = float2(gx.y,gy.y);
|
||||
float2 g01 = float2(gx.z,gy.z);
|
||||
float2 g11 = float2(gx.w,gy.w);
|
||||
|
||||
float4 norm = taylorInvSqrt(float4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
|
||||
g00 *= norm.x;
|
||||
g01 *= norm.y;
|
||||
g10 *= norm.z;
|
||||
g11 *= norm.w;
|
||||
|
||||
float n00 = dot(g00, float2(fx.x, fy.x));
|
||||
float n10 = dot(g10, float2(fx.y, fy.y));
|
||||
float n01 = dot(g01, float2(fx.z, fy.z));
|
||||
float n11 = dot(g11, float2(fx.w, fy.w));
|
||||
|
||||
float2 fade_xy = fade(Pf.xy);
|
||||
float2 n_x = lerp(float2(n00, n01), float2(n10, n11), fade_xy.x);
|
||||
float n_xy = lerp(n_x.x, n_x.y, fade_xy.y);
|
||||
return 2.3 * n_xy;
|
||||
}
|
||||
|
||||
// Classic Perlin noise, periodic variant
|
||||
float pnoise(float2 P, float2 rep)
|
||||
{
|
||||
float4 Pi = floor(P.xyxy) + float4(0.0, 0.0, 1.0, 1.0);
|
||||
float4 Pf = frac (P.xyxy) - float4(0.0, 0.0, 1.0, 1.0);
|
||||
Pi = mod(Pi, rep.xyxy); // To create noise with explicit period
|
||||
Pi = mod289(Pi); // To avoid truncation effects in permutation
|
||||
float4 ix = Pi.xzxz;
|
||||
float4 iy = Pi.yyww;
|
||||
float4 fx = Pf.xzxz;
|
||||
float4 fy = Pf.yyww;
|
||||
|
||||
float4 i = permute(permute(ix) + iy);
|
||||
|
||||
float4 gx = frac(i / 41.0) * 2.0 - 1.0 ;
|
||||
float4 gy = abs(gx) - 0.5 ;
|
||||
float4 tx = floor(gx + 0.5);
|
||||
gx = gx - tx;
|
||||
|
||||
float2 g00 = float2(gx.x,gy.x);
|
||||
float2 g10 = float2(gx.y,gy.y);
|
||||
float2 g01 = float2(gx.z,gy.z);
|
||||
float2 g11 = float2(gx.w,gy.w);
|
||||
|
||||
float4 norm = taylorInvSqrt(float4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
|
||||
g00 *= norm.x;
|
||||
g01 *= norm.y;
|
||||
g10 *= norm.z;
|
||||
g11 *= norm.w;
|
||||
|
||||
float n00 = dot(g00, float2(fx.x, fy.x));
|
||||
float n10 = dot(g10, float2(fx.y, fy.y));
|
||||
float n01 = dot(g01, float2(fx.z, fy.z));
|
||||
float n11 = dot(g11, float2(fx.w, fy.w));
|
||||
|
||||
float2 fade_xy = fade(Pf.xy);
|
||||
float2 n_x = lerp(float2(n00, n01), float2(n10, n11), fade_xy.x);
|
||||
float n_xy = lerp(n_x.x, n_x.y, fade_xy.y);
|
||||
return 2.3 * n_xy;
|
||||
}
|
||||
3
Assets/Shaders/cginc/voronoi.cginc.meta
generated
Normal file
3
Assets/Shaders/cginc/voronoi.cginc.meta
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a56186e6fc2480ab1e17d1d6012060e
|
||||
timeCreated: 1587482833
|
||||
Reference in New Issue
Block a user