generated from raccoon/vrchat-project-template
New clouds shader
This commit is contained in:
8
Assets/dbl-world/shaders.meta
Normal file
8
Assets/dbl-world/shaders.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9864b0c31a4a2e34ea6d65f09f9e0bb6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/dbl-world/shaders/minecraft.meta
Normal file
8
Assets/dbl-world/shaders/minecraft.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9c568c7e28103c4587d8483f01439cb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
Shader "Custom/CloudsShader"
|
/*
|
||||||
|
* Custom shader for Minecraft clouds
|
||||||
|
* Acts like "UnlitTwoTexture" from Source
|
||||||
|
* Fades with fog
|
||||||
|
*/
|
||||||
|
Shader "Custom/Minecraft/Clouds"
|
||||||
{
|
{
|
||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
@@ -15,7 +20,7 @@ Shader "Custom/CloudsShader"
|
|||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
|
Tags { "RenderType"="Opaque" }
|
||||||
Blend One One // Additive blending
|
Blend One One // Additive blending
|
||||||
ZWrite Off
|
ZWrite Off
|
||||||
Cull Off
|
Cull Off
|
||||||
@@ -25,11 +30,24 @@ Shader "Custom/CloudsShader"
|
|||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
// make fog work
|
|
||||||
#pragma multi_compile_fog
|
#pragma multi_compile_fog
|
||||||
|
|
||||||
#include "UnityCG.cginc"
|
#include "UnityCG.cginc"
|
||||||
|
|
||||||
|
struct appdata
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float2 uv1 : TEXCOORD0;
|
||||||
|
float2 uv2 : TEXCOORD1;
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
float3 viewPos : TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
sampler2D _MainTex;
|
sampler2D _MainTex;
|
||||||
float4 _MainTex_ST;
|
float4 _MainTex_ST;
|
||||||
half _MainTexScrollX;
|
half _MainTexScrollX;
|
||||||
@@ -42,31 +60,23 @@ Shader "Custom/CloudsShader"
|
|||||||
|
|
||||||
float4 _Color;
|
float4 _Color;
|
||||||
|
|
||||||
struct appdata
|
// Fog globals
|
||||||
{
|
uniform float unity_FogStart;
|
||||||
float4 vertex : POSITION;
|
uniform float unity_FogEnd;
|
||||||
float2 uv : TEXCOORD0;
|
uniform float unity_FogDensity;
|
||||||
};
|
|
||||||
|
|
||||||
struct v2f
|
|
||||||
{
|
|
||||||
float2 uv1 : TEXCOORD0;
|
|
||||||
float2 uv2 : TEXCOORD1;
|
|
||||||
float4 vertex : SV_POSITION;
|
|
||||||
UNITY_FOG_COORDS(2)
|
|
||||||
};
|
|
||||||
|
|
||||||
v2f vert (appdata v)
|
v2f vert (appdata v)
|
||||||
{
|
{
|
||||||
v2f o;
|
v2f o;
|
||||||
|
float4 worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||||
|
float4 viewPos = mul(UNITY_MATRIX_V, worldPos);
|
||||||
|
o.viewPos = viewPos.xyz;
|
||||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
|
||||||
// Textures scrolling
|
// Textures scrolling
|
||||||
o.uv1 = TRANSFORM_TEX(v.uv, _MainTex) + float2(_MainTexScrollX, _MainTexScrollY) * _Time.y;
|
o.uv1 = TRANSFORM_TEX(v.uv, _MainTex) + float2(_MainTexScrollX, _MainTexScrollY) * _Time.y;
|
||||||
o.uv2 = TRANSFORM_TEX(v.uv, _NoiseTex) + float2(_NoiseTexScrollX, _NoiseTexScrollY) * _Time.y;
|
o.uv2 = TRANSFORM_TEX(v.uv, _NoiseTex) + float2(_NoiseTexScrollX, _NoiseTexScrollY) * _Time.y;
|
||||||
|
|
||||||
UNITY_TRANSFER_FOG(o, o.vertex);
|
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,25 +85,28 @@ Shader "Custom/CloudsShader"
|
|||||||
fixed4 tex1 = tex2D(_MainTex, i.uv1);
|
fixed4 tex1 = tex2D(_MainTex, i.uv1);
|
||||||
fixed4 tex2 = tex2D(_NoiseTex, i.uv2);
|
fixed4 tex2 = tex2D(_NoiseTex, i.uv2);
|
||||||
fixed4 col = tex1 * tex2 * _Color;
|
fixed4 col = tex1 * tex2 * _Color;
|
||||||
// fixed4 col = _Color;
|
|
||||||
fixed4 fog = fixed4(0, 0, 0, 1);
|
|
||||||
/*
|
|
||||||
// Subtractive fog effect — fade to black
|
|
||||||
float dist = distance(_WorldSpaceCameraPos, i.worldPos);
|
|
||||||
float fogFactor = 1.0 - exp(-_FogDensity * dist);
|
|
||||||
fogFactor = saturate(fogFactor);
|
|
||||||
|
|
||||||
col.rgb *= (1.0 - fogFactor); // Fade to black
|
// Calculate fog factor
|
||||||
*/
|
float depth = abs(i.viewPos.z);
|
||||||
// Apply the fog
|
float fogFactor = 1.0;
|
||||||
// UNITY_APPLY_FOG(i.fogCoord, fog);
|
#if defined(FOG_LINEAR)
|
||||||
//col.rgb -= ; // Fade to black
|
fogFactor = saturate((unity_FogEnd - depth) / (unity_FogEnd - unity_FogStart));
|
||||||
|
#elif defined(FOG_EXP)
|
||||||
|
fogFactor = exp2(-unity_FogDensity * depth);
|
||||||
|
#elif defined(FOG_EXP2)
|
||||||
|
fogFactor = exp2(-unity_FogDensity * unity_FogDensity * depth * depth);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// col.rgb = lerp(fixed4(0,0,0,0).rgb, col.rgb, fogFactor);
|
||||||
|
|
||||||
|
col.rgb *= fogFactor; // Fade to black
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FallBack "Unlit/Transparent"
|
FallBack "Particles/Standard Unlit"
|
||||||
}
|
}
|
||||||
BIN
Assets/dbl-world/textures/environment/clouds_noise.png
LFS
Normal file
BIN
Assets/dbl-world/textures/environment/clouds_noise.png
LFS
Normal file
Binary file not shown.
127
Assets/dbl-world/textures/environment/clouds_noise.png.meta
Normal file
127
Assets/dbl-world/textures/environment/clouds_noise.png.meta
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9cd77ae0851eefa4f99352a90b944779
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user