유니티 셋팅

This commit is contained in:
2026-03-27 16:34:08 +09:00
parent 474bda26cd
commit d76f078a89
1400 changed files with 116263 additions and 0 deletions

View File

@@ -0,0 +1,272 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "MesshingAround/Liquid_Effect (Built-in)"
{
Properties
{
[Header(Surface Inputs)]
[Header(Main Color)]
[NoScaleOffset]_LUTTex ("GradientTexture", 2D) = "white" {}
[HDR]_TopColor ("Top Color", Color) = (0, 0.6946828, 0.764151, 1)
[HDR]_Tint ("Tint", Color) = (1,1,1,1)
[NoScaleOffset]_MainTex ("Main Texture", 2D) = "white" {}
_GradientIndex ("GradientIndex", Float) = 73.9
_GradientCount ("GradientCount", Float) = 110
[Header(Foam Edge)]
_LineSmooth ("Foam Smoothness", Range(0,0.3)) = 0.026
[HDR]_FoamColor ("Foam/EdgeColor", Color) = (1,1,1,1)
_Line ("FoamWidth", Range(0,0.3)) = 0
[Header(Sine)]
_Freq ("Frequency", Range(0,25)) = 0
_Amplitude ("Amplitude", Range(0,0.2)) = 0
[Header(Rim)]
_RimPower ("Rim Power", Range(0,5)) = 2.44
[HDR]_RimColor ("Rim Color", Color) = (0.693879, 1, 0.3254717, 1)
// Hidden properties set by script - DO NOT REMOVE
[HideInInspector]_WobbleX ("Wobble X", Float) = 0
[HideInInspector]_WobbleZ ("Wobble Z", Float) = 0
[HideInInspector]_FillAmount ("Fill Amount", Vector) = (0,0,0,0)
[HideInInspector][NoScaleOffset]_GrayscaleTex ("GrayScaleTexture", 2D) = "white" {}
}
SubShader
{
Tags {"Queue"="Geometry" "RenderType"="Opaque" "DisableBatching" = "True" }
Pass
{
Zwrite On
Cull Off
AlphaToMask On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile_instancing
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 viewDir : COLOR;
float3 normal : COLOR2;
float3 fillPosition : TEXCOORD2;
float3 worldNormal : TEXCOORD3;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
sampler2D _LUTTex;
sampler2D _GrayscaleTex;
// Non-instanced properties (fallback when instancing is disabled)
#if !defined(UNITY_INSTANCING_BUFFER_START)
float _GradientIndex;
float _GradientCount;
float3 _FillAmount;
float _WobbleX;
float _WobbleZ;
float4 _TopColor;
float4 _RimColor;
float4 _FoamColor;
float4 _Tint;
float _Line;
float _RimPower;
float _LineSmooth;
float _Freq;
float _Amplitude;
#endif
// GPU Instancing: Properties that can vary per instance
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientIndex)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientCount)
UNITY_DEFINE_INSTANCED_PROP(float3, _FillAmount)
UNITY_DEFINE_INSTANCED_PROP(float, _WobbleX)
UNITY_DEFINE_INSTANCED_PROP(float, _WobbleZ)
UNITY_DEFINE_INSTANCED_PROP(float4, _TopColor)
UNITY_DEFINE_INSTANCED_PROP(float4, _RimColor)
UNITY_DEFINE_INSTANCED_PROP(float4, _FoamColor)
UNITY_DEFINE_INSTANCED_PROP(float4, _Tint)
UNITY_DEFINE_INSTANCED_PROP(float, _Line)
UNITY_DEFINE_INSTANCED_PROP(float, _RimPower)
UNITY_DEFINE_INSTANCED_PROP(float, _LineSmooth)
UNITY_DEFINE_INSTANCED_PROP(float, _Freq)
UNITY_DEFINE_INSTANCED_PROP(float, _Amplitude)
UNITY_INSTANCING_BUFFER_END(Props)
float3 Unity_RotateAboutAxis_Degrees(float3 In, float3 Axis, float Rotation)
{
Rotation = radians(Rotation);
float s = sin(Rotation);
float c = cos(Rotation);
float one_minus_c = 1.0 - c;
Axis = normalize(Axis);
float3x3 rot_mat =
{ one_minus_c * Axis.x * Axis.x + c, one_minus_c * Axis.x * Axis.y - Axis.z * s, one_minus_c * Axis.z * Axis.x + Axis.y * s,
one_minus_c * Axis.x * Axis.y + Axis.z * s, one_minus_c * Axis.y * Axis.y + c, one_minus_c * Axis.y * Axis.z - Axis.x * s,
one_minus_c * Axis.z * Axis.x - Axis.y * s, one_minus_c * Axis.y * Axis.z + Axis.x * s, one_minus_c * Axis.z * Axis.z + c
};
float3 Out = mul(rot_mat, In);
return Out;
}
float4 SampleLUTFromGrayscale(float2 uv, float gradientIndex, float gradientCount)
{
float grayscaleValue = tex2D(_GrayscaleTex, uv).r;
float v = (round(gradientIndex) + 0.5) / gradientCount;
float2 lutUV = float2(grayscaleValue, v);
return tex2D(_LUTTex, lutUV);
}
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
// Access instanced properties
float wobbleX = UNITY_ACCESS_INSTANCED_PROP(Props, _WobbleX);
float wobbleZ = UNITY_ACCESS_INSTANCED_PROP(Props, _WobbleZ);
float3 fillAmount = UNITY_ACCESS_INSTANCED_PROP(Props, _FillAmount);
// Calculate world position of vertex
float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0)).xyz;
// Get object pivot position in world space (same as SHADERGRAPH_OBJECT_POSITION in URP)
float3 objectPosition = unity_ObjectToWorld._m03_m13_m23;
// Calculate position relative to object pivot
float3 worldPosRelative = worldPos - objectPosition;
// Apply fill amount offset
float3 worldPosOffset = worldPosRelative - fillAmount;
// Apply wobble rotations to the offset
float3 worldPosX = Unity_RotateAboutAxis_Degrees(worldPosOffset, float3(0,0,1), 90);
float3 worldPosZ = Unity_RotateAboutAxis_Degrees(worldPosOffset, float3(1,0,0), 90);
// Combine wobble effects
float3 wobbleOffset = (worldPosX * wobbleX) + (worldPosZ * wobbleZ);
// Final fill position: offset + wobble
o.fillPosition = worldPosOffset + wobbleOffset;
o.viewDir = normalize(WorldSpaceViewDir(v.vertex));
o.normal = v.normal;
o.worldNormal = normalize(mul((float3x3)unity_ObjectToWorld, v.normal));
return o;
}
fixed4 frag (v2f i, fixed facing : VFACE) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
bool isFrontFace = facing > 0;
// Access instanced properties
float wobbleX = UNITY_ACCESS_INSTANCED_PROP(Props, _WobbleX);
float wobbleZ = UNITY_ACCESS_INSTANCED_PROP(Props, _WobbleZ);
float amplitude = UNITY_ACCESS_INSTANCED_PROP(Props, _Amplitude);
float freq = UNITY_ACCESS_INSTANCED_PROP(Props, _Freq);
float gradientIndex = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientIndex);
float gradientCount = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientCount);
float4 topColor = UNITY_ACCESS_INSTANCED_PROP(Props, _TopColor);
float4 tint = UNITY_ACCESS_INSTANCED_PROP(Props, _Tint);
float4 foamColor = UNITY_ACCESS_INSTANCED_PROP(Props, _FoamColor);
float4 rimColor = UNITY_ACCESS_INSTANCED_PROP(Props, _RimColor);
float lineWidth = UNITY_ACCESS_INSTANCED_PROP(Props, _Line);
float lineSmooth = UNITY_ACCESS_INSTANCED_PROP(Props, _LineSmooth);
float rimPower = UNITY_ACCESS_INSTANCED_PROP(Props, _RimPower);
// Wobble intensity calculation
float wobbleIntensity = abs(wobbleX) + abs(wobbleZ);
// Sine wave wobble effect
float wobble = sin((i.fillPosition.x * freq) + (i.fillPosition.z * freq) + (_Time.y)) * (amplitude * wobbleIntensity);
// Moving fill position with wobble
float movingfillPosition = i.fillPosition.y + wobble;
// Sample textures and apply LUT with URP triple multiplication
fixed4 mainTex = tex2D(_MainTex, movingfillPosition.xx);
fixed4 lutColor = SampleLUTFromGrayscale(i.uv, gradientIndex, gradientCount);
// URP color system: MainTex * LUT * Tint
fixed4 col = mainTex * lutColor * tint;
UNITY_APPLY_FOG(i.fogCoord, col);
// Cutoff logic - step(movingfillPosition, 0.5)
float cutoffTop = step(movingfillPosition, 0.5);
// Foam calculation
float foamEdge1 = 0.5 - lineWidth - lineSmooth;
float foamEdge2 = 0.5 - lineWidth;
float foamSmooth = smoothstep(foamEdge1, foamEdge2, movingfillPosition);
float mainFoam = foamSmooth * cutoffTop;
// FRONT FACES
if (isFrontFace)
{
// Apply foam to front faces
float4 foamColored = mainFoam * foamColor;
float liquidMask = (1.0 - mainFoam);
float4 liquidColored = col * liquidMask;
// Rim light calculation (URP system)
float4 RimResult = float4(0,0,0,0);
if (rimPower > 0.001)
{
// URP: inverts power (5 - rimPower) for fresnel, then multiplies by original rimPower
float invertedPower = 5.0 - rimPower;
float fresnel = pow(1 - saturate(dot(i.worldNormal, i.viewDir)), invertedPower);
RimResult = fresnel * rimColor * rimPower;
}
float4 finalResult = liquidColored + foamColored;
finalResult.rgb += RimResult.rgb;
// Clip pixels above the fill line
clip(cutoffTop - 0.01);
return finalResult;
}
// BACK FACES - No foam on backfaces
else
{
clip(cutoffTop - 0.01);
// Solid top color on backfaces
return topColor;
}
}
ENDCG
}
}
}

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 1c3e88a3a83fa9144a772195aeb0d327
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 341020
packageName: Stylized Potions Pack - 110 Colors | Liquid Physics | URP + Built-in
packageVersion: 1.0
assetPath: Assets/MesshingAround/StylizedPotionsPack/Shaders/BuiltIn/Liquid_Effect.shader
uploadId: 811526

View File

@@ -0,0 +1,176 @@
Shader "MesshingAround/Stylized_Glass (Built-in)"
{
Properties
{
[Header(Surface Options)]
[Header(Outer Rim Light)]
_OuterRimpower("OuterRimpower", Range(0, 1)) = 0.015
_OuterRimSmoothness("OuterRimSmoothness", Range(0, 1)) = 0
_RimColor("RimColor", Color) = (0.7568628, 0.7568628, 0.7568628, 1)
[Header(Inner Rim Light)]
_InnerRimPower("InnerRimPower", Range(0, 0.5)) = 0.131
_InnerRimSmoothness("InnerRimSmoothness", Range(0, 0.5)) = 0.1
_InnerRimColor("InnerRimColor", Color) = (1, 1, 1, 1)
[Header(Glass Color)]
_Alpha("Alpha", Range(0, 1)) = 0
_MainTintColor("MainTintColor", Color) = (1, 1, 1, 0.1411765)
_GradientIndex("GradientIndex", Float) = 0
_GradientCount("GradientCount", Float) = 110
[NoScaleOffset]_GradientTexture("GradientTexture", 2D) = "white" {}
[Header(Specular Light)]
_LightCutoff("LightCutoff", Range(0, 1)) = 0
_LightCutoffSmoothness("LightCutoffSmoothness", Range(0, 1)) = 0.249
_ViewSpecCutoff("ViewSpecCutoff", Range(0, 1)) = 0.014
_SpecularColor("SpecularColor", Color) = (1, 1, 1, 1)
// Hidden properties
[HideInInspector][NoScaleOffset]_GrayscaleTex("GrayscaleTexture", 2D) = "white" {}
}
SubShader
{
Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True"}
LOD 200
// Match URP's Alpha blending
Blend One OneMinusSrcAlpha
ZWrite Off
CGPROGRAM
// Unlit shader to match URP Unlit behavior
#pragma surface surf Unlit alpha:blend noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nofog nometa noforwardadd
#pragma target 3.0
#pragma multi_compile_instancing
sampler2D _GrayscaleTex;
sampler2D _GradientTexture;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float, _OuterRimpower)
UNITY_DEFINE_INSTANCED_PROP(float, _OuterRimSmoothness)
UNITY_DEFINE_INSTANCED_PROP(float4, _RimColor)
UNITY_DEFINE_INSTANCED_PROP(float, _InnerRimPower)
UNITY_DEFINE_INSTANCED_PROP(float, _InnerRimSmoothness)
UNITY_DEFINE_INSTANCED_PROP(float4, _InnerRimColor)
UNITY_DEFINE_INSTANCED_PROP(float, _Alpha)
UNITY_DEFINE_INSTANCED_PROP(float4, _MainTintColor)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientIndex)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientCount)
UNITY_DEFINE_INSTANCED_PROP(float, _LightCutoff)
UNITY_DEFINE_INSTANCED_PROP(float, _LightCutoffSmoothness)
UNITY_DEFINE_INSTANCED_PROP(float, _ViewSpecCutoff)
UNITY_DEFINE_INSTANCED_PROP(float4, _SpecularColor)
UNITY_INSTANCING_BUFFER_END(Props)
// Unlit lighting model (no lighting)
half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten)
{
return half4(s.Albedo, s.Alpha);
}
struct Input
{
float2 uv_GrayscaleTex;
float3 worldNormal;
float3 viewDir;
float3 worldPos;
};
// Helper function: Sample LUT
float4 SampleLUT(float2 uv, float gradientIndex, float gradientCount)
{
float grayscale = tex2D(_GrayscaleTex, uv).r;
float v = (round(gradientIndex) + 0.5) / gradientCount;
float2 lutUV = float2(grayscale, v);
return tex2D(_GradientTexture, lutUV);
}
void surf (Input IN, inout SurfaceOutput o)
{
// Access instanced properties
float outerRimPower = UNITY_ACCESS_INSTANCED_PROP(Props, _OuterRimpower);
float outerRimSmoothness = UNITY_ACCESS_INSTANCED_PROP(Props, _OuterRimSmoothness);
float4 rimColor = UNITY_ACCESS_INSTANCED_PROP(Props, _RimColor);
float innerRimPower = UNITY_ACCESS_INSTANCED_PROP(Props, _InnerRimPower);
float innerRimSmoothness = UNITY_ACCESS_INSTANCED_PROP(Props, _InnerRimSmoothness);
float4 innerRimColor = UNITY_ACCESS_INSTANCED_PROP(Props, _InnerRimColor);
float alpha = UNITY_ACCESS_INSTANCED_PROP(Props, _Alpha);
float4 mainTintColor = UNITY_ACCESS_INSTANCED_PROP(Props, _MainTintColor);
float gradientIndex = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientIndex);
float gradientCount = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientCount);
float lightCutoff = UNITY_ACCESS_INSTANCED_PROP(Props, _LightCutoff);
float lightCutoffSmoothness = UNITY_ACCESS_INSTANCED_PROP(Props, _LightCutoffSmoothness);
float viewSpecCutoff = UNITY_ACCESS_INSTANCED_PROP(Props, _ViewSpecCutoff);
float4 specularColor = UNITY_ACCESS_INSTANCED_PROP(Props, _SpecularColor);
// Calculate vectors
float3 worldNormal = normalize(IN.worldNormal);
float3 worldViewDir = normalize(IN.viewDir);
float3 worldLightDir = normalize(_WorldSpaceLightPos0.xyz);
// Object space conversions
float3 objNormal = normalize(mul(worldNormal, (float3x3)unity_ObjectToWorld));
float3 objViewDir = normalize(mul((float3x3)unity_WorldToObject, worldViewDir));
float NdotV = saturate(dot(worldNormal, worldViewDir));
// === LUT COLOR SYSTEM ===
float4 lutColor = SampleLUT(IN.uv_GrayscaleTex, gradientIndex, gradientCount);
float4 lutWithAlpha = lutColor * alpha;
float4 baseColor = mainTintColor * lutWithAlpha;
// === OUTER RIM (Fresnel) ===
float outerRimPowerInverted = 1.0 - outerRimPower;
float fresnelOuter = pow(1.0 - NdotV, outerRimPowerInverted);
float outerEdge = 0.5 + outerRimSmoothness;
float outerRimMask = smoothstep(0.5, outerEdge, fresnelOuter);
float3 outerRimEmission = outerRimMask * rimColor.rgb;
// === INNER RIM (Fresnel from inside) ===
float fresnelInner = pow(1.0 - NdotV, innerRimPower);
float fresnelInnerInverted = 1.0 - fresnelInner;
float innerEdgeMin = 0.5 - innerRimSmoothness;
float innerRimMask = smoothstep(innerEdgeMin, 0.5, fresnelInnerInverted);
float3 innerRimEmission = innerRimMask * innerRimColor.rgb;
// === SPECULAR SYSTEM ===
float NdotL = dot(worldLightDir, worldNormal);
float lightSpec = smoothstep(0.5, 0.55, NdotL);
float3 lightMinusView = worldLightDir - objViewDir;
float combinedDot1 = dot(lightMinusView, objNormal);
float lightCutoffEdge = lightCutoff + lightCutoffSmoothness;
float combinedSpec1 = smoothstep(lightCutoff, lightCutoffEdge, combinedDot1);
float combinedDot2 = dot(objViewDir, objNormal);
float viewSpecInverted = 1.0 - viewSpecCutoff;
float viewSpecEdge = viewSpecInverted + lightCutoffSmoothness;
float combinedSpec2 = smoothstep(viewSpecInverted, viewSpecEdge, combinedDot2);
float totalCombinedSpec = combinedSpec1 + combinedSpec2;
float3 finalSpecular = specularColor.rgb * (lightSpec * totalCombinedSpec);
// === COMBINE - UNLIT LIKE URP ===
// URP combines EVERYTHING (including alpha channels) then saturates
// CRITICAL: InnerRim must contribute to alpha to be visible when baseColor alpha is low
float4 combinedColor = baseColor + float4(finalSpecular, 0) + float4(outerRimEmission, outerRimMask) + float4(innerRimEmission, innerRimMask);
float4 saturatedResult = saturate(combinedColor);
// Use the RGBA from the saturated result (like URP does)
float3 finalRGB = saturatedResult.rgb;
float finalAlpha = saturatedResult.a;
// Set surface properties (Unlit - no lighting)
o.Albedo = finalRGB;
o.Emission = float3(0, 0, 0);
o.Alpha = finalAlpha;
}
ENDCG
}
FallBack "Transparent/VertexLit"
}

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: a4594f712d3b2854f9428b2d994d2e19
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 341020
packageName: Stylized Potions Pack - 110 Colors | Liquid Physics | URP + Built-in
packageVersion: 1.0
assetPath: Assets/MesshingAround/StylizedPotionsPack/Shaders/BuiltIn/Stylized_Glass.shader
uploadId: 811526

View File

@@ -0,0 +1,99 @@
Shader "MesshingAround/Stylized_Tint (Built-in)"
{
Properties
{
[Header(Color)]
[Space(5)]
[NoScaleOffset]_GradientTexture("GradientTexture(LUT)", 2D) = "white" {}
_GradientIndex("GradientIndex", Float) = 48
_GradientCount("GradientCount", Float) = 110
[Header(Emission)]
[Space(5)]
_EmissionColor("EmissionColor", Color) = (0, 0, 0, 0)
_EmissionStrength("EmissionStrength", Float) = 0
[Header(Glossy)]
[Space(5)]
_Smoothness("Smoothness(Glossy)", Range(0, 1)) = 0
[HideInInspector] _GrayscaleTex("GrayscaleTex", 2D) = "white" {}
[HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
}
SubShader
{
Tags
{
"RenderType" = "Opaque"
"Queue" = "Geometry"
}
LOD 200
CGPROGRAM
#pragma surface surf StandardSpecular fullforwardshadows
#pragma target 3.0
#pragma multi_compile_instancing
sampler2D _GrayscaleTex;
sampler2D _GradientTexture;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientIndex)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientCount)
UNITY_DEFINE_INSTANCED_PROP(float4, _EmissionColor)
UNITY_DEFINE_INSTANCED_PROP(float, _EmissionStrength)
UNITY_DEFINE_INSTANCED_PROP(float, _Smoothness)
UNITY_INSTANCING_BUFFER_END(Props)
struct Input
{
float2 uv_GrayscaleTex;
};
// LUT sampling function - MATCHES URP EXACTLY
// Uses grayscale.r as U coordinate and calculated V from gradient index
float4 SampleLUTFromGrayscale(float2 uv, float gradientIndex, float gradientCount)
{
// Round the gradient index and add 0.5 (URP does this)
float roundedIndex = round(gradientIndex);
float adjustedIndex = roundedIndex + 0.5;
// Calculate V coordinate
float vCoord = adjustedIndex / gradientCount;
// Sample grayscale texture
float4 grayscaleSample = tex2D(_GrayscaleTex, uv);
// Use R channel as U coordinate (like URP)
float2 lutUV = float2(grayscaleSample.r, vCoord);
return tex2D(_GradientTexture, lutUV);
}
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
// Get instanced properties
float gradientIndex = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientIndex);
float gradientCount = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientCount);
float4 emissionColor = UNITY_ACCESS_INSTANCED_PROP(Props, _EmissionColor);
float emissionStrength = UNITY_ACCESS_INSTANCED_PROP(Props, _EmissionStrength);
float smoothness = UNITY_ACCESS_INSTANCED_PROP(Props, _Smoothness);
// Sample LUT using grayscale texture (set by PotionTextureSetup.cs)
float4 lutColor = SampleLUTFromGrayscale(IN.uv_GrayscaleTex, gradientIndex, gradientCount);
// Set surface properties
o.Albedo = lutColor.rgb;
o.Emission = emissionColor.rgb * emissionStrength;
o.Smoothness = smoothness;
o.Specular = float3(0, 0, 0);
o.Alpha = 1.0;
}
ENDCG
}
FallBack "Standard"
}

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 2be669ed92dad7541b2fd0b2421d40af
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 341020
packageName: Stylized Potions Pack - 110 Colors | Liquid Physics | URP + Built-in
packageVersion: 1.0
assetPath: Assets/MesshingAround/StylizedPotionsPack/Shaders/BuiltIn/Stylized_Tint.shader
uploadId: 811526

View File

@@ -0,0 +1,108 @@
Shader "MesshingAround/Stylized_Tint_OP (Built-in)"
{
Properties
{
[Header(Color)]
[Space(5)]
[NoScaleOffset]_GradientTexture("GradientTexture(LUT)", 2D) = "white" {}
_GradientIndex("GradientIndex", Float) = 48
_GradientCount("GradientCount", Float) = 110
[Header(Emission)]
[Space(5)]
_EmissionColor("EmissionColor", Color) = (0, 0, 0, 0)
_EmissionStrength("EmissionStrength", Float) = 0
[Header(Glossy)]
[Space(5)]
_Smoothness("Smoothness(Glossy)", Range(0, 1)) = 0
[Header(Opacity)]
[Space(5)]
_Alpha("Alpha", Range(0, 1)) = 1
[HideInInspector] _GrayscaleTex("GrayscaleTex", 2D) = "white" {}
[HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
}
SubShader
{
Tags
{
"RenderType" = "Transparent"
"Queue" = "Transparent"
}
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
CGPROGRAM
#pragma surface surf StandardSpecular alpha:fade fullforwardshadows
#pragma target 3.0
#pragma multi_compile_instancing
sampler2D _GrayscaleTex;
sampler2D _GradientTexture;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientIndex)
UNITY_DEFINE_INSTANCED_PROP(float, _GradientCount)
UNITY_DEFINE_INSTANCED_PROP(float4, _EmissionColor)
UNITY_DEFINE_INSTANCED_PROP(float, _EmissionStrength)
UNITY_DEFINE_INSTANCED_PROP(float, _Smoothness)
UNITY_DEFINE_INSTANCED_PROP(float, _Alpha)
UNITY_INSTANCING_BUFFER_END(Props)
struct Input
{
float2 uv_GrayscaleTex;
};
// LUT sampling function - MATCHES URP EXACTLY
// Uses grayscale.r as U coordinate and calculated V from gradient index
float4 SampleLUTFromGrayscale(float2 uv, float gradientIndex, float gradientCount)
{
// Round the gradient index and add 0.5 (URP does this)
float roundedIndex = round(gradientIndex);
float adjustedIndex = roundedIndex + 0.5;
// Calculate V coordinate
float vCoord = adjustedIndex / gradientCount;
// Sample grayscale texture
float4 grayscaleSample = tex2D(_GrayscaleTex, uv);
// Use R channel as U coordinate (like URP)
float2 lutUV = float2(grayscaleSample.r, vCoord);
return tex2D(_GradientTexture, lutUV);
}
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
// Get instanced properties
float gradientIndex = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientIndex);
float gradientCount = UNITY_ACCESS_INSTANCED_PROP(Props, _GradientCount);
float4 emissionColor = UNITY_ACCESS_INSTANCED_PROP(Props, _EmissionColor);
float emissionStrength = UNITY_ACCESS_INSTANCED_PROP(Props, _EmissionStrength);
float smoothness = UNITY_ACCESS_INSTANCED_PROP(Props, _Smoothness);
float alpha = UNITY_ACCESS_INSTANCED_PROP(Props, _Alpha);
// Sample LUT using grayscale texture (set by PotionTextureSetup.cs)
float4 lutColor = SampleLUTFromGrayscale(IN.uv_GrayscaleTex, gradientIndex, gradientCount);
// Set surface properties
o.Albedo = lutColor.rgb;
o.Emission = emissionColor.rgb * emissionStrength;
o.Smoothness = smoothness;
o.Specular = float3(0, 0, 0);
o.Alpha = alpha;
}
ENDCG
}
FallBack "Standard"
}

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 024a6a4e5b8c3ec43869085e88f4a0aa
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 341020
packageName: Stylized Potions Pack - 110 Colors | Liquid Physics | URP + Built-in
packageVersion: 1.0
assetPath: Assets/MesshingAround/StylizedPotionsPack/Shaders/BuiltIn/Stylized_Tint_OP.shader
uploadId: 811526