补齐备份工程打开依赖
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3694e90a2c2614f4ca5b8d6abd67d1ee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
// WaterCausticsModules
|
||||
// Copyright (c) 2021 Masataka Hakozaki
|
||||
|
||||
#ifndef WCECF_SYNC_COMMON_INCLUDED
|
||||
#define WCECF_SYNC_COMMON_INCLUDED
|
||||
|
||||
#include "../../Effect/Shaders/WaterCausticsEffectCommon.hlsl"
|
||||
|
||||
CBUFFER_START(_WCECF_)
|
||||
float _WCECF_Density;
|
||||
int3 _WCECF_TexChannels;
|
||||
float2 _WCECF_TexRotateSinCos;
|
||||
int _WCECF_TilingSeed;
|
||||
float _WCECF_TilingRot;
|
||||
float _WCECF_TilingHard;
|
||||
float _WCECF_SurfaceY;
|
||||
float _WCECF_SurfFadeStart;
|
||||
float _WCECF_SurfFadeCoef;
|
||||
float _WCECF_DepthFadeStart;
|
||||
float _WCECF_DepthFadeCoef;
|
||||
float _WCECF_DistanceFadeStart;
|
||||
float _WCECF_DistanceFadeCoef;
|
||||
half _WCECF_IntensityMainLit;
|
||||
half _WCECF_IntensityAddLit;
|
||||
float2 _WCECF_ColorShift;
|
||||
half _WCECF_LitSaturation;
|
||||
half _WCECF_MultiplyIntensity;
|
||||
half _WCECF_NormalAtten;
|
||||
half _WCECF_NormalAttenRate;
|
||||
half _WCECF_TransparentBack;
|
||||
half _WCECF_BacksideShadow;
|
||||
half _WCECF_ShadowIntensity;
|
||||
int _WCECF_ClipOutside;
|
||||
int _WCECF_UseImageMask;
|
||||
float4x4 _WCECF_WorldToObjMatrix;
|
||||
CBUFFER_END
|
||||
|
||||
#if defined(WCE_USE_SAMPLER2D_INSTEAD_TEXTURE2D)
|
||||
sampler2D _WCECF_CausticsTex;
|
||||
sampler2D _WCECF_ImageMaskTex;
|
||||
#define WCE_TEX_PARAMS_RAW(texName) texName
|
||||
#define WCE_TEX_SAMPLE_RAW(texName, uv) tex2D(texName, uv)
|
||||
#else
|
||||
TEXTURE2D(_WCECF_CausticsTex);
|
||||
TEXTURE2D(_WCECF_ImageMaskTex);
|
||||
SAMPLER(sampler_WCECF_CausticsTex);
|
||||
SAMPLER(sampler_WCECF_ImageMaskTex);
|
||||
#define WCE_TEX_PARAMS_RAW(texName) texName, sampler##texName
|
||||
#define WCE_TEX_SAMPLE_RAW(texName, uv) texName.Sample(sampler##texName, (uv))
|
||||
#endif
|
||||
|
||||
|
||||
half3 WCECF_syncCore(float3 WorldPos, half3 NormalWS, float2 ScreenUV, half3 BaseColor, half aten) {
|
||||
half3 c = WCE_EffectCore(WorldPos, NormalWS, ScreenUV, WCE_TEX_PARAMS_RAW(_WCECF_CausticsTex), _WCECF_TexRotateSinCos, _WCECF_TexChannels, _WCECF_TilingSeed, _WCECF_TilingRot, _WCECF_TilingHard, _WCECF_Density, _WCECF_SurfaceY, _WCECF_SurfFadeStart, _WCECF_SurfFadeCoef, _WCECF_DepthFadeStart, _WCECF_DepthFadeCoef, _WCECF_IntensityMainLit * aten, _WCECF_IntensityAddLit * aten, _WCECF_ShadowIntensity, _WCECF_ColorShift, _WCECF_LitSaturation, _WCECF_NormalAtten, _WCECF_NormalAttenRate, _WCECF_TransparentBack, _WCECF_BacksideShadow);
|
||||
|
||||
c *= 1 - (1 - BaseColor) * _WCECF_MultiplyIntensity;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
half3 WCECF_SyncCommon(float3 WorldPos, half3 NormalWS, float2 ScreenUV, half3 BaseColor) {
|
||||
#if defined(_WCE_DISABLED)
|
||||
return half3(0, 0, 0);
|
||||
#elif defined(SHADERGRAPH_PREVIEW)
|
||||
return WCECF_syncCore(WorldPos, NormalWS, ScreenUV, BaseColor, 1);
|
||||
#else
|
||||
float atten = 1;
|
||||
const float ATTEN_TH = 0.001;
|
||||
// Distance Fade
|
||||
float3 viewDir = WorldPos - _WorldSpaceCameraPos; // ←ifに入れるとVR SinglePassでエラー
|
||||
[branch] if (_WCECF_DistanceFadeCoef > 0.0001) {
|
||||
atten *= smoothstep(0, 1, 1 - (length(viewDir) - _WCECF_DistanceFadeStart) * _WCECF_DistanceFadeCoef);
|
||||
}
|
||||
// Volume & Image Mask
|
||||
[branch] if (atten > ATTEN_TH && (_WCECF_ClipOutside != 0 || _WCECF_UseImageMask != 0)) {
|
||||
float3 posES = mul(_WCECF_WorldToObjMatrix, float4(WorldPos, 1)).xyz;
|
||||
[branch] if (atten > ATTEN_TH && _WCECF_ClipOutside != 0 && (abs(posES.x) > 0.5 || abs(posES.y) > 0.5 || abs(posES.z) > 0.5)) {
|
||||
atten = 0;
|
||||
}
|
||||
[branch] if (atten > ATTEN_TH && _WCECF_UseImageMask != 0) {
|
||||
atten *= WCE_TEX_SAMPLE_RAW(_WCECF_ImageMaskTex, posES.xz + 0.5).r;
|
||||
}
|
||||
}
|
||||
[branch] if (atten > ATTEN_TH) {
|
||||
return WCECF_syncCore(WorldPos, NormalWS, ScreenUV, BaseColor, atten);
|
||||
} else {
|
||||
return half3(0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// for ShaderGraph
|
||||
void WCECF_SyncForShaderGraph_float(float3 WorldPos, half3 NormalWS, float2 ScreenUV, half3 BaseColor, out half3 EmissionColor) {
|
||||
EmissionColor = WCECF_SyncCommon(WorldPos, NormalWS, ScreenUV, BaseColor);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 702e58733f1eade43bc3acab9149cd79
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e1bb73059427954f8a2c3b980c2ee68
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
// WaterCausticsModules
|
||||
// Copyright (c) 2021 Masataka Hakozaki
|
||||
|
||||
#ifndef WCECF_FOR_HLSL_INCLUDED
|
||||
#define WCECF_FOR_HLSL_INCLUDED
|
||||
|
||||
#define REQUIRE_OPAQUE_TEXTURE
|
||||
#include "../Common/WaterCausticsEmissionSync_Common.hlsl"
|
||||
|
||||
// --------------------------------------------
|
||||
// Custom Function (for HLSL Scripting)
|
||||
half3 WCE_WaterCausticsEmission(float3 WorldPos, half3 NormalWS, Texture2D CausticsTex, SamplerState CausticsTexSS, float2 TexRotSinCos = float2(0, 1), int3 TexChannels = int3(0, 1, 2), bool UseTiling = false, int TilingSeed = 0, float TilingRot = 0, float TilingHard = 0.85, float Density = 0.2, float SurfaceY = 2, float SurfFadeStart = 0, float SurfFadeEnd = 0.5, float DepthFadeStart = 0, float DepthFadeEnd = 10000, half MainLitIntensity = 1, half AddLitIntensity = 1, half ShadowIntensity = 1, float ColorShiftX = 0.4, float ColorShiftZ = -0.1, half LitSaturation = 0.2, half NormalAtten = 1, half NormalAttenRate = 2, half TransparentBack = 0, half BacksideShadow = 0) {
|
||||
|
||||
float4 posSS = ComputeScreenPos(TransformWorldToHClip(WorldPos));
|
||||
float2 ScreenUV = posSS.xy / posSS.w;
|
||||
float SurfFadeCoef = 1 / max(SurfFadeEnd - SurfFadeStart, 0.000001);
|
||||
float DepthFadeCoef = 1 / max(DepthFadeEnd - DepthFadeStart, 0.000001);
|
||||
float2 ColorShift = float2(ColorShiftX, ColorShiftZ) * 0.01;
|
||||
SurfFadeStart = max(SurfFadeStart, 0);
|
||||
TilingSeed = UseTiling ? max(TilingSeed, 0) : - 1;
|
||||
TilingHard = clamp(TilingHard, 0.75, 0.999);
|
||||
|
||||
half3 e = WCE_EffectCore(WorldPos, NormalWS, ScreenUV, CausticsTex, CausticsTexSS, TexRotSinCos, TexChannels, TilingSeed, TilingRot, TilingHard, Density, SurfaceY, SurfFadeStart, SurfFadeCoef, DepthFadeStart, DepthFadeCoef, MainLitIntensity, AddLitIntensity, ShadowIntensity, ColorShift, LitSaturation, NormalAtten, NormalAttenRate, TransparentBack, BacksideShadow);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
// Old 1.2.0
|
||||
half3 WCE_WaterCausticsEmission(float3 WorldPos, half3 NormalWS, Texture2D CausticsTex, SamplerState CausticsTexSS, float Scale, float SurfaceY, float SurfFadeWidth, float SurfFadeOffset, float DepthFadeCoef, half MainLitIntensity, half AddLitIntensity, float ColorShiftX, float ColorShiftZ, half LitSaturation, half NormalAtten, half NormalAttenRate, half TransparentBack) {
|
||||
float Density = 1 / max(Scale, 0.0001);
|
||||
float DepthFadeEnd = 1 / max(DepthFadeCoef, 0.000001);
|
||||
// to Newest
|
||||
return WCE_WaterCausticsEmission(WorldPos, NormalWS, CausticsTex, CausticsTexSS, float2(0, 1), int3(0, 1, 2), false, 0, 0, 0.85, Density, SurfaceY, SurfFadeOffset, SurfFadeWidth, 0, DepthFadeEnd, MainLitIntensity, AddLitIntensity, 1, ColorShiftX, ColorShiftZ, LitSaturation, NormalAtten, NormalAttenRate, TransparentBack, 0);
|
||||
}
|
||||
|
||||
// Old 1.1.4
|
||||
half3 WCE_WaterCausticsEmission(float3 WorldPos, half3 NormalWS, Texture2D CausticsTex, SamplerState CausticsTexSS, float Scale, float SurfaceY, float SurfFadeWidth, float SurfFadeOffset, half MainLitIntensity, half AddLitIntensity, float ColorShiftX, float ColorShiftZ, half LitSaturation, half NormalAtten, half NormalAttenRate, half TransparentBack) {
|
||||
|
||||
// to 1.2.0
|
||||
return WCE_WaterCausticsEmission(WorldPos, NormalWS, CausticsTex, CausticsTexSS, Scale, SurfaceY, SurfFadeWidth, SurfFadeOffset, 0, MainLitIntensity, AddLitIntensity, ColorShiftX, ColorShiftZ, LitSaturation, NormalAtten, NormalAttenRate, TransparentBack);
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// Custom Function Sync with effect script on the scene. (for HLSL Scripting)
|
||||
half3 WCE_WaterCausticsEmissionSync(float3 WorldPos, half3 NormalWS, half3 BaseColor = half3(1, 1, 1)) {
|
||||
float4 posSS = ComputeScreenPos(TransformWorldToHClip(WorldPos));
|
||||
float2 ScreenUV = posSS.xy / posSS.w;
|
||||
return WCECF_SyncCommon(WorldPos, NormalWS, ScreenUV, BaseColor);
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 832df1354b7c37f41842fd11b0365e8c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a3b2a20ed95082499666114b7e76013
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8410e5d1e5fac2b4196a22217f3f03e9
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||
@@ -0,0 +1,30 @@
|
||||
// WaterCausticsModules
|
||||
// Copyright (c) 2021 Masataka Hakozaki
|
||||
|
||||
#ifndef WCECF_FOR_SHADER_GRAPH_INCLUDED
|
||||
#define WCECF_FOR_SHADER_GRAPH_INCLUDED
|
||||
|
||||
#include "../../Effect/Shaders/WaterCausticsEffectCommon.hlsl"
|
||||
|
||||
// Custom Function (for ShaderGraph)
|
||||
void WCECF_Emission_float(float3 WorldPos, half3 NormalWS, float2 ScreenUV, UnityTexture2D CausticsTex, float2 TexRotSinCos, int3 TexChannels, bool UseTiling, int TilingSeed, float TilingRot, float TilingHard, float Density, float SurfaceY, float SurfFadeStart, float SurfFadeCoef, float DepthFadeStart, float DepthFadeCoef, half MainLitIntensity, half AddLitIntensity, half ShadowIntensity, float2 ColorShift, half LitSaturation, half NormalAtten, half NormalAttenRate, half TransparentBack, half BacksideShadow, out half3 EmissionColor) {
|
||||
|
||||
SurfFadeStart = max(SurfFadeStart, 0);
|
||||
TilingSeed = UseTiling ? max(TilingSeed, 0) : - 1;
|
||||
TilingHard = clamp(TilingHard, 0.75, 0.999);
|
||||
|
||||
half3 e = WCE_EffectCore(WorldPos, NormalWS, ScreenUV, CausticsTex.tex, CausticsTex.samplerstate, TexRotSinCos, TexChannels, TilingSeed, TilingRot, TilingHard, Density, SurfaceY, SurfFadeStart, SurfFadeCoef, DepthFadeStart, DepthFadeCoef, MainLitIntensity, AddLitIntensity, ShadowIntensity, ColorShift, LitSaturation, NormalAtten, NormalAttenRate, TransparentBack, BacksideShadow);
|
||||
|
||||
EmissionColor = e;
|
||||
}
|
||||
|
||||
// Custom Function Through
|
||||
void WCECF_EmissionThrough_float(float3 WorldPos, half3 NormalWS, float2 ScreenUV, UnityTexture2D CausticsTex, float2 TexRotSinCos, int3 TexChannels, int TilingSeed, float TilingRot, float TilingHard, float Density, float SurfaceY, float SurfFadeStart, float SurfFadeCoef, float DepthFadeStart, float DepthFadeCoef, half MainLitIntensity, half AddLitIntensity, half ShadowIntensity, float2 ColorShift, half LitSaturation, half NormalAtten, half NormalAttenRate, half TransparentBack, half BacksideShadow, out half3 EmissionColor) {
|
||||
|
||||
half3 e = WCE_EffectCore(WorldPos, NormalWS, ScreenUV, CausticsTex.tex, CausticsTex.samplerstate, TexRotSinCos, TexChannels, TilingSeed, TilingRot, TilingHard, Density, SurfaceY, SurfFadeStart, SurfFadeCoef, DepthFadeStart, DepthFadeCoef, MainLitIntensity, AddLitIntensity, ShadowIntensity, ColorShift, LitSaturation, NormalAtten, NormalAttenRate, TransparentBack, BacksideShadow);
|
||||
|
||||
EmissionColor = e;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab406b74f7edc354da8c8cad2f7f2b97
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dbc7b6e0e182924990f86f7fa2c8bbd
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||
Reference in New Issue
Block a user