浏览代码

Updated test scene for distortion

/stochastic_alpha_test
Frédéric Vauchelles 7 年前
当前提交
9b91c67c
共有 9 个文件被更改,包括 329 次插入15 次删除
  1. 73
      SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap.shader
  2. 4
      SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_2DNoise.mat
  3. 3
      SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_2DNoise.mat
  4. 8
      SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_Ripple.mat
  5. 9
      SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Reject.mat
  6. 48
      SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap_Voronoi.asset
  7. 10
      SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap_Voronoi.asset.meta
  8. 179
      SampleScenes/HDTest/GraphicTest/Common/CustomTexture/Mat_DistortionMap_Voronoi.mat
  9. 10
      SampleScenes/HDTest/GraphicTest/Common/CustomTexture/Mat_DistortionMap_Voronoi.mat.meta

73
SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap.shader


float3 permute(float3 x) { return ((x*34.0) + 1.0)*x % 289.0; }
float2 rand2(float2 p)
{
return frac(sin(float2(dot(p, float2(64321.9843, 8143.18321)), dot(p, float2(8312.153, 3218.1984)))) * 13218.2165);
}
#define SDF_VORONOI(pointTransform, name) float name(float2 value)\
{\
float2 o = floor(value);\
float2 f = frac(value);\
float r = 1;\
for (int y = -1; y <= 1; ++y)\
{\
for (int x = -1; x <= 1; ++x)\
{\
float2 cell = float2(float(x), float(y));\
float2 pCS = rand2(cell + o);\
pCS = pointTransform(pCS);\
float2 diff = cell + pCS - f;\
float dist = length(diff);\
\
r = min(r, dist);\
}\
}\
\
return r;\
}
#define SDF_GRADIENT(sdf, name) float2 name(float2 value)\
{\
const float2 d = float2(0.0, 0.0001);\
float f00 = sdf(value + d.xx);\
float f01 = sdf(value + d.xy);\
float f10 = sdf(value + d.yx);\
float f11 = sdf(value + d.yy);\
return float2((f10 - f00 + f11 - f10) * 0.5, (f01 - f00 + f11 - f10) * 0.5);\
}
float snoise(float2 v) {
const float4 C = float4(0.211324865405187, 0.366025403784439,
-0.577350269189626, 0.024390243902439);

ENDCG
}
Pass
{
Name "Ripple"

float2 distortion = sin(n3.xy * s) * _DistortionAmplitude;
float blur = (min(t, 1-t) * 2) * (_BlurMaxAmplitude - _BlurMinAmplitude) + _BlurMinAmplitude;
return float4(distortion, blur, 1.0);
}
ENDCG
}
Pass
{
Name "Voronoi"
CGPROGRAM
#include "UnityCustomRenderTexture.cginc"
#pragma vertex CustomRenderTextureVertexShader
#pragma fragment frag
#pragma target 3.0
float2 circlePoint(float2 p)
{
p = 0.5 + 0.5 * sin(_Time.w * 0.2 + 6.2831 * p);
return p;
}
SDF_VORONOI(circlePoint, sdfVoronoi)
SDF_GRADIENT(sdfVoronoi, sdfVoronoiGrad)
float4 frag(v2f_customrendertexture IN) : COLOR
{
float2 uv = IN.globalTexcoord.xy * _Size;
float v = sdfVoronoi(uv);
v = v * v * v;
float2 distortion = sdfVoronoiGrad(uv);
float blur = v * (_BlurMaxAmplitude - _BlurMinAmplitude) + _BlurMinAmplitude;
return float4(distortion, blur, 1.0);
}

4
SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_2DNoise.mat


- _DistortionBlendMode: 0
- _DistortionBlendOp: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurSrcBlend: 0
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 0
- _DistortionDstBlend: 1
- _DistortionEnable: 1

3
SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_2DNoise.mat


- GBuffer
- META
- SHADOWCASTER
- DepthOnly
- TransparentDepthPrepass
- TransparentDepthPrepass
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

8
SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Only_Ripple.mat


stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- MOTIONVECTORS
- DepthOnly
- MOTIONVECTORS
- DepthOnly
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DistortionBlendOp: 21
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurScale: 1
- _DistortionBlurScale: 0.57
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 1

- _DistortionScale: 1
- _DistortionScale: 1.54
- _DistortionSrcBlend: 1
- _DistortionStencilRef: 4
- _DoubleSidedEnable: 0

9
SampleScenes/HDTest/GraphicTest/Common/Material/Mat_Distorsion_Lit_Reject.mat


stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- GBuffer
- META
- SHADOWCASTER
- DepthOnly
- Forward
- Forward
- GBuffer
- META
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

48
SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap_Voronoi.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!86 &8600000
CustomRenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: DistortionMap_Voronoi
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 1024
m_Height: 1024
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 11
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_Material: {fileID: 2100000, guid: 8ac64f99a42c6e64ebae3fc8bb262751, type: 2}
m_InitSource: 1
m_InitMaterial: {fileID: 2100000, guid: 8ac64f99a42c6e64ebae3fc8bb262751, type: 2}
m_InitColor: {r: 1, g: 0, b: 0, a: 0}
m_InitTexture: {fileID: 2800000, guid: 8abdc3adb95657847a5a8f760fdfc843, type: 3}
m_UpdateMode: 1
m_InitializationMode: 1
m_UpdateZoneSpace: 0
m_CurrentUpdateZoneSpace: 0
m_UpdateZones: []
m_UpdatePeriod: 0
m_ShaderPass: 2
m_CubemapFaceMask: 4294967295
m_DoubleBuffered: 0
m_WrapUpdateZones: 0

10
SampleScenes/HDTest/GraphicTest/Common/CustomTexture/DistortionMap_Voronoi.asset.meta


fileFormatVersion: 2
guid: 857ebf2cca737d54194a3a1077fec4cc
timeCreated: 1507196714
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8600000
userData:
assetBundleName:
assetBundleVariant:

179
SampleScenes/HDTest/GraphicTest/Common/CustomTexture/Mat_DistortionMap_Voronoi.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Mat_DistortionMap_Ripple
m_Shader: {fileID: 4800000, guid: 6a35625f46490314eb2456e4538d20ec, type: 3}
m_ShaderKeywords: _ALBEDOAFFECTEMISSIVE_OFF _ALPHACUTOFFENABLE_OFF _DEPTHOFFSETENABLE_OFF
_DISTORTIONDEPTHTEST_OFF _DISTORTIONENABLE_OFF _DISTORTIONONLY_OFF _DOUBLESIDEDENABLE_OFF
_ENABLEPERPIXELDISPLACEMENT_OFF _ENABLESPECULAROCCLUSION_OFF _ENABLEVERTEXDISPLACEMENT_OFF
_ENABLEWIND_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
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}
- _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}
- _SubsurfaceRadiusMap:
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}
- _Tex:
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}
m_Floats:
- _ATDistance: 1
- _AlbedoAffectEmissive: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _Amplitude: 205.16
- _Anisotropy: 0
- _BlendMode: 0
- _BlurAmplitude: 1
- _BlurMaxAmplitude: 0.93
- _BlurMinAmplitude: 0
- _CoatCoverage: 1
- _CoatIOR: 0.5
- _CullMode: 2
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DistorsionAmplitude: 52
- _DistortionAmplitude: 50.98
- _DistortionDepthTest: 0
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EmissiveIntensity: 0
- _EnablePerPixelDisplacement: 0
- _EnableSpecularOcclusion: 0
- _EnableVertexDisplacement: 0
- _EnableWind: 0
- _Float: 2.23
- _Glossiness: 0.5
- _HeightAmplitude: 0.01
- _HeightCenter: 0.5
- _HeightMax: 1
- _HeightMin: -1
- _IOR: 1
- _InitialBend: 1
- _MaterialID: 1
- _Metallic: 0
- _NoiseAmplitude: 0.294
- _NoiseLacunarity: 2.73
- _NormalMapSpace: 0
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PerPixelDisplacementObjectScale: 1
- _RefractionMode: 0
- _ShiverDirectionality: 0.5
- _ShiverDrag: 0.2
- _Size: 2.27
- _Smoothness: 1
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SrcBlend: 1
- _StencilRef: 2
- _Stiffness: 1
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _SurfaceType: 0
- _TexWorldScale: 1
- _Thickness: 1
- _ThicknessMultiplier: 1
- _UVBase: 0
- _UVDetail: 0
- _VertexDisplacementObjectScale: 1
- _VertexDisplacementTilingScale: 1
- _ZTestMode: 8
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.6691177, g: 0.30503896, b: 0.30503896, a: 1}
- _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}
- _RidgeThreshold: {r: 0.2, g: 0.2, b: 0.3, a: 0}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _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}

10
SampleScenes/HDTest/GraphicTest/Common/CustomTexture/Mat_DistortionMap_Voronoi.mat.meta


fileFormatVersion: 2
guid: b555ea09a7c584740be0313f42a6c6af
timeCreated: 1507196726
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存