BorderSlicer shader

This commit is contained in:
Alexandre Coirier
2026-03-20 12:55:45 +01:00
parent 532ede9714
commit fccf8c94b8
17 changed files with 3283 additions and 3723 deletions

View File

@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: mat_base
m_Shader: {fileID: -6465566751694194690, guid: 3f8befd3053417d48bb58d7965039cf2, type: 3}
m_Shader: {fileID: -6465566751694194690, guid: d2b678e0b28379a4a8cb1c76f5f31ab7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
@@ -90,6 +90,8 @@ Material:
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _CornerPart: 0.5
- _CornerScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
@@ -119,6 +121,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.1469384, g: 0.17375965, b: 0.24528301, a: 1}
- _Center: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.015797436, g: 0.024243845, b: 0.047169805, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

View File

@@ -21,7 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: mat_borders
m_Shader: {fileID: -6465566751694194690, guid: 3f8befd3053417d48bb58d7965039cf2, type: 3}
m_Shader: {fileID: -6465566751694194690, guid: d2b678e0b28379a4a8cb1c76f5f31ab7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
@@ -103,6 +103,8 @@ Material:
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _CornerPart: 0.5
- _CornerScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
@@ -132,6 +134,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.9433962, g: 0.7970809, b: 0.33374867, a: 1}
- _Center: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.9433962, g: 0.7970809, b: 0.33374864, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

View File

@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: mat_neon
m_Shader: {fileID: -6465566751694194690, guid: 3f8befd3053417d48bb58d7965039cf2, type: 3}
m_Shader: {fileID: -6465566751694194690, guid: d2b678e0b28379a4a8cb1c76f5f31ab7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
@@ -90,6 +90,8 @@ Material:
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _CornerPart: 0.5
- _CornerScale: 1
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
@@ -119,6 +121,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.63619536, g: 0.8714063, b: 0.9162735, a: 1}
- _Center: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.5690036, g: 6.0080075, b: 7.095809, a: 1}
- _EmissionColor: {r: 4.38111, g: 8.857374, b: 9.976882, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

View File

@@ -0,0 +1,66 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-3386253168315558799
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: mat_pillar
m_Shader: {fileID: -6465566751694194690, guid: d2b678e0b28379a4a8cb1c76f5f31ab7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- 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:
- _Border: 0.36
- _CornerPart: 0.5
- _CornerScale: 1
- _Metallic: 0
- _QueueControl: 0
- _QueueOffset: 0
- _Size: 1
- _Smoothness: 0
m_Colors:
- _Center: {r: 0, g: 0.5, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34192e06ae9da5a4081dad56f335a355
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
float _BS_Remap(float v, float inMin, float inMax, float outMin, float outMax)
{
return outMin + (v - inMin) * (outMax - outMin) / (inMax - inMin);
}
// CornerPart : fraction of the mesh extent occupied by corners [0, 0.5]
// Must match edge loop placement. e.g. 0.1 = loops at ±0.4
// CornerScale : multiplier on the natural corner size.
// 1.0 = perfect proportion preservation at any scale
// 2.0 = corners twice as large, center shrinks
float NineSliceAxis(float p, float scale, float cornerPart, float cornerScale, float center)
{
float pc = p - center;
// Target corner size in object space
// = natural world size (cornerPart * 1 at scale=1) * CornerScale / current scale
float b = clamp(cornerPart * cornerScale / max(abs(scale), 0.0001), 0.0, 0.499);
float cp = clamp(cornerPart, 0.0, 0.499);
float result;
if (pc < -0.5 + cp)
result = _BS_Remap(pc, -0.5, -0.5 + cp, -0.5, -0.5 + b);
else if (pc > 0.5 - cp)
result = _BS_Remap(pc, 0.5 - cp, 0.5, 0.5 - b, 0.5);
else
result = _BS_Remap(pc, -0.5 + cp, 0.5 - cp, -0.5 + b, 0.5 - b);
return result + center;
}
void BorderSlicer_float(float3 PositionOS, float3 Scale, float CornerPart, float CornerScale,
float3 Center, float3 Filter, out float3 Output)
{
float3 sliced = float3(
NineSliceAxis(PositionOS.x, Scale.x, CornerPart, CornerScale, Center.x),
NineSliceAxis(PositionOS.y, Scale.y, CornerPart, CornerScale, Center.y),
NineSliceAxis(PositionOS.z, Scale.z, CornerPart, CornerScale, Center.z)
);
Output = lerp(PositionOS, sliced, saturate(Filter));
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1858e24b89ecdba4e90e4c0884f918f4
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3f8befd3053417d48bb58d7965039cf2
guid: d2b678e0b28379a4a8cb1c76f5f31ab7
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

Binary file not shown.

View File

@@ -0,0 +1,110 @@
fileFormatVersion: 2
guid: bb616adce7abc8342957c19da60505ce
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
generateMeshLods: 0
meshLodGenerationFlags: 0
maximumMeshLod: -1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +1,9 @@
fileFormatVersion: 2
guid: b140ea2efb023584ba9cd9e150caadf8
guid: a8025ccc950289342820ed4106b92139
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_base
second: {fileID: 2100000, guid: 713ba79fc0f5b1f489f4767d3010cf4b, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_borders
second: {fileID: 2100000, guid: fb4cd1759250f77499fed2ee7bc034dc, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_neon
second: {fileID: 2100000, guid: 24ca1d189c9b1234cb7ed84ad9616e23, type: 2}
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0

Binary file not shown.

View File

@@ -0,0 +1,125 @@
fileFormatVersion: 2
guid: b140ea2efb023584ba9cd9e150caadf8
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_base
second: {fileID: 2100000, guid: 713ba79fc0f5b1f489f4767d3010cf4b, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_borders
second: {fileID: 2100000, guid: fb4cd1759250f77499fed2ee7bc034dc, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: mat_neon
second: {fileID: 2100000, guid: 24ca1d189c9b1234cb7ed84ad9616e23, type: 2}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
generateMeshLods: 0
meshLodGenerationFlags: 0
maximumMeshLod: -1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff