This commit is contained in:
CortexCore 2025-05-03 15:22:17 +08:00
parent 994817348b
commit 31aa4c420f
298 changed files with 1139 additions and 24148 deletions

Binary file not shown.

View File

@ -0,0 +1,884 @@
fileFormatVersion: 2
guid: b6268fba087b43e4cafa6c2c9cc7f87b
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 3
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations:
- serializedVersion: 16
name: Strong Gesture
takeName: mixamo.com
internalID: -203655887218126122
firstFrame: 0
lastFrame: 57
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
hasAdditiveReferencePose: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 1
loopBlendPositionY: 1
loopBlendPositionXZ: 1
keepOriginalOrientation: 1
keepOriginalPositionY: 1
keepOriginalPositionXZ: 1
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 3
maskSource: {instanceID: 0}
additiveReferencePoseFrame: 0
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
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:
- boneName: mixamorig:Hips
humanName: Hips
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftUpLeg
humanName: LeftUpperLeg
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightUpLeg
humanName: RightUpperLeg
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftLeg
humanName: LeftLowerLeg
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightLeg
humanName: RightLowerLeg
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftFoot
humanName: LeftFoot
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightFoot
humanName: RightFoot
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:Spine
humanName: Spine
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:Spine1
humanName: Chest
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:Neck
humanName: Neck
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:Head
humanName: Head
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftShoulder
humanName: LeftShoulder
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightShoulder
humanName: RightShoulder
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftArm
humanName: LeftUpperArm
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightArm
humanName: RightUpperArm
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftForeArm
humanName: LeftLowerArm
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightForeArm
humanName: RightLowerArm
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHand
humanName: LeftHand
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHand
humanName: RightHand
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftToeBase
humanName: LeftToes
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightToeBase
humanName: RightToes
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandThumb1
humanName: Left Thumb Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandThumb2
humanName: Left Thumb Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandThumb3
humanName: Left Thumb Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandIndex1
humanName: Left Index Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandIndex2
humanName: Left Index Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandIndex3
humanName: Left Index Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandMiddle1
humanName: Left Middle Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandMiddle2
humanName: Left Middle Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandMiddle3
humanName: Left Middle Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandRing1
humanName: Left Ring Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandRing2
humanName: Left Ring Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandRing3
humanName: Left Ring Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandPinky1
humanName: Left Little Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandPinky2
humanName: Left Little Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:LeftHandPinky3
humanName: Left Little Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandThumb1
humanName: Right Thumb Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandThumb2
humanName: Right Thumb Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandThumb3
humanName: Right Thumb Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandIndex1
humanName: Right Index Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandIndex2
humanName: Right Index Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandIndex3
humanName: Right Index Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandMiddle1
humanName: Right Middle Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandMiddle2
humanName: Right Middle Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandMiddle3
humanName: Right Middle Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandRing1
humanName: Right Ring Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandRing2
humanName: Right Ring Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandRing3
humanName: Right Ring Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandPinky1
humanName: Right Little Proximal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandPinky2
humanName: Right Little Intermediate
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:RightHandPinky3
humanName: Right Little Distal
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
- boneName: mixamorig:Spine2
humanName: UpperChest
limit:
min: {x: 0, y: 0, z: 0}
max: {x: 0, y: 0, z: 0}
value: {x: 0, y: 0, z: 0}
length: 0
modified: 0
skeleton:
- name: X Bot@Strong Gesture(Clone)
parentName:
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Hips
parentName: X Bot@Strong Gesture(Clone)
position: {x: -0.000584448, y: 1.0123558, z: 0.000012588352}
rotation: {x: -0.116448626, y: -0.03909612, z: 0.009433376, w: 0.9923821}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Spine
parentName: mixamorig:Hips
position: {x: -0, y: 0.10182399, z: 0}
rotation: {x: 0.09429192, y: 0.0021165782, z: -0.008348082, w: 0.99550736}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Spine1
parentName: mixamorig:Spine
position: {x: -0, y: 0.100026995, z: 0}
rotation: {x: 0.060744874, y: 0.0041084257, z: -0.005192045, w: 0.9981314}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Spine2
parentName: mixamorig:Spine1
position: {x: -0, y: 0.093220994, z: 0}
rotation: {x: 0.073603146, y: 0.0040330114, z: -0.005227898, w: 0.9972658}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Neck
parentName: mixamorig:Spine2
position: {x: -0, y: 0.16865298, z: 0}
rotation: {x: -0.10663863, y: 0.010826768, z: 0.004489892, w: 0.9942288}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:Head
parentName: mixamorig:Neck
position: {x: -0, y: 0.09341899, z: 0.02841}
rotation: {x: -0.14016531, y: 0.015305415, z: -0.00026889046, w: 0.99000984}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:HeadTop_End
parentName: mixamorig:Head
position: {x: -0, y: 0.20962799, z: 0.101229}
rotation: {x: 0, y: -0, z: -0, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightShoulder
parentName: mixamorig:Spine2
position: {x: 0.045700002, y: 0.111958, z: -0.0080659995}
rotation: {x: 0.5680721, y: 0.55441284, z: -0.537988, w: 0.2837067}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightArm
parentName: mixamorig:RightShoulder
position: {x: -0, y: 0.108381994, z: 0}
rotation: {x: -0.1174131, y: -0.16082382, z: 0.10454961, w: 0.97438145}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightForeArm
parentName: mixamorig:RightArm
position: {x: -0, y: 0.278415, z: 0}
rotation: {x: -0.0127508845, y: 0.2253142, z: 0.0024833574, w: 0.9741996}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHand
parentName: mixamorig:RightForeArm
position: {x: -0, y: 0.283288, z: 0}
rotation: {x: 0.029827103, y: 0.055578403, z: -0.020380322, w: 0.9978006}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandThumb1
parentName: mixamorig:RightHand
position: {x: -0.026819, y: 0.024647998, z: 0.01574}
rotation: {x: -0.16428682, y: -0.12502497, z: 0.2981424, w: 0.9319279}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandThumb2
parentName: mixamorig:RightHandThumb1
position: {x: -0, y: 0.04189, z: 0}
rotation: {x: -0.005252955, y: -0.09550534, z: -0.035227425, w: 0.99479157}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandThumb3
parentName: mixamorig:RightHandThumb2
position: {x: -0, y: 0.034163, z: 0}
rotation: {x: 0.000000036260452, y: 0.00080734375, z: -0.00000003571315, w: 0.9999997}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandThumb4
parentName: mixamorig:RightHandThumb3
position: {x: -0, y: 0.02575, z: 0}
rotation: {x: 0.005774398, y: 0.11750944, z: 0.048743945, w: 0.991858}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandIndex1
parentName: mixamorig:RightHand
position: {x: -0.022597998, y: 0.091083, z: 0.0051789996}
rotation: {x: 0.07854065, y: -0.09658704, z: -0.004498053, w: 0.99221075}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandIndex2
parentName: mixamorig:RightHandIndex1
position: {x: -0, y: 0.037, z: 0}
rotation: {x: 0.03226079, y: 0.0041739848, z: -0.009586897, w: 0.99942476}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandIndex3
parentName: mixamorig:RightHandIndex2
position: {x: -0, y: 0.028499998, z: 0}
rotation: {x: 0.00000004036648, y: -0.0000000054702696, z: 0.000000020516795, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandIndex4
parentName: mixamorig:RightHandIndex3
position: {x: -0, y: 0.027722001, z: 0}
rotation: {x: -0.00000008750134, y: -0.0010026915, z: -0.00008726642, w: 0.9999995}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandMiddle1
parentName: mixamorig:RightHand
position: {x: -0, y: 0.095325, z: 0}
rotation: {x: 0.072762296, y: -0.13779913, z: -0.020695642, w: 0.98756707}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandMiddle2
parentName: mixamorig:RightHandMiddle1
position: {x: -0, y: 0.037, z: 0}
rotation: {x: 0.029125616, y: 0.042350445, z: -0.0054449383, w: 0.9986634}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandMiddle3
parentName: mixamorig:RightHandMiddle2
position: {x: -0, y: 0.0295, z: 0}
rotation: {x: -0.00000016497543, y: -0.0000000018989645, z: -0.000000044202025, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandMiddle4
parentName: mixamorig:RightHandMiddle3
position: {x: -0, y: 0.029466, z: 0}
rotation: {x: -0.00000015476391, y: -0.00092851504, z: -0.00016667887, w: 0.9999996}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandRing1
parentName: mixamorig:RightHand
position: {x: 0.018651, y: 0.09103599, z: 0.000431}
rotation: {x: 0.0703629, y: -0.11724179, z: -0.008701779, w: 0.9905694}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandRing2
parentName: mixamorig:RightHandRing1
position: {x: -0, y: 0.033793, z: 0}
rotation: {x: 0.026563559, y: 0.025812827, z: -0.0008488711, w: 0.99931353}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandRing3
parentName: mixamorig:RightHandRing2
position: {x: -0, y: 0.028896999, z: 0}
rotation: {x: 5.305607e-29, y: 1.3877788e-17, z: -3.8230925e-12, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandRing4
parentName: mixamorig:RightHandRing3
position: {x: -0, y: 0.026387999, z: 0}
rotation: {x: 0.00000011649483, y: -0.00014573496, z: 0.00079936074, w: 0.9999997}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandPinky1
parentName: mixamorig:RightHand
position: {x: 0.038062997, y: 0.080767, z: 0.004867}
rotation: {x: 0.069211006, y: -0.13152285, z: -0.008192212, w: 0.9888602}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandPinky2
parentName: mixamorig:RightHandPinky1
position: {x: -0, y: 0.036, z: 0}
rotation: {x: 0.023637494, y: 0.062893175, z: 0.0020813958, w: 0.9977381}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandPinky3
parentName: mixamorig:RightHandPinky2
position: {x: -0, y: 0.020999998, z: 0}
rotation: {x: -0.00000007306975, y: -0.000000033252235, z: -0.00000014042563, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightHandPinky4
parentName: mixamorig:RightHandPinky3
position: {x: -0, y: 0.021157999, z: 0}
rotation: {x: 0.00000006435498, y: -0.0015690505, z: 0.00004101519, w: 0.9999988}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftShoulder
parentName: mixamorig:Spine2
position: {x: -0.045704, y: 0.11195599, z: -0.0080659995}
rotation: {x: 0.5755101, y: -0.5187919, z: 0.49633783, w: 0.39152503}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftArm
parentName: mixamorig:LeftShoulder
position: {x: -0, y: 0.108376995, z: 0}
rotation: {x: -0.072750315, y: 0.065450475, z: -0.046739955, w: 0.9941021}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftForeArm
parentName: mixamorig:LeftArm
position: {x: -0, y: 0.278415, z: 0}
rotation: {x: -0.01377788, y: -0.17581038, z: -0.0021618751, w: 0.98432523}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHand
parentName: mixamorig:LeftForeArm
position: {x: -0, y: 0.283288, z: 0}
rotation: {x: 0.11747291, y: -0.15039219, z: -0.00029298052, w: 0.9816223}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandThumb1
parentName: mixamorig:LeftHand
position: {x: 0.026817, y: 0.024660999, z: 0.015762}
rotation: {x: -0.21760221, y: 0.12773296, z: -0.26018152, w: 0.93200815}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandThumb2
parentName: mixamorig:LeftHandThumb1
position: {x: -0, y: 0.041871, z: 0}
rotation: {x: -0.0052535366, y: 0.095630966, z: 0.03523016, w: 0.99477935}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandThumb3
parentName: mixamorig:LeftHandThumb2
position: {x: -0, y: 0.034184, z: 0}
rotation: {x: -0.00000010078506, y: -0.0007450025, z: 0.00000009277876, w: 0.99999976}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandThumb4
parentName: mixamorig:LeftHandThumb3
position: {x: -0, y: 0.025806, z: 0}
rotation: {x: 0.005153017, y: -0.12268283, z: -0.04165188, w: 0.99155813}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandIndex1
parentName: mixamorig:LeftHand
position: {x: 0.022599, y: 0.091093, z: 0.00518}
rotation: {x: 0.078541465, y: 0.09658704, z: 0.0044996017, w: 0.9922107}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandIndex2
parentName: mixamorig:LeftHandIndex1
position: {x: -0, y: 0.037, z: 0}
rotation: {x: 0.03226157, y: -0.004175007, z: 0.009583597, w: 0.99942476}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandIndex3
parentName: mixamorig:LeftHandIndex2
position: {x: -0, y: 0.028499998, z: 0}
rotation: {x: -0.00000006857718, y: 0.00000012474096, z: -0.0000000010210888, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandIndex4
parentName: mixamorig:LeftHandIndex3
position: {x: -0, y: 0.027748998, z: 0}
rotation: {x: -0.000000004946225, y: 0.00037786376, z: 0.000013089969, w: 0.99999994}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandMiddle1
parentName: mixamorig:LeftHand
position: {x: -0, y: 0.09533399, z: 0}
rotation: {x: 0.073178716, y: 0.13705674, z: 0.021990808, w: 0.98761165}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandMiddle2
parentName: mixamorig:LeftHandMiddle1
position: {x: -0, y: 0.037, z: 0}
rotation: {x: 0.029123962, y: -0.042396903, z: 0.005443932, w: 0.9986614}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandMiddle3
parentName: mixamorig:LeftHandMiddle2
position: {x: -0, y: 0.0295, z: 0}
rotation: {x: -0.00000006605762, y: 0.000000009599206, z: 0.000000003365707, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandMiddle4
parentName: mixamorig:LeftHandMiddle3
position: {x: -0, y: 0.029528998, z: 0}
rotation: {x: 0.000000028609662, y: 0.001024508, z: -0.000027925253, w: 0.99999946}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandRing1
parentName: mixamorig:LeftHand
position: {x: -0.018651, y: 0.091045, z: 0.00043000001}
rotation: {x: 0.070361674, y: 0.11724232, z: 0.008701544, w: 0.9905694}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandRing2
parentName: mixamorig:LeftHandRing1
position: {x: -0, y: 0.0315, z: 0}
rotation: {x: 0.02656185, y: -0.025814317, z: 0.0008485304, w: 0.9993134}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandRing3
parentName: mixamorig:LeftHandRing2
position: {x: -0, y: 0.0295, z: 0}
rotation: {x: -0.0000000142372585, y: -0.000000021355888, z: 0.000000005784011, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandRing4
parentName: mixamorig:LeftHandRing3
position: {x: -0, y: 0.026442999, z: 0}
rotation: {x: -0.000000007744897, y: -0.0004930555, z: -0.000015707961, w: 0.9999999}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandPinky1
parentName: mixamorig:LeftHand
position: {x: -0.038062997, y: 0.080777995, z: 0.004869}
rotation: {x: 0.06923566, y: 0.13187504, z: 0.008009245, w: 0.9888131}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandPinky2
parentName: mixamorig:LeftHandPinky1
position: {x: -0, y: 0.036, z: 0}
rotation: {x: 0.023633871, y: -0.06289553, z: -0.0020802706, w: 0.99773806}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandPinky3
parentName: mixamorig:LeftHandPinky2
position: {x: -0, y: 0.020999998, z: 0}
rotation: {x: 0, y: 0, z: 3.6410406e-13, w: 1}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftHandPinky4
parentName: mixamorig:LeftHandPinky3
position: {x: -0, y: 0.021255, z: 0}
rotation: {x: 0.0000006415177, y: 0.000783653, z: 0.00029495993, w: 0.99999964}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightUpLeg
parentName: mixamorig:Hips
position: {x: 0.082077995, y: -0.067718, z: -0.015121999}
rotation: {x: 0.11711739, y: -0.0053381915, z: 0.990909, w: -0.06598778}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightLeg
parentName: mixamorig:RightUpLeg
position: {x: -0, y: 0.44371498, z: 0}
rotation: {x: -0.33741245, y: -0.0030843993, z: -0.004601341, w: 0.9413406}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightFoot
parentName: mixamorig:RightLeg
position: {x: -0, y: 0.44527802, z: 0}
rotation: {x: 0.61674666, y: -0.048847258, z: -0.03701822, w: 0.78477204}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightToeBase
parentName: mixamorig:RightFoot
position: {x: -0, y: 0.138169, z: 0}
rotation: {x: 0.3352423, y: -0.00000004078388, z: 0.00000007014923, w: 0.942132}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:RightToe_End
parentName: mixamorig:RightToeBase
position: {x: -0, y: 0.092781, z: 0}
rotation: {x: 0, y: -0.0116079245, z: -0, w: 0.99993265}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftUpLeg
parentName: mixamorig:Hips
position: {x: -0.082077995, y: -0.067718, z: -0.015121999}
rotation: {x: -0.018600695, y: -0.00192961, z: 0.99714977, w: 0.07309391}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftLeg
parentName: mixamorig:LeftUpLeg
position: {x: -0, y: 0.443714, z: 0}
rotation: {x: -0.33595613, y: 0.003108304, z: 0.008613353, w: 0.94183314}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftFoot
parentName: mixamorig:LeftLeg
position: {x: -0, y: 0.44527802, z: 0}
rotation: {x: 0.62051857, y: 0.005620985, z: 0.04463798, w: 0.78290015}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftToeBase
parentName: mixamorig:LeftFoot
position: {x: -0, y: 0.138169, z: 0}
rotation: {x: 0.33524162, y: -0.000000032624314, z: -0.000000019436587, w: 0.9421322}
scale: {x: 1, y: 1, z: 1}
- name: mixamorig:LeftToe_End
parentName: mixamorig:LeftToeBase
position: {x: -0, y: 0.092781, z: 0}
rotation: {x: 0, y: 0.011868834, z: -0, w: 0.9999296}
scale: {x: 1, y: 1, z: 1}
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: 1
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 1
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: d3a2a30782c93ed42a8129d2bf9d1d99, type: 3}
m_Name: NewScriptableYangdunData
m_EditorClassIdentifier:
boostAnimation: {fileID: -203655887218126122, guid: b6268fba087b43e4cafa6c2c9cc7f87b, type: 3}
groundVfx: {fileID: 198258887974599854, guid: b6ac78dbb6751514392e2f44f82cc21f, type: 3}
boneVfx:
_serializedList:
- Key: 0
Value:
- {fileID: 198676951622155030, guid: 07aa037621e4eba478ebfb04ecfbf0f5, type: 3}
- {fileID: 198032395562779782, guid: da7875cab77480d49972b42ca872af40, type: 3}
- {fileID: 198583920760321224, guid: 7bfa717c06cd39a4caa982d7615971fe, type: 3}
- Key: 10
Value:
- {fileID: 198909533067274220, guid: 19c065b476ca9a24e839e181a781c36c, type: 3}

View File

@ -1,10 +1,8 @@
fileFormatVersion: 2
guid: 96c5704d0681e35408630c488fc0c234
labels:
- TranslucentImageResource
guid: 657ab508db1f89c4483f04101309995b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -83,33 +83,33 @@ MonoBehaviour:
m_Textures:
blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3}
bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3}
m_PrefilteringModeMainLightShadows: 1
m_PrefilteringModeMainLightShadows: 3
m_PrefilteringModeAdditionalLight: 4
m_PrefilteringModeAdditionalLightShadows: 1
m_PrefilterXRKeywords: 0
m_PrefilteringModeAdditionalLightShadows: 2
m_PrefilterXRKeywords: 1
m_PrefilteringModeForwardPlus: 1
m_PrefilteringModeDeferredRendering: 1
m_PrefilteringModeScreenSpaceOcclusion: 1
m_PrefilterDebugKeywords: 0
m_PrefilterWriteRenderingLayers: 0
m_PrefilterHDROutput: 0
m_PrefilterSSAODepthNormals: 0
m_PrefilterSSAOSourceDepthLow: 0
m_PrefilterSSAOSourceDepthMedium: 0
m_PrefilterSSAOSourceDepthHigh: 0
m_PrefilterSSAOInterleaved: 0
m_PrefilterSSAOBlueNoise: 0
m_PrefilterSSAOSampleCountLow: 0
m_PrefilterSSAOSampleCountMedium: 0
m_PrefilterSSAOSampleCountHigh: 0
m_PrefilterDBufferMRT1: 0
m_PrefilterDBufferMRT2: 0
m_PrefilterDBufferMRT3: 0
m_PrefilterSoftShadowsQualityLow: 0
m_PrefilterSoftShadowsQualityMedium: 0
m_PrefilterSoftShadowsQualityHigh: 0
m_PrefilteringModeScreenSpaceOcclusion: 0
m_PrefilterDebugKeywords: 1
m_PrefilterWriteRenderingLayers: 1
m_PrefilterHDROutput: 1
m_PrefilterSSAODepthNormals: 1
m_PrefilterSSAOSourceDepthLow: 1
m_PrefilterSSAOSourceDepthMedium: 1
m_PrefilterSSAOSourceDepthHigh: 1
m_PrefilterSSAOInterleaved: 1
m_PrefilterSSAOBlueNoise: 1
m_PrefilterSSAOSampleCountLow: 1
m_PrefilterSSAOSampleCountMedium: 1
m_PrefilterSSAOSampleCountHigh: 1
m_PrefilterDBufferMRT1: 1
m_PrefilterDBufferMRT2: 1
m_PrefilterDBufferMRT3: 1
m_PrefilterSoftShadowsQualityLow: 1
m_PrefilterSoftShadowsQualityMedium: 1
m_PrefilterSoftShadowsQualityHigh: 1
m_PrefilterSoftShadows: 0
m_PrefilterScreenCoord: 0
m_PrefilterNativeRenderPass: 0
m_PrefilterScreenCoord: 1
m_PrefilterNativeRenderPass: 1
m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0

View File

@ -2,34 +2,93 @@ using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using BITKit.Entities;
using Microsoft.Extensions.Logging;
using Net.Project.B.Emoji;
using Net.Project.B.Health;
using Project.B.CharacterController;
using UnityEngine;
using UnityEngine.InputSystem;
using Object = UnityEngine.Object;
namespace Net.Like.Xue.Tokyo
{
public class GodMode:IDisposable
{
private readonly IEntitiesService _entitiesService;
private readonly IHealthService _healthService;
private readonly ITicker _ticker;
private readonly IMainTicker _ticker;
private readonly ValidHandle _allow = new();
private readonly ILogger<GodMode> _logger;
public GodMode(ITicker ticker, IHealthService healthService, ILogger<GodMode> logger)
private readonly ScriptableYangdunData _data;
private bool _allowGodMode;
public GodMode(IMainTicker ticker, IHealthService healthService, ILogger<GodMode> logger, IEntitiesService entitiesService)
{
_ticker = ticker;
_healthService = healthService;
_logger = logger;
_entitiesService = entitiesService;
_ticker.Add(OnTick);
_healthService.OnHealthPlus += OnHealthPlus;
_allow.AddListener(x =>
_allow.AddListener(OnAllow);
_data = _entitiesService.QueryComponents<ScriptableYangdunData>()[0];
}
private void OnAllow(bool allow)
{
logger.LogInformation(x ? "开启无敌" : "关闭无敌");
_logger.LogInformation(allow ? "开启无敌" : "关闭无敌");
if (allow)
{
foreach (var (_, emojiService,gameObject,characterController) in _entitiesService
.QueryComponents<LocalPlayerComponent, IEmojiService<AnimationClip>,GameObject,ICharacterController>())
{
emojiService.Play(new EmojiData<AnimationClip>()
{
Clip = _data.BoostAnimation
});
{
var groundVfx = Object.Instantiate(_data.GroundVfx.gameObject, characterController.Position,characterController.Rotation);
{
if (groundVfx.TryGetComponent<ParticleSystem>(out var vfx))
{
vfx.Play(true);
}
}
}
{
gameObject.TryGetComponent<Animator>(out var animator);
foreach (var (humanBone,particleSystems) in _data.BoneVfx)
{
var bone = animator.GetBoneTransform(humanBone);
if (!bone)
{
_logger.LogWarning($"在{animator.gameObject.name}上没有找到骨骼:{humanBone}");
continue;
}
foreach (var particleSystem in particleSystems)
{
var bodyVfx = Object.Instantiate(particleSystem.gameObject, bone.position, bone.rotation);
if (!bodyVfx.TryGetComponent<ParticleSystem>(out var vfx)) continue;
vfx.Play(true);
//vfx.Stop(withChildren: true, stopBehavior: ParticleSystemStopBehavior.StopEmitting);
}
}
}
}
}
}
private int OnHealthPlus(int arg1, int arg2, int arg3, object arg4)
@ -46,7 +105,7 @@ namespace Net.Like.Xue.Tokyo
{
if (Keyboard.current is { homeKey: { wasPressedThisFrame: true } })
{
_allow.SetElements(this,!_allow.Allow);
_allow.SetElements(this,_allowGodMode=!_allowGodMode);
}
}

View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using AYellowpaper.SerializedCollections;
using UnityEngine;
namespace Net.Like.Xue.Tokyo
{
public class ScriptableYangdunData : ScriptableObject
{
[SerializeField] private AnimationClip boostAnimation;
[SerializeField] private ParticleSystem groundVfx;
[SerializeField] private SerializedDictionary<HumanBodyBones, ParticleSystem[]> boneVfx;
public AnimationClip BoostAnimation => boostAnimation;
public ParticleSystem GroundVfx => groundVfx;
public IReadOnlyDictionary<HumanBodyBones,ParticleSystem[]> BoneVfx => boneVfx;
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 828a3ac0ed3540dbb2883fb9b58158a4
guid: d3a2a30782c93ed42a8129d2bf9d1d99
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Animancer;
using BITKit;
using BITKit.Entities;
using Cysharp.Threading.Tasks;
@ -19,6 +20,7 @@ namespace Net.Like.Xue.Tokyo
private readonly IPlayerFactory _playerFactory;
private readonly IDialogueService _dialogueService;
private readonly PlayerAutoHealController _healController;
private readonly ITicker _ticker;
@ -32,23 +34,26 @@ namespace Net.Like.Xue.Tokyo
{
_playerFactory = playerFactory;
_dialogueService = dialogueService;
_healController = healController;
_ticker = ticker;
_entitiesService = entitiesService;
_logger = logger;
_playerFactory.OnEntityCreated += OnEntityCreated;
_disabledHealth.AddListener(x =>
{
_logger.LogInformation(!x ? "开启回血" : "关闭回血");
healController.Enabled = !x;
});
_disabledHealth.AddListener(OnDisableHealth);
_disabledHealth.Invoke();
ticker.Add(OnTick);
}
void OnDisableHealth(bool x)
{
_logger.LogInformation(!x ? "开启回血" : "关闭回血");
_healController.Enabled = !x;
}
private void OnTick(float obj)
{
if (_player is null)

View File

@ -7,6 +7,7 @@
<ui:VisualElement style="flex-direction: row;">
<ui:Label tabindex="-1" text="物品名称" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label--0" class="tl" />
<ui:DropdownField name="DropdownField--0" choices="CN,EN,JP" />
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" class="clear" style="background-image: url(&quot;project://database/Assets/BITKit/Unity/Art/Editor_Icons/processed/AudioSource%20Gizmo.png?fileID=2800000&amp;guid=593868a54a1dc144da329d1a8794af14&amp;type=3#AudioSource Gizmo&quot;); width: 50px; height: 50px; border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-width: 0;" />
</ui:VisualElement>
<ui:Label tabindex="-1" text="物品描述" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label--1" />
</ui:VisualElement>

View File

@ -19,7 +19,7 @@ MonoBehaviour:
m_Scale: 1
m_ReferenceDpi: 96
m_FallbackDpi: 96
m_ReferenceResolution: {x: 1920, y: 1080}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_Match: 0.421
m_SortingOrder: 0

View File

@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: 19101, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ux_panel_settings_mobile
m_EditorClassIdentifier:
themeUss: {fileID: -4733365628477956816, guid: ac803f0924e239645ac6b2fc9baebc65, type: 3}
m_TargetTexture: {fileID: 0}
m_ScaleMode: 2
m_ReferenceSpritePixelsPerUnit: 100
m_Scale: 1
m_ReferenceDpi: 96
m_FallbackDpi: 96
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_Match: 0.421
m_SortingOrder: 0
m_TargetDisplay: 0
m_ClearDepthStencil: 1
m_ClearColor: 0
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
m_DynamicAtlasSettings:
m_MinAtlasSize: 8
m_MaxAtlasSize: 4096
m_MaxSubTextureSize: 64
m_ActiveFilters: -1
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
textSettings: {fileID: 11400000, guid: ae6e49236707be64baaaa783d1a15d81, type: 2}

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: eb706d61f651d684c9203dc86e5f7331
folderAsset: yes
DefaultImporter:
guid: 682b76f61fe6ced47864f4e4c35d44d7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -122,7 +122,7 @@ MonoBehaviour:
- GroupName: Scenes
GroupDesc:
AssetTags:
ActiveRuleName: EnableGroup
ActiveRuleName: DisableGroup
Collectors:
- CollectPath: Assets/Arts/Anime Tokyo/Demo Scenes
CollectorGUID: 632a03a4eb68b6348bfc51bcb176ec3f
@ -132,22 +132,6 @@ MonoBehaviour:
FilterRuleName: CollectScene
AssetTags:
UserData:
- CollectPath: Assets/Artists/Scenes/map_menu.unity
CollectorGUID: adc1632f567d3a947ac845f668f9313c
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectScene
AssetTags:
UserData:
- CollectPath: Assets/Artists/Scenes/map_initialize.unity
CollectorGUID: 34a8612a733ca274cae8085004283067
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectScene
AssetTags:
UserData:
- CollectPath: Assets/Arts/Airport - terminal for airplanes/Scenes/scene_terminal.unity
CollectorGUID: 9fc0d4010bbf28b4594072e72b8655ab
CollectorType: 0
@ -236,7 +220,7 @@ MonoBehaviour:
- GroupName: Maps
GroupDesc:
AssetTags: scriptable_object;maps
ActiveRuleName: EnableGroup
ActiveRuleName: DisableGroup
Collectors:
- CollectPath: Assets/Arts/Airport - terminal for airplanes/map_termainal.asset
CollectorGUID: 9ad59e09fadc2224f9a032b2d09eddc9
@ -356,3 +340,24 @@ MonoBehaviour:
FilterRuleName: CollectAll
AssetTags:
UserData:
- GroupName: Built-In
GroupDesc:
AssetTags:
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/Artists/Scenes/map_initialize.unity
CollectorGUID: 34a8612a733ca274cae8085004283067
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectScene
AssetTags:
UserData:
- CollectPath: Assets/Artists/Scenes/map_menu.unity
CollectorGUID: adc1632f567d3a947ac845f668f9313c
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectScene
AssetTags:
UserData:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e19c45ca12bbd234b8358c1aff8ca8f9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: f7d17cc01badd084cb6b9f7806e16fc6
folderAsset: yes
timeCreated: 1474981563
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,229 +0,0 @@
Changelog:
v4.4.0:
- More stable blur Strength calculation
- Fix compilation error in very old 2021.3 patch releases
- Fix error when using extremely large blur
- Remove Max Depth property
- Under the hood changes to prepare for 2023.3 URP
v4.3.0:
This is a re-release of the 4.1.0 release with hopefully less bugs.
- Preparation to support Unity 2023.3 URP
- Bug fixes
v4.2.0:
- Temporarily rollback 4.1.0 due to bugs
v4.1.0:
- Preparation to support Unity 2023.3 URP
- Fix spurious warning
v4.0.1:
- Fix issue in build
v4.0.0:
This is a major version bump signifying breaking changes.
Make sure you have your project committed to version control before upgrading
- Automatically pause blurring when there are no Translucent Images active
- Allow filling the black void when using VR Passthrough and Underlay with a custom color
- Improves prefab support
- Other under-the-hood improvements
v3.18.0:
- Improve support for newer versions of 2D Renderer
- Add workaround for buggy URP versions
- Blit mode selection is now completely automatic
v3.17.0:
- Restore support for the URP 2D Renderer in newer Unity versions
v3.16.2:
- Fix incorrect warning when used with True Shadow
v3.16.1:
- Improve compatibility with Unity 2023
v3.16.0:
- Fix incorrect rendering when using non default viewport in URP.
As a result of this change, Blur Region is now relative to the actual viewport, instead of the one show in the Camera inspector. You may need to re-tune your Blur Region.
v3.15.0:
- Fix color space mixed up. Your UIs appearance may change after this update.
v3.14.6:
- Fix compatibility with 2021.3.13 URP
v3.14.5:
- Fix editor script being included in build
- Reorder create asset menu
v3.14.4:
- Fix phantom windows again
v3.14.3:
- Fix phantom windows in some Unity versions
v3.14.2:
- Warn if Renderer Feature is missing in URP project
v3.14.1:
- Fix some gizmo icons not showing in newer Unity versions
v3.14.0:
- Improve compatibility with URP 13
v3.13.0:
- Drop support for URP's 2D Renderer. It is too locked down and buggy at the moment
v3.12.0:
- Improve compatibility with URP 12.1.7
v3.11.0:
- Allow rendering before post-processing to work-around URP 2D renderer issue.
v3.10.3:
- Fix shader compilation on GLES 2.0
v3.10.2:
- Fix sprite blending property not applied correctly
v3.10.1:
- Improve allocation behaviour
v3.10.0:
- Fix Single Pass Instanced Stereo rendering
v3.9.0:
- Improve error logging to be more relevant
- Assigning Source property on Translucent Image is now easier with automatic suggestions
- Fix compatibility with webgl in less capable browsers
- Improve compatibility with URP 12.1.2
v3.8.3:
- Workflow improvements on URP 12
v3.8.2:
- Fix some bugs on URP 12
v3.8.1:
- Fix some bugs on URP 12
v3.8.0:
- Support URP 12
- Fix prefab mode warning
v3.7.0:
- Support latest True Shadow release
- Fix spurious error messages
- Improve PlayStation compatibility
v3.6.0:
- Support Single Pass Instanced Stereo Render Mode
- Reduce log level
v3.5.1:
- Reduce error logging.
- Improve compatibility with Addressable.
v3.5.0:
- Changing Sprite Blending from script is now applied immediately.
TranslucentImage.spriteBlending is now a property instead of a field.
- You can now move the asset to a different path
v3.4.2:
- Fix blur config not saved
- Fix prefab instance not marked dirty
v3.4.1:
- Improve documentation
v3.4.0:
URP:
- Remove slow workaround for Unity bugs #1196219. Please update your URP package to 7.2.0 or newer.
- Downsampling and Blur Region now work with URP.
- Various fixes and optimizations.
v3.3.1:
- True Shadow integration: Fix shadow color not react correctly to Translucent Image color
v3.3.0:
Breaking changes:
- Upgraded to Unity 2019.4
- Remove deprecated LWRP package. URP continue to be supported.
- Translucent Image is now compatible with True Shadow.
v3.2.4:
- Fix memory leak when Translucent Image Source are destroyed.
v3.2.3:
- Example scene for blurring UI in URP
v3.2.2:
- Fix preview features sometime not work in URP
- Fix persistent black UI when not in play mode
- Hide some harmless errors in demo scene
- Fix RegisterSource() throw exception
- Some other small changes
v3.2.1:
- Convert Image to Translucent Image with context menu item
- Some small fixes and enhancements
v3.2.0:
Breaking changes: existing projects with Editor/Runtime version lower than these should not install this update.
- Upgraded to Unity 2018.4 to follow new Asset Store requirements
- Upgraded to .NET 4.x Equivalent Runtime, as .NET 3.5 is deprecated in Unity 2018
- Blur Region now can be controlled using on-screen GUI in the Game View when in Preview mode
- Help button on components now open appropriated documentation page
- Fix an issue with non fullscreen Camera Viewport Rect
- Fix missing namespace in some demo scripts
v3.1.1:
- Fix issue with URP Post Processing
v3.1.0:
*** Breaking change for LWRP project ***
- If you're using the asset in an existing LWRP project, please delete its folder first and import it again to avoid issue.
- If you're using the "Demo Forward Renderer" and "Demo LightweightRenderPipelineAsset", you'll have to replace them with the new one located in "Universal RP/'Configs" folder. I recommend creating your own, specific to your project.
***
- Added Universal RP support. LWRP support package is included for compatibility with older Unity version, but will not be updated anymore.
- Fix some small bugs.
v3.0.5:
- Added demo and documentation for setting up Translucent Images in world space.
- Disable scene gizmos.
v3.0.4:
- Better default file name when creating Blur Config from Translucent Image Source.
- Some improvement to error messages
v3.0.3:
- Fixed some bugs in demo scene
v3.0.2:
- Fixed some bugs on LWRP
- Added new demo for LWRP
v3.0.1:
- Fix compatibility issue with Post Processing Stack on LWRP
v3.0:
!!!Warning!!! Breaking changes:
- Blur Config now stored as asset file, allows for sharing of configuration between different Cameras/Scenes/Projects. You will need to re-config your all of your Translucent Image Sources. Settings on Translucent Images will be fine.
- Blur Size now called Radius to align with other software.
Added:
- Initial LWRP support. Please visit the documentation for setup guide.
- Bug fixes and performance improvements.
- A lot of ground work for additional blur algorithms (none added yet).
- Probably bugs. 😩
Changed:
- Minimum supported Unity version is now 2017.4
- Clearer preview box.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: c5a3f80713b8e364e883263b67113edf
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,24 +0,0 @@
{
"name": "LeTai.TranslucentImage",
"rootNamespace": "",
"references": [
"GUID:7ab3663edede26740845931880bf22af"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"LeTai_TranslucentImage"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "12",
"define": "URP12_OR_NEWER"
}
],
"noEngineReferences": false
}

View File

@ -1,104 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Default-Translucent
m_Shader: {fileID: 4800000, guid: b1115addd36579a429d5e6b4ffae668d, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BlurTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
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}
- _Mask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Brightness: 0
- _BumpScale: 1
- _ColorMask: 15
- _Constrast: 0.1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Flatten: 0.15
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Lightness: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _Vibrancy: 1.8
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 92a39630ef232a9459d20d55dd312799
timeCreated: 1541066439
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1 +0,0 @@
https://leloctai.com/asset/translucentimage/docs/

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 54274fce3b51a88468a41e332f5de0a5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 3c261078fb1a4da458b96776e33f88b1
folderAsset: yes
timeCreated: 1474981572
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,122 +0,0 @@
Shader "Hidden/EfficientBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_BackgroundColor ("_BackgroundColor", Color) = (0,0,0,0)
}
CGINCLUDE
#include "UnityCG.cginc"
#include "lib.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _MainTex_TexelSize;
uniform half _Radius;
BlurVertexOutput vert(appdata_img v)
{
BlurVertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(BlurVertexOutput, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = GetGatherTexcoord(v.texcoord, _MainTex_TexelSize, _Radius);
return o;
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always Blend Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i)
half4 o = GATHER(_MainTex, i.texcoord);
return o;
}
ENDCG
}
Pass
{
CGPROGRAM
//Crop before blur
#pragma vertex vertCrop
#pragma fragment frag
#pragma multi_compile_local BACKGROUND_FILL_NONE BACKGROUND_FILL_COLOR
float4 _CropRegion;
half3 _BackgroundColor;
BlurVertexOutput vertCrop(appdata_img v)
{
BlurVertexOutput o = vert(v);
o.texcoord.xy = getNewUV(o.texcoord.xy, _CropRegion);
o.texcoord.zw = getNewUV(o.texcoord.zw, _CropRegion);
return o;
}
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 o = GATHER(_MainTex, i.texcoord);
#if BACKGROUND_FILL_COLOR
o.rgb = lerp(_BackgroundColor, o.rgb, o.a);
o.a = 1.0h;
#endif
return o;
}
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_SETUP_INSTANCE_ID(v);
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
//
// o.viewDir = mul(unity_CameraInvProjection, o.vertex).xyz;
// #if UNITY_UV_STARTS_AT_TOP
// o.viewDir.y = -o.viewDir.y;
// #endif
// o.viewDir.z = -o.viewDir.z;
// o.viewDir = mul(unity_CameraToWorld, o.viewDir.xyzz).xyz;
// return o;
// }
//
// samplerCUBE _EnvTex;
// float4 _EnvTex_HDR;
//
// half4 frag(v2f i) : SV_Target
// {
// UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
// half4 col = SAMPLE_SCREEN_TEX(_MainTex, i.uv);
// half4 envData = texCUBE(_EnvTex, normalize(i.viewDir));
// half3 env = DecodeHDR(envData, _EnvTex_HDR);
// col.rgb *= col.a;
// col.rgb = col.rgb + env * (1 - col.a);
// col.a = 1;
// return col;
// }
ENDCG
}
}
FallBack Off
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 12e87e7c7fde8e74db9f75172456c5c3
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,59 +0,0 @@
Shader "Hidden/FillCrop"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "lib.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
float4 _CropRegion;
fixed4 frag(v2f i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i)
return SAMPLE_SCREEN_TEX(_MainTex, getCroppedCoord(i.uv, _CropRegion));
}
ENDCG
}
}
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: d996ab4381100014d99e25e68e9aac84
timeCreated: 1540802700
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,165 +0,0 @@
Shader "UI/TranslucentImage"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Vibrancy("Vibrancy", Float) = 1
_Brightness("Brightness", Float) = 0
_Flatten("Flatten", Float) = 0
_StencilComp("Stencil Comparison", Float) = 8
_Stencil("Stencil ID", Float) = 0
_StencilOp("Stencil Operation", Float) = 0
_StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255
_ColorMask("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags
{
"Queue"= "Transparent"
"IgnoreProjector"= "True"
"RenderType"= "Transparent"
"PreviewType"= "Plane"
"CanUseSpriteAtlas"= "True"
}
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest[unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask[_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "lib.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata
{
half4 vertex : POSITION;
half4 color : COLOR;
half2 texcoord : TEXCOORD0;
half2 extraData : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
half4 vertex : SV_POSITION;
half4 color : COLOR;
float2 texcoord : TEXCOORD0;
half4 worldPosition : TEXCOORD1;
float4 blurTexcoord : TEXCOORD2;
half2 extraData : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _TextureSampleAdd;
half4 _ClipRect;
float4 _CropRegion; //xMin, yMin, xMax, yMax
v2f vert(appdata IN)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_INITIALIZE_OUTPUT(v2f, OUT);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = IN.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0)*half2(-1,1);
#endif
OUT.color = IN.color;
OUT.texcoord = IN.texcoord;
OUT.blurTexcoord = ComputeNonStereoScreenPos(OUT.vertex);
#if UNITY_VERSION >= 202120 && UNITY_UV_STARTS_AT_TOP
if(_ProjectionParams.x > 0 && unity_MatrixVP[1][1] < 0)
OUT.blurTexcoord.y = OUT.blurTexcoord.w - OUT.blurTexcoord.y;
#endif
OUT.extraData = IN.extraData;
return OUT;
}
sampler2D _MainTex;
UNITY_DECLARE_SCREENSPACE_TEXTURE(_BlurTex);
uniform half _Vibrancy;
uniform half _Flatten;
uniform half _Brightness;
half4 frag(v2f IN) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
//Overlay
half4 foregroundColor = tex2D(_MainTex, IN.texcoord.xy) + _TextureSampleAdd;
foregroundColor *= IN.color;
half2 blurTexcoord = IN.blurTexcoord.xy / IN.blurTexcoord.w;
blurTexcoord = getCroppedCoord(blurTexcoord, _CropRegion);
half3 backgroundColor = SAMPLE_SCREEN_TEX(_BlurTex, blurTexcoord).rgb;
//saturate help keep color in range
//Exclusion blend
half3 fgScaled = lerp(half3(0,0,0), foregroundColor.rgb * IN.extraData[0], _Flatten);
backgroundColor = saturate(backgroundColor + fgScaled - 2 * fgScaled * backgroundColor);
//Vibrancy
backgroundColor = saturate(lerp(LinearRgbToLuminance(backgroundColor), backgroundColor, _Vibrancy));
//Brightness
backgroundColor = saturate(backgroundColor + _Brightness);
//Alpha blend with backgroundColor
half4 color = half4(
lerp(backgroundColor, foregroundColor.rgb, IN.extraData[0]),
foregroundColor.a
);
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip(color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: b1115addd36579a429d5e6b4ffae668d
timeCreated: 1539852404
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bf78a7acb2cf96c468f81fe121a3301f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,135 +0,0 @@
Shader "Hidden/EfficientBlur_UniversalRP"
{
Properties
{
_BackgroundColor ("_BackgroundColor", Color) = (0,0,0,0)
}
HLSLINCLUDE
#pragma target 3.0
//HLSLcc is not used by default on gles
#pragma prefer_hlslcc gles
//SRP don't support dx9
#pragma exclude_renderers d3d11_9x
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "./lib.hlsl"
TEXTURE2D_X(_MainTex);
SAMPLER(sampler_MainTex);
uniform half4 _MainTex_TexelSize;
uniform half _Radius;
BlurVertexOutput vert(minimalVertexInput v)
{
BlurVertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 pos;
float2 uv;
#if USE_PROCEDURAL_QUAD
GetProceduralQuad(v.vertexID, pos, uv);
#else
pos = v.position;
uv = VertexToUV(v.position.xy);
#endif
o.vertex = half4(pos.xy, 0.0, 1.0);
o.texcoord = GetGatherTexcoord(uv, _MainTex_TexelSize, _Radius);
return o;
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always Blend Off
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 o = GATHER(_MainTex, i.texcoord);
return o;
}
ENDHLSL
}
Pass
{
HLSLPROGRAM
//Crop before blur
#pragma vertex vertCrop
#pragma fragment frag
#pragma multi_compile_local BACKGROUND_FILL_NONE BACKGROUND_FILL_COLOR
float4 _CropRegion;
half3 _BackgroundColor;
BlurVertexOutput vertCrop(minimalVertexInput v)
{
BlurVertexOutput o = vert(v);
o.texcoord.xy = getNewUV(o.texcoord.xy, _CropRegion);
o.texcoord.zw = getNewUV(o.texcoord.zw, _CropRegion);
return o;
}
half4 frag(BlurVertexOutput i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 o = GATHER(_MainTex, i.texcoord);
#if BACKGROUND_FILL_COLOR
o.rgb = lerp(_BackgroundColor, o.rgb, o.a);
o.a = 1.0h;
#endif
return o;
}
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_SETUP_INSTANCE_ID(v);
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
//
// o.viewDir = mul(unity_CameraInvProjection, o.vertex).xyz;
// #if UNITY_UV_STARTS_AT_TOP
// o.viewDir.y = -o.viewDir.y;
// #endif
// o.viewDir.z = -o.viewDir.z;
// o.viewDir = mul(unity_CameraToWorld, o.viewDir.xyzz).xyz;
// return o;
// }
//
// samplerCUBE _EnvTex;
// float4 _EnvTex_HDR;
//
// half4 frag(v2f i) : SV_Target
// {
// UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
// half4 col = SAMPLE_SCREEN_TEX(_MainTex, i.uv);
// half4 envData = texCUBE(_EnvTex, normalize(i.viewDir));
// half3 env = DecodeHDR(envData, _EnvTex_HDR);
// col.rgb *= col.a;
// col.rgb = col.rgb + env * (1 - col.a);
// col.a = 1;
// return col;
// }
ENDHLSL
}
}
FallBack Off
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 4a1d960bb7429ed49a23391385e9ca1b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,54 +0,0 @@
Shader "Hidden/FillCrop_UniversalRP"
{
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma target 3.0
//HLSLcc is not used by default on gles
#pragma prefer_hlslcc gles
//SRP don't support dx9
#pragma exclude_renderers d3d11_9x
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "./lib.hlsl"
minimalVertexOutput vert(minimalVertexInput v)
{
minimalVertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float4 pos;
float2 uv;
#if USE_PROCEDURAL_QUAD
GetProceduralQuad(v.vertexID, pos, uv);
#else
pos = v.position;
uv = VertexToUV(v.position.xy);
#endif
o.position = half4(pos.xy, 0.0, 1.0);
o.texcoord = uv;
return o;
}
TEXTURE2D_X(_MainTex);
float4 _CropRegion;
half4 frag(minimalVertexOutput v) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v)
return SAMPLE_SCREEN_TEX(_MainTex, getCroppedCoord(v.texcoord, _CropRegion));
}
ENDHLSL
}
}
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: be9460e8089353c42b6ec727f6fc3140
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,40 +0,0 @@
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "../common.hlsl"
#define USE_PROCEDURAL_QUAD (SHADER_TARGET >= 30 && !SHADER_API_GLES)
struct minimalVertexInput
{
#if USE_PROCEDURAL_QUAD
uint vertexID : SV_VertexID;
#else
float4 position : POSITION;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct minimalVertexOutput
{
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
void GetProceduralQuad(in uint vertexID, out float4 positionCS, out float2 uv)
{
positionCS = GetQuadVertexPosition(vertexID);
positionCS.xy = positionCS.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f);
uv = GetQuadTexCoord(vertexID); // * _ScaleBias.xy + _ScaleBias.zw;
}
float2 VertexToUV(float2 vertex)
{
float2 texcoord = (vertex + 1.0) * 0.5; // triangle vert to uv
#if UNITY_UV_STARTS_AT_TOP
texcoord = texcoord * float2(1.0, -1.0) + float2(0.0, 1.0);
#endif
return texcoord;
}
SAMPLER(sampler_LinearClamp);
#define SAMPLE_SCREEN_TEX(tex, uv) SAMPLE_TEXTURE2D_X(tex, sampler_LinearClamp, UnityStereoTransformScreenSpaceTex(uv))

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 005bb204b9b54cb7868e1aa065f00838
timeCreated: 1562251098

View File

@ -1,45 +0,0 @@
#define GATHER(tex, locations) \
o = SAMPLE_SCREEN_TEX(tex, locations.xw) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.zw) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.xy) * 1.0h / 4.0h; \
o += SAMPLE_SCREEN_TEX(tex, locations.zy) * 1.0h / 4.0h; \
#if defined(UNITY_SINGLE_PASS_STEREO)
float4 StereoAdjustedTexelSize(float4 texelSize)
{
texelSize.x = texelSize.x * 2.0; // texelSize.x = 1/w. For a double-wide texture, the true resolution is given by 2/w.
texelSize.z = texelSize.z * 0.5; // texelSize.z = w. For a double-wide texture, the true size of the eye texture is given by w/2.
return texelSize;
}
#else
float4 StereoAdjustedTexelSize(float4 texelSize)
{
return texelSize;
}
#endif
float4 GetGatherTexcoord(float2 texcoord, float4 texelSize, half radius)
{
half4 offset = half2(-0.5h, 0.5h).xxyy; //-x, -y, x, y
offset *= StereoAdjustedTexelSize(texelSize).xyxy;
offset *= radius;
return texcoord.xyxy + offset;
}
float2 getNewUV(float2 oldUV, float4 cropRegion)
{
return lerp(cropRegion.xy, cropRegion.zw, oldUV);
}
float2 getCroppedCoord(float2 screenCoord, float4 cropRegion)
{
return (screenCoord - cropRegion.xy) / (cropRegion.zw - cropRegion.xy);
}
struct BlurVertexOutput
{
float4 vertex : SV_POSITION;
float4 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: a0f93ce7a1dcd4341947566d67947b0d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +0,0 @@
#include <UnityCG.cginc>
#include "common.hlsl"
#define SAMPLE_SCREEN_TEX(tex, uv) UNITY_SAMPLE_SCREENSPACE_TEXTURE(tex, UnityStereoTransformScreenSpaceTex(uv))

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a8c68a14f2a58eb4eb95978229e5db5e
labels:
- TranslucentImageEditorResources
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: f086af857f26faa4ea62ddf64d9f44ec
folderAsset: yes
timeCreated: 1474981551
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: f164c4c349ef428f8c7537ba4218516d
timeCreated: 1560157255

View File

@ -1,9 +0,0 @@
using UnityEngine;
namespace LeTai.Asset.TranslucentImage
{
public class BlurConfig : ScriptableObject
{
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5a1c97a4c20d4c698acd8a00210f69fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: c2fc80b7e20a4104db1297bcddfd83b5, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,41 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
namespace LeTai.Asset.TranslucentImage
{
public enum BlurAlgorithmType
{
ScalableBlur
}
public enum BackgroundFillMode
{
None,
Color
}
[Serializable]
public class BackgroundFill
{
public BackgroundFillMode mode = BackgroundFillMode.None;
public Color color = Color.white;
}
public interface IBlurAlgorithm
{
void Init(BlurConfig config, bool isBirp);
void Blur(
CommandBuffer cmd,
RenderTargetIdentifier src,
Rect srcCropRegion,
BackgroundFill backgroundFill,
RenderTexture target
);
int GetScratchesCount();
void GetScratchDescriptor(int index, ref RenderTextureDescriptor descriptor);
void SetScratch(int index, RenderTargetIdentifier value);
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 6cf12665875748ef9dd9416b900b5143
timeCreated: 1558514104

View File

@ -1,132 +0,0 @@
using UnityEngine;
using UnityEngine.Rendering;
namespace LeTai.Asset.TranslucentImage
{
public class ScalableBlur : IBlurAlgorithm
{
const int BLUR_PASS = 0;
const int CROP_BLUR_PASS = 1;
readonly RenderTargetIdentifier[] scratches = new RenderTargetIdentifier[14];
bool isBirp;
Material material;
ScalableBlurConfig config;
Material Material
{
get
{
if (material == null)
Material = new Material(Shader.Find(isBirp
? "Hidden/EfficientBlur"
: "Hidden/EfficientBlur_UniversalRP"));
return material;
}
set => material = value;
}
public void Init(BlurConfig config, bool isBirp)
{
this.isBirp = isBirp;
this.config = (ScalableBlurConfig)config;
}
public void Blur(
CommandBuffer cmd,
RenderTargetIdentifier src,
Rect srcCropRegion,
BackgroundFill backgroundFill,
RenderTexture target
)
{
float radius = ScaleWithResolution(config.Radius,
target.width * srcCropRegion.width,
target.height * srcCropRegion.height);
ConfigMaterial(radius, srcCropRegion.ToMinMaxVector(), backgroundFill);
int stepCount = Mathf.Clamp(config.Iteration * 2 - 1, 1, scratches.Length * 2 - 1);
if(stepCount > 1)
cmd.BlitCustom(src, scratches[0], Material, CROP_BLUR_PASS, isBirp);
var depth = Mathf.Min(config.Iteration - 1, scratches.Length - 1);
for (var i = 1; i < stepCount; i++)
{
var fromIdx = SimplePingPong(i - 1, depth);
var toIdx = SimplePingPong(i, depth);
cmd.BlitCustom(scratches[fromIdx], scratches[toIdx], Material, 0, isBirp);
}
cmd.BlitCustom(stepCount > 1 ? scratches[0] : src,
target,
Material,
stepCount > 1 ? BLUR_PASS : CROP_BLUR_PASS,
isBirp);
}
public int GetScratchesCount()
{
return Mathf.Min(config.Iteration, scratches.Length);
}
public void GetScratchDescriptor(int index, ref RenderTextureDescriptor descriptor)
{
if (index == 0)
{
int firstDownsampleFactor = config.Iteration > 0 ? 1 : 0;
descriptor.width >>= firstDownsampleFactor;
descriptor.height >>= firstDownsampleFactor;
}
else
{
descriptor.width >>= 1;
descriptor.height >>= 1;
}
if (descriptor.width <= 0) descriptor.width = 1;
if (descriptor.height <= 0) descriptor.height = 1;
}
public void SetScratch(int index, RenderTargetIdentifier value)
{
scratches[index] = value;
}
protected void ConfigMaterial(float radius, Vector4 cropRegion, BackgroundFill backgroundFill)
{
switch (backgroundFill.mode)
{
case BackgroundFillMode.None:
Material.EnableKeyword("BACKGROUND_FILL_NONE");
Material.DisableKeyword("BACKGROUND_FILL_COLOR");
break;
case BackgroundFillMode.Color:
Material.EnableKeyword("BACKGROUND_FILL_COLOR");
Material.DisableKeyword("BACKGROUND_FILL_NONE");
Material.SetColor(ShaderId.BACKGROUND_COLOR, backgroundFill.color);
break;
}
Material.SetFloat(ShaderId.RADIUS, radius);
Material.SetVector(ShaderId.CROP_REGION, cropRegion);
}
///<summary>
/// Relative blur size to maintain same look across multiple resolution
/// </summary>
float ScaleWithResolution(float baseRadius, float width, float height)
{
float scaleFactor = Mathf.Min(width, height) / 1080f;
scaleFactor = Mathf.Clamp(scaleFactor, .5f, 2f); //too much variation cause artifact
return baseRadius * scaleFactor;
}
public static int SimplePingPong(int t, int max)
{
if (t > max)
return 2 * max - t;
return t;
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4406fc9923f04f9caf40ac4f57cb0eba
timeCreated: 1558514023

View File

@ -1,65 +0,0 @@
using UnityEngine;
namespace LeTai.Asset.TranslucentImage
{
[CreateAssetMenu(fileName = "New Scalable Blur Config",
menuName = "Translucent Image/ Scalable Blur Config",
order = 100)]
public class ScalableBlurConfig : BlurConfig
{
[SerializeField]
[Tooltip("Blurriness. Does NOT affect performance")]
float radius = 4;
[SerializeField]
[Tooltip("The number of times to run the algorithm to increase the smoothness of the effect. Can affect performance when increase")]
[Range(0, 8)]
int iteration = 4;
[SerializeField]
[Tooltip("How strong the blur is")]
float strength;
/// <summary>
/// Distance between the base texel and the texel to be sampled.
/// </summary>
public float Radius
{
get { return radius; }
set { radius = Mathf.Max(0, value); }
}
/// <summary>
/// Half the number of time to process the image. It is half because the real number of iteration must alway be even. Using half also make calculation simpler
/// </summary>
/// <value>
/// Must be non-negative
/// </value>
public int Iteration
{
get { return iteration; }
set { iteration = Mathf.Max(0, value); }
}
/// <summary>
/// User friendly property to control the amount of blur
/// </summary>
///<value>
/// Must be non-negative
/// </value>
public float Strength
{
get { return strength = Radius * Mathf.Pow(2, Iteration); }
set
{
strength = Mathf.Clamp(value, 0, (1 << 14) * (1 << 14));
// Bit fiddling would be faster, but need unsafe or .NET Core 3.0+
// for BitOperations, and BitConverter that doesn't creates garbages :(
radius = Mathf.Sqrt(strength);
iteration = 0;
while ((1 << iteration) < radius)
iteration++;
radius = strength / (1 << iteration);
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 510c61cdec524e86b647525bb5947f82
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: c2fc80b7e20a4104db1297bcddfd83b5, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 1ffad624d21be844dbf9ce8159d864d1
folderAsset: yes
timeCreated: 1475503998
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,76 +0,0 @@
using System;
using System.Globalization;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace LeTai.Asset.TranslucentImage.Editor
{
public class EditorProperty
{
public readonly SerializedProperty serializedProperty;
readonly SerializedObject serializedObject;
readonly MethodInfo propertySetter;
readonly SerializedProperty dirtyFlag;
public EditorProperty(SerializedObject obj, string name)
{
var propertyName = char.ToLowerInvariant(name[0]) + name.Substring(1);
serializedObject = obj;
serializedProperty = serializedObject.FindProperty(propertyName);
propertySetter = serializedObject.targetObject.GetType().GetProperty(name).SetMethod;
dirtyFlag = serializedObject.FindProperty("modifiedFromInspector");
}
public void Draw(params GUILayoutOption[] options)
{
using (var scope = new EditorGUI.ChangeCheckScope())
{
EditorGUILayout.PropertyField(serializedProperty, options);
if (!scope.changed)
return;
if (dirtyFlag != null)
dirtyFlag.boolValue = true;
serializedObject.ApplyModifiedProperties();
foreach (var target in serializedObject.targetObjects)
{
switch (serializedProperty.propertyType)
{
case SerializedPropertyType.ObjectReference:
propertySetter.Invoke(target, new object[] { serializedProperty.objectReferenceValue });
break;
case SerializedPropertyType.Float:
propertySetter.Invoke(target, new object[] { serializedProperty.floatValue });
break;
case SerializedPropertyType.Integer:
propertySetter.Invoke(target, new object[] { serializedProperty.intValue });
break;
case SerializedPropertyType.Rect:
propertySetter.Invoke(target, new object[] { serializedProperty.rectValue });
break;
case SerializedPropertyType.Enum:
propertySetter.Invoke(target, new object[] { serializedProperty.enumValueIndex });
break;
case SerializedPropertyType.Boolean:
propertySetter.Invoke(target, new object[] { serializedProperty.boolValue });
break;
case SerializedPropertyType.Color:
propertySetter.Invoke(target, new object[] { serializedProperty.colorValue });
break;
case SerializedPropertyType.Generic:
// Not needed for now
break;
default: throw new NotImplementedException($"Type {serializedProperty.propertyType} is not implemented");
}
}
serializedObject.Update();
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a6efd34a11308a746bf9a43556eb283b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,26 +0,0 @@
{
"name": "LeTai.TranslucentImage.Editor",
"rootNamespace": "",
"references": [
"LeTai.TranslucentImage"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"LeTai_TranslucentImage"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "12",
"define": "URP12_OR_NEWER"
}
],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 4cd721a6e0b119447afc3819b9015b13
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,175 +0,0 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace LeTai.Asset.TranslucentImage.Editor
{
public class MenuIntegration : MonoBehaviour
{
[MenuItem("GameObject/UI/Translucent Image", false, 3)]
static void CreateTranslucentImage(MenuCommand menuCommand)
{
// Create a custom game object
GameObject go = new GameObject("Translucent Image");
go.AddComponent<TranslucentImage>();
PlaceUIElementRoot(go, menuCommand);
}
[MenuItem("CONTEXT/Image/Convert to Translucent Image", false, 3)]
static void ConvertToTranslucentImage(MenuCommand menuCommand)
{
var image = (Image) menuCommand.context;
var go = image.gameObject;
Undo.DestroyObjectImmediate(image);
var ti = Undo.AddComponent<TranslucentImage>(go);
ti.sprite = image.sprite;
var color = image.color;
ti.color = new Color(color.r, color.g, color.b,
1); // sprite blending should be used instead of alpha most of the time
ti.raycastTarget = image.raycastTarget;
ti.type = image.type;
ti.useSpriteMesh = image.useSpriteMesh;
ti.preserveAspect = image.preserveAspect;
ti.fillCenter = image.fillCenter;
ti.fillMethod = image.fillMethod;
ti.fillOrigin = image.fillOrigin;
ti.fillAmount = image.fillAmount;
ti.fillClockwise = image.fillClockwise;
}
#region PlaceUIElementRoot
static void PlaceUIElementRoot(GameObject element, MenuCommand menuCommand)
{
GameObject parent = menuCommand.context as GameObject;
if (parent == null || parent.GetComponentInParent<Canvas>() == null)
{
parent = GetOrCreateCanvasGameObject();
}
string uniqueName = GameObjectUtility.GetUniqueNameForSibling(parent.transform, element.name);
element.name = uniqueName;
Undo.RegisterCreatedObjectUndo(element, "Create " + element.name);
Undo.SetTransformParent(element.transform, parent.transform, "Parent " + element.name);
GameObjectUtility.SetParentAndAlign(element, parent);
if (parent != menuCommand.context) // not a context click, so center in sceneview
SetPositionVisibleinSceneView(
parent.GetComponent<RectTransform>(),
element.GetComponent<RectTransform>());
Selection.activeGameObject = element;
}
// Helper function that returns a Canvas GameObject; preferably a parent of the selection, or other existing Canvas.
public static GameObject GetOrCreateCanvasGameObject()
{
GameObject selectedGo = Selection.activeGameObject;
// Try to find a gameobject that is the selected GO or one if its parents.
Canvas canvas = (selectedGo != null) ? selectedGo.GetComponentInParent<Canvas>() : null;
if (canvas != null && canvas.gameObject.activeInHierarchy)
return canvas.gameObject;
// No canvas in selection or its parents? Then use just any canvas..
canvas = Shims.FindObjectOfType<Canvas>();
if (canvas != null && canvas.gameObject.activeInHierarchy)
return canvas.gameObject;
// No canvas in the scene at all? Then create a new one.
return CreateNewUI();
}
public static GameObject CreateNewUI()
{
// Root for the UI
var root = new GameObject("Canvas") {layer = LayerMask.NameToLayer("UI")};
Canvas canvas = root.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
root.AddComponent<CanvasScaler>();
root.AddComponent<GraphicRaycaster>();
Undo.RegisterCreatedObjectUndo(root, "Create " + root.name);
// if there is no event system add one...
CreateEventSystem(false);
return root;
}
static void CreateEventSystem(bool select, GameObject parent = null)
{
var esys = Shims.FindObjectOfType<EventSystem>();
if (esys == null)
{
var eventSystem = new GameObject("EventSystem");
GameObjectUtility.SetParentAndAlign(eventSystem, parent);
esys = eventSystem.AddComponent<EventSystem>();
eventSystem.AddComponent<StandaloneInputModule>();
Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name);
}
if (select && esys != null)
{
Selection.activeGameObject = esys.gameObject;
}
}
static void SetPositionVisibleinSceneView(RectTransform canvasRTransform, RectTransform itemTransform)
{
// Find the best scene view
SceneView sceneView = SceneView.lastActiveSceneView;
if (sceneView == null && SceneView.sceneViews.Count > 0)
sceneView = SceneView.sceneViews[0] as SceneView;
// Couldn't find a SceneView. Don't set position.
if (sceneView == null || sceneView.camera == null)
return;
// Create world space Plane from canvas position.
Vector2 localPlanePosition;
Camera camera = sceneView.camera;
Vector3 position = Vector3.zero;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(
canvasRTransform,
new Vector2(camera.pixelWidth / 2, camera.pixelHeight / 2),
camera,
out localPlanePosition))
{
// Adjust for canvas pivot
localPlanePosition.x = localPlanePosition.x + canvasRTransform.sizeDelta.x * canvasRTransform.pivot.x;
localPlanePosition.y = localPlanePosition.y + canvasRTransform.sizeDelta.y * canvasRTransform.pivot.y;
localPlanePosition.x = Mathf.Clamp(localPlanePosition.x, 0, canvasRTransform.sizeDelta.x);
localPlanePosition.y = Mathf.Clamp(localPlanePosition.y, 0, canvasRTransform.sizeDelta.y);
// Adjust for anchoring
position.x = localPlanePosition.x - canvasRTransform.sizeDelta.x * itemTransform.anchorMin.x;
position.y = localPlanePosition.y - canvasRTransform.sizeDelta.y * itemTransform.anchorMin.y;
Vector3 minLocalPosition;
minLocalPosition.x = canvasRTransform.sizeDelta.x * (0 - canvasRTransform.pivot.x) +
itemTransform.sizeDelta.x * itemTransform.pivot.x;
minLocalPosition.y = canvasRTransform.sizeDelta.y * (0 - canvasRTransform.pivot.y) +
itemTransform.sizeDelta.y * itemTransform.pivot.y;
Vector3 maxLocalPosition;
maxLocalPosition.x = canvasRTransform.sizeDelta.x * (1 - canvasRTransform.pivot.x) -
itemTransform.sizeDelta.x * itemTransform.pivot.x;
maxLocalPosition.y = canvasRTransform.sizeDelta.y * (1 - canvasRTransform.pivot.y) -
itemTransform.sizeDelta.y * itemTransform.pivot.y;
position.x = Mathf.Clamp(position.x, minLocalPosition.x, maxLocalPosition.x);
position.y = Mathf.Clamp(position.y, minLocalPosition.y, maxLocalPosition.y);
}
itemTransform.anchoredPosition = position;
itemTransform.localRotation = Quaternion.identity;
itemTransform.localScale = Vector3.one;
}
#endregion
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 99feb6419b119464aa5a3ad6549ea73c
timeCreated: 1539852386
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ace044fc6a6bf3649a39e77c7a77f6c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -1,106 +0,0 @@
fileFormatVersion: 2
guid: c2fc80b7e20a4104db1297bcddfd83b5
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
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
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
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: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -1,106 +0,0 @@
fileFormatVersion: 2
guid: 4bc9a290ca74e434499699e3db41c3f9
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
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
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
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: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,106 +0,0 @@
fileFormatVersion: 2
guid: 0764cd30e065b7340891d9f7f680a12f
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
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
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
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: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,111 +0,0 @@
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;
namespace LeTai.Asset.TranslucentImage.Editor
{
[CustomEditor(typeof(ScalableBlurConfig))]
[CanEditMultipleObjects]
public class ScalableBlurConfigEditor : UnityEditor.Editor
{
readonly AnimBool useAdvancedControl = new AnimBool(false);
int tab, previousTab;
EditorProperty radius;
EditorProperty iteration;
EditorProperty strength;
public void Awake()
{
LoadTabSelection();
useAdvancedControl.value = tab > 0;
}
public void OnEnable()
{
radius = new EditorProperty(serializedObject, nameof(ScalableBlurConfig.Radius));
iteration = new EditorProperty(serializedObject, nameof(ScalableBlurConfig.Iteration));
strength = new EditorProperty(serializedObject, nameof(ScalableBlurConfig.Strength));
// Without this editor will not Repaint automatically when animating
useAdvancedControl.valueChanged.AddListener(Repaint);
}
public override void OnInspectorGUI()
{
Draw();
}
public void Draw()
{
using (new EditorGUILayout.VerticalScope())
{
DrawTabBar();
using (var changes = new EditorGUI.ChangeCheckScope())
{
serializedObject.Update();
DrawTabsContent();
if (changes.changed) serializedObject.ApplyModifiedProperties();
}
}
}
void DrawTabBar()
{
using (var h = new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
tab = GUILayout.Toolbar(
tab,
new[] { "Simple", "Advanced" },
GUILayout.MinWidth(0),
GUILayout.MaxWidth(EditorGUIUtility.pixelsPerPoint * 192)
);
GUILayout.FlexibleSpace();
}
if (tab != previousTab)
{
GUI.FocusControl(""); // Defocus
SaveTabSelection();
previousTab = tab;
}
useAdvancedControl.target = tab == 1;
}
void DrawTabsContent()
{
if (EditorGUILayout.BeginFadeGroup(1 - useAdvancedControl.faded))
{
// EditorProperty dooesn't invoke getter. Not needed anywhere else.
_ = ((ScalableBlurConfig)target).Strength;
strength.Draw();
}
EditorGUILayout.EndFadeGroup();
if (EditorGUILayout.BeginFadeGroup(useAdvancedControl.faded))
{
radius.Draw();
iteration.Draw();
}
EditorGUILayout.EndFadeGroup();
}
//Persist selected tab between sessions and instances
void SaveTabSelection()
{
EditorPrefs.SetInt("LETAI_TRANSLUCENTIMAGE_TIS_TAB", tab);
}
void LoadTabSelection()
{
if (EditorPrefs.HasKey("LETAI_TRANSLUCENTIMAGE_TIS_TAB"))
tab = EditorPrefs.GetInt("LETAI_TRANSLUCENTIMAGE_TIS_TAB");
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 771a13bc1eb042bc9d4ad186dd99dda5
timeCreated: 1560160054

View File

@ -1,55 +0,0 @@
using System;
using System.Linq;
using System.Reflection;
using UnityEditor;
namespace LeTai.Asset.TranslucentImage.Editor
{
class ScenceGizmoAutoDisable : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (!importedAssets.Any(p => p.Contains("TranslucentImage")))
return;
var structAnnotation = Type.GetType("UnityEditor.Annotation, UnityEditor");
if (structAnnotation == null) return;
var fieldClassId = structAnnotation.GetField("classID");
var fieldScriptClass = structAnnotation.GetField("scriptClass");
var fieldFlags = structAnnotation.GetField("flags");
var fieldIconEnabled = structAnnotation.GetField("iconEnabled");
Type classAnnotationUtility = Type.GetType("UnityEditor.AnnotationUtility, UnityEditor");
if (classAnnotationUtility == null) return;
var methodGetAnnotations = classAnnotationUtility.GetMethod("GetAnnotations", BindingFlags.NonPublic | BindingFlags.Static);
if (methodGetAnnotations == null) return;
var methodSetIconEnabled = classAnnotationUtility.GetMethod("SetIconEnabled", BindingFlags.NonPublic | BindingFlags.Static);
if (methodSetIconEnabled == null) return;
Array annotations = (Array)methodGetAnnotations.Invoke(null, null);
foreach (var a in annotations)
{
string scriptClass = (string)fieldScriptClass.GetValue(a);
// built in types
if (string.IsNullOrEmpty(scriptClass)) continue;
int classId = (int)fieldClassId.GetValue(a);
int flags = (int)fieldFlags.GetValue(a);
int iconEnabled = (int)fieldIconEnabled.GetValue(a);
const int maskHasIcon = 1;
bool hasIconFlag = (flags & maskHasIcon) == maskHasIcon;
if (hasIconFlag
&& iconEnabled != 0
&& scriptClass.Contains("TranslucentImage"))
{
methodSetIconEnabled.Invoke(null, new object[] { classId, scriptClass, 0 });
}
}
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d3c5df780c45454e820502d48a07db97
timeCreated: 1575814101

View File

@ -1,151 +0,0 @@
using System.Linq;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine;
using Debug = System.Diagnostics.Debug;
namespace LeTai.Asset.TranslucentImage.Editor
{
[CustomEditor(typeof(TranslucentImage))]
[CanEditMultipleObjects]
public class TranslucentImageEditor : ImageEditor
{
SerializedProperty spriteBlending;
SerializedProperty source;
SerializedProperty vibrancy;
SerializedProperty brightness;
SerializedProperty flatten;
bool materialUsedInDifferentSource;
bool usingIncorrectShader;
Shader correctShader;
protected override void OnEnable()
{
base.OnEnable();
source = serializedObject.FindProperty("source");
spriteBlending = serializedObject.FindProperty("m_spriteBlending");
vibrancy = serializedObject.FindProperty("vibrancy");
brightness = serializedObject.FindProperty("brightness");
flatten = serializedObject.FindProperty("flatten");
correctShader = Shader.Find("UI/TranslucentImage");
var self = serializedObject.targetObject as TranslucentImage;
if (self)
{
CheckMaterialUsedInDifferentSource(self);
CheckCorrectShader(self);
}
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var ti = serializedObject.targetObject as TranslucentImage;
Debug.Assert(ti != null, "Translucent Image Editor serializedObject target is null");
var oldSource = ti.source;
var oldMaterial = ti.material;
base.OnInspectorGUI();
if (usingIncorrectShader)
{
EditorGUILayout.HelpBox("Material should use shader UI/Translucent Image",
MessageType.Error);
}
serializedObject.Update();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.PropertyField(source);
if (source.objectReferenceValue == null)
{
var existingSources = Shims.FindObjectsOfType<TranslucentImageSource>();
if (existingSources.Length > 0)
{
using (new EditorGUI.IndentLevelScope())
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.PrefixLabel("From current Scene");
using (new EditorGUILayout.VerticalScope())
foreach (var s in existingSources)
{
if (GUILayout.Button(s.gameObject.name))
source.objectReferenceValue = s;
}
}
EditorGUILayout.Space();
}
else
{
EditorGUILayout.HelpBox("No Translucent Image Source(s) found in current scene", MessageType.Warning);
}
}
if (materialUsedInDifferentSource)
{
EditorGUILayout.HelpBox("Translucent Images with different Sources" +
" should also use different Materials",
MessageType.Error);
}
EditorGUILayout.PropertyField(spriteBlending);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Shared settings", EditorStyles.centeredGreyMiniLabel);
EditorGUILayout.PropertyField(vibrancy);
EditorGUILayout.PropertyField(brightness);
EditorGUILayout.PropertyField(flatten);
serializedObject.ApplyModifiedProperties();
if (ti.source != oldSource)
OnSourceChanged(ti);
if (ti.material != oldMaterial)
OnMaterialChanged(ti);
}
void OnSourceChanged(TranslucentImage self)
{
CheckMaterialUsedInDifferentSource(self);
}
void OnMaterialChanged(TranslucentImage self)
{
CheckMaterialUsedInDifferentSource(self);
CheckCorrectShader(self);
}
private void CheckCorrectShader(TranslucentImage self)
{
usingIncorrectShader = self.material.shader != correctShader;
}
private void CheckMaterialUsedInDifferentSource(TranslucentImage self)
{
if (!self.source)
{
materialUsedInDifferentSource = false;
return;
}
var diffSource = Shims.FindObjectsOfType<TranslucentImage>()
.Where(ti => ti.source != self.source)
.ToList();
if (!diffSource.Any())
{
materialUsedInDifferentSource = false;
return;
}
var sameMat = diffSource.GroupBy(ti => ti.material).ToList();
materialUsedInDifferentSource = sameMat.All(group => group.Key == self.material);
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 9a6952d1e37a4f0458848a0e61378de5
timeCreated: 1539852386
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,83 +0,0 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace LeTai.Asset.TranslucentImage.Editor
{
[CustomEditor(typeof(TranslucentImageSource))]
[CanEditMultipleObjects]
public class TranslucentImageSourceEditor : UnityEditor.Editor
{
UnityEditor.Editor configEditor;
EditorProperty blurConfig;
EditorProperty downsample;
EditorProperty blurRegion;
EditorProperty maxUpdateRate;
EditorProperty backgroundFill;
EditorProperty preview;
ScalableBlurConfigEditor ConfigEditor
{
get
{
if (configEditor == null)
{
var config = ((TranslucentImageSource)target).BlurConfig;
if (config != null)
configEditor = CreateEditor(config);
}
return (ScalableBlurConfigEditor)configEditor;
}
}
void OnEnable()
{
blurConfig = new EditorProperty(serializedObject, nameof(TranslucentImageSource.BlurConfig));
downsample = new EditorProperty(serializedObject, nameof(TranslucentImageSource.Downsample));
blurRegion = new EditorProperty(serializedObject, nameof(TranslucentImageSource.BlurRegion));
maxUpdateRate = new EditorProperty(serializedObject, nameof(TranslucentImageSource.MaxUpdateRate));
backgroundFill = new EditorProperty(serializedObject, nameof(TranslucentImageSource.BackgroundFill));
preview = new EditorProperty(serializedObject, nameof(TranslucentImageSource.Preview));
}
public override void OnInspectorGUI()
{
EditorGUILayout.Space();
blurConfig.Draw();
var curConfig = (ScalableBlurConfig)blurConfig.serializedProperty.objectReferenceValue;
if (!curConfig)
{
EditorGUILayout.HelpBox("Missing Blur Config", MessageType.Warning);
if (GUILayout.Button("New Blur Config File"))
{
ScalableBlurConfig newConfig = CreateInstance<ScalableBlurConfig>();
var path = AssetDatabase.GenerateUniqueAssetPath(
$"Assets/{SceneManager.GetActiveScene().name} {serializedObject.targetObject.name} Blur Config.asset");
AssetDatabase.CreateAsset(newConfig, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
EditorGUIUtility.PingObject(newConfig);
blurConfig.serializedProperty.objectReferenceValue = newConfig;
}
}
else
{
ConfigEditor.Draw();
}
EditorGUILayout.Space();
downsample.Draw();
blurRegion.Draw();
maxUpdateRate.Draw();
backgroundFill.Draw();
preview.Draw();
if (GUI.changed) serializedObject.ApplyModifiedProperties();
}
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: ec905d5b1e2c40f40b5cdd580f727f3e
timeCreated: 1539852387
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,23 +0,0 @@
#if UNITY_2019
using System.IO;
using UnityEditor;
using UnityEngine;
namespace LeTai.Asset.TranslucentImage.Editor
{
public class Unity2019ShaderCompilerBugWorkaround : ScriptableObject
{
[MenuItem("Tools/Translucent Image/Fix Shader Compile Errors")]
static void ReImport()
{
var guids = AssetDatabase.FindAssets("l:TranslucentImageEditorResources lib");
var path = AssetDatabase.GUIDToAssetPath(guids[0]);
var text = File.ReadAllText(path);
File.WriteAllText(path, text + "//DELETE ME: Workaround shader not compiling in Unity 2019");
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
File.WriteAllText(path, text);
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
}
}
}
#endif

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: cb015e0abde84fd19af30c2bb2847361
timeCreated: 1624351629

View File

@ -1,196 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
namespace LeTai.Asset.TranslucentImage
{
/// <summary>
/// Dynamic blur-behind UI element
/// </summary>
[HelpURL("https://leloctai.com/asset/translucentimage/docs/articles/customize.html#translucent-image")]
public partial class TranslucentImage : Image, IMeshModifier
{
/// <summary>
/// Source of blur for this image
/// </summary>
public TranslucentImageSource source;
/// <summary>
/// (De)Saturate the image, 1 is normal, 0 is grey scale, below zero make the image negative
/// </summary>
[Tooltip("(De)Saturate the image, 1 is normal, 0 is black and white, below zero make the image negative")]
[Range(-1, 3)]
public float vibrancy = 1;
/// <summary>
/// Brighten/darken the image
/// </summary>
[Tooltip("Brighten/darken the image")] [Range(-1, 1)]
public float brightness = 0;
/// <summary>
/// Flatten the color behind to help keep contrast on varying background
/// </summary>
[Tooltip("Flatten the color behind to help keep contrast on varying background")] [Range(0, 1)]
public float flatten = .1f;
static readonly int _vibrancyPropId = Shader.PropertyToID("_Vibrancy");
static readonly int _brightnessPropId = Shader.PropertyToID("_Brightness");
static readonly int _flattenPropId = Shader.PropertyToID("_Flatten");
static readonly int _blurTexPropId = Shader.PropertyToID("_BlurTex");
static readonly int _cropRegionPropId = Shader.PropertyToID("_CropRegion");
Material materialForRenderingCached;
bool shouldRun;
bool isBirp;
protected override void Start()
{
base.Start();
isBirp = !GraphicsSettings.currentRenderPipeline;
oldVibrancy = vibrancy;
oldBrightness = brightness;
oldFlatten = flatten;
AutoAcquireSource();
if (material)
{
//Have to use string comparison as Addressable break object comparision :(
if (Application.isPlaying && material.shader.name != "UI/TranslucentImage")
{
Debug.LogWarning("Translucent Image requires a material using the \"UI/TranslucentImage\" shader");
}
else if (source)
{
material.SetTexture(_blurTexPropId, source.BlurredScreen);
}
}
#if UNITY_5_6_OR_NEWER
if (canvas)
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
#endif
}
bool IsInPrefabMode()
{
#if !UNITY_EDITOR
return false;
#else // UNITY_EDITOR
#if UNITY_2021_2_OR_NEWER
var stage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#else
var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#endif
return stage != null;
#endif // !UNITY_EDITOR
}
bool sourceAcquiredOnStart = false;
void AutoAcquireSource()
{
if (IsInPrefabMode()) return;
if (sourceAcquiredOnStart) return;
source = source ? source : Shims.FindObjectOfType<TranslucentImageSource>();
sourceAcquiredOnStart = true;
}
bool Validate()
{
if (!IsActive() || !material)
return false;
if (!source)
{
if (Application.isPlaying && !IsInPrefabMode())
{
Debug.LogWarning("TranslucentImageSource is missing. " +
"Please add the TranslucentImageSource component to your main camera, " +
"then assign it to the Source field of the Translucent Image(s)");
}
return false;
}
if (!source.BlurredScreen)
return false;
return true;
}
void LateUpdate()
{
if (!shouldRun) return;
// After re-enabled
if (!materialForRenderingCached)
{
materialForRenderingCached = materialForRendering;
}
materialForRenderingCached.SetTexture(_blurTexPropId, source.BlurredScreen);
if (isBirp || canvas.renderMode == RenderMode.ScreenSpaceOverlay)
{
materialForRenderingCached.SetVector(_cropRegionPropId, source.BlurRegionNormalizedScreenSpace.ToMinMaxVector());
}
else
{
materialForRenderingCached.SetVector(_cropRegionPropId, source.BlurRegion.ToMinMaxVector());
}
source.Request();
}
void Update()
{
shouldRun = Validate();
if (!shouldRun) return;
if (_vibrancyPropId == 0 || _brightnessPropId == 0 || _flattenPropId == 0)
return;
materialForRenderingCached = materialForRendering;
SyncMaterialProperty(_vibrancyPropId, ref vibrancy, ref oldVibrancy);
SyncMaterialProperty(_brightnessPropId, ref brightness, ref oldBrightness);
SyncMaterialProperty(_flattenPropId, ref flatten, ref oldFlatten);
}
float oldVibrancy, oldBrightness, oldFlatten;
/// <summary>
/// Sync material property with instance
/// </summary>
/// <param name="propId">material property id</param>
/// <param name="value"></param>
/// <param name="oldValue"></param>
void SyncMaterialProperty(int propId, ref float value, ref float oldValue)
{
float matValue = materialForRendering.GetFloat(propId);
if (Mathf.Abs(matValue - value) > 1e-4)
{
if (Mathf.Abs(value - oldValue) > 1e-4)
{
if (materialForRenderingCached)
materialForRenderingCached.SetFloat(propId, value);
material.SetFloat(propId, value);
SetMaterialDirty();
}
else
{
value = matValue;
}
}
oldValue = value;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 196bb08d6c2d3c9499c04e1281fd4ad3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 0764cd30e065b7340891d9f7f680a12f, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,46 +0,0 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace LeTai.Asset.TranslucentImage
{
[ExecuteAlways]
[AddComponentMenu("UI/Translucent Image", 2)]
public partial class TranslucentImage
{
protected override void Reset()
{
base.Reset();
color = Color.white;
material = FindDefaultMaterial();
vibrancy = material.GetFloat(_vibrancyPropId);
brightness = material.GetFloat(_brightnessPropId);
flatten = material.GetFloat(_flattenPropId);
source = source ? source : Shims.FindObjectOfType<TranslucentImageSource>();
}
static Material FindDefaultMaterial()
{
var guid = AssetDatabase.FindAssets("Default-Translucent t:Material l:TranslucentImageResource");
if (guid.Length == 0)
Debug.LogError("Can't find Default-Translucent Material");
var path = AssetDatabase.GUIDToAssetPath(guid[0]);
return AssetDatabase.LoadAssetAtPath<Material>(path);
}
protected override void OnValidate()
{
base.OnValidate();
SetVerticesDirty();
Update();
}
}
}
#endif

View File

@ -1,80 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace LeTai.Asset.TranslucentImage
{
public partial class TranslucentImage
{
[Tooltip("Blend between the sprite and background blur")]
[Range(0, 1)]
[FormerlySerializedAs("spriteBlending")]
public float m_spriteBlending = .65f;
public float spriteBlending
{
get => m_spriteBlending;
set
{
m_spriteBlending = value;
SetVerticesDirty();
}
}
public virtual void ModifyMesh(VertexHelper vh)
{
List<UIVertex> vertices = new List<UIVertex>();
vh.GetUIVertexStream(vertices);
for (var i = 0; i < vertices.Count; i++)
{
UIVertex moddedVertex = vertices[i];
moddedVertex.uv1 = new Vector2(spriteBlending,
0 //No use for this yet
);
vertices[i] = moddedVertex;
}
vh.Clear();
vh.AddUIVertexTriangleStream(vertices);
}
protected override void OnEnable()
{
base.OnEnable();
SetVerticesDirty();
#if UNITY_EDITOR
if (!EditorApplication.isPlayingOrWillChangePlaymode)
{
Start();
}
#endif
}
protected override void OnDisable()
{
SetVerticesDirty();
base.OnDisable();
}
protected override void OnDidApplyAnimationProperties()
{
SetVerticesDirty();
base.OnDidApplyAnimationProperties();
}
public virtual void ModifyMesh(Mesh mesh)
{
using (var vh = new VertexHelper(mesh))
{
ModifyMesh(vh);
vh.FillMesh(mesh);
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0b05506e8cfa429f9ae909aab9a9e3e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,380 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.Rendering;
#if ENABLE_VR
using UnityEngine.XR;
#endif
namespace LeTai.Asset.TranslucentImage
{
/// <summary>
/// Common source of blur for Translucent Images.
/// </summary>
/// <remarks>
/// It is an Image effect that blur the render target of the Camera it attached to, then save the result to a global read-only Render Texture
/// </remarks>
[ExecuteAlways]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Tai Le Assets/Translucent Image Source")]
[HelpURL("https://leloctai.com/asset/translucentimage/docs/articles/customize.html#translucent-image-source")]
public partial class TranslucentImageSource : MonoBehaviour
{
#region Private Field
[SerializeField]
BlurConfig blurConfig;
[SerializeField] [Range(0, 3)]
[Tooltip("Reduce the size of the screen before processing. Increase will improve performance but create more artifact")]
int downsample;
[SerializeField]
[Tooltip("Choose which part of the screen to blur. Smaller region is faster")]
Rect blurRegion = new Rect(0, 0, 1, 1);
[SerializeField]
[Tooltip("How many time to blur per second. Reduce to increase performance and save battery for slow moving background")]
float maxUpdateRate = float.PositiveInfinity;
[SerializeField]
[Tooltip("Preview the effect fullscreen. Not recommended for runtime use")]
bool preview;
[SerializeField]
[Tooltip("Fill the background where the frame buffer alpha is 0. Useful for VR Underlay and Passthrough, where these areas would otherwise be black")]
BackgroundFill backgroundFill = new BackgroundFill();
int lastDownsample;
Rect lastBlurRegion = new Rect(0, 0, 1, 1);
Vector2Int lastCamPixelSize = Vector2Int.zero;
float lastUpdate;
IBlurAlgorithm blurAlgorithm;
#pragma warning disable 0108
Camera camera;
#pragma warning restore 0108
Material previewMaterial;
RenderTexture blurredScreen;
CommandBuffer cmd;
bool isRequested;
#pragma warning disable CS0169
bool isForOverlayCanvas;
#pragma warning restore CS0169
#endregion
#region Properties
public BlurConfig BlurConfig
{
get { return blurConfig; }
set
{
blurConfig = value;
InitializeBlurAlgorithm();
}
}
/// <summary>
/// The rendered image will be shrinked by a factor of 2^{{Downsample}} before bluring to reduce processing time
/// </summary>
/// <value>
/// Must be non-negative. Default to 0
/// </value>
public int Downsample
{
get { return downsample; }
set { downsample = Mathf.Max(0, value); }
}
/// <summary>
/// Define the rectangular area on screen that will be blurred.
/// </summary>
/// <value>
/// Between 0 and 1
/// </value>
public Rect BlurRegion
{
get { return blurRegion; }
set
{
Vector2 min = new Vector2(1 / (float)Cam.pixelWidth, 1 / (float)Cam.pixelHeight);
blurRegion.x = Mathf.Clamp(value.x, 0, 1 - min.x);
blurRegion.y = Mathf.Clamp(value.y, 0, 1 - min.y);
blurRegion.width = Mathf.Clamp(value.width, min.x, 1 - blurRegion.x);
blurRegion.height = Mathf.Clamp(value.height, min.y, 1 - blurRegion.y);
}
}
/// <summary>
/// Maximum number of times to update the blurred image each second
/// </summary>
public float MaxUpdateRate
{
get => maxUpdateRate;
set => maxUpdateRate = value;
}
/// <summary>
/// Fill the background where the frame buffer alpha is 0. Useful for VR Underlay and Passthrough, where these areas would otherwise be black
/// </summary>
public BackgroundFill BackgroundFill
{
get => backgroundFill;
set => backgroundFill = value;
}
/// <summary>
/// Render the blurred result to the render target
/// </summary>
public bool Preview
{
get => preview;
set => preview = value;
}
/// <summary>
/// Result of the image effect. Translucent Image use this as their content (read-only)
/// </summary>
public RenderTexture BlurredScreen
{
get { return blurredScreen; }
set { blurredScreen = value; }
}
/// <summary>
/// Set in SRP to provide Cam.rect for overlay cameras
/// </summary>
public Rect CamRectOverride { get; set; } = Rect.zero;
/// <summary>
/// Blur Region rect is relative to Cam.rect . This is relative to the full screen
/// </summary>
public Rect BlurRegionNormalizedScreenSpace
{
get
{
var camRect = CamRectOverride.width == 0 ? Cam.rect : CamRectOverride;
camRect.min = Vector2.Max(Vector2.zero, camRect.min);
camRect.max = Vector2.Min(Vector2.one, camRect.max);
return new Rect(camRect.position + BlurRegion.position * camRect.size,
camRect.size * BlurRegion.size);
}
set
{
var camRect = CamRectOverride.width == 0 ? Cam.rect : CamRectOverride;
camRect.min = Vector2.Max(Vector2.zero, camRect.min);
camRect.max = Vector2.Min(Vector2.one, camRect.max);
BlurRegion = new Rect((value.position - camRect.position) / camRect.size,
value.size / camRect.size);
}
}
/// <summary>
/// The Camera attached to the same GameObject. Cached in field 'camera'
/// </summary>
internal Camera Cam
{
get { return camera ? camera : camera = GetComponent<Camera>(); }
}
/// <summary>
/// Minimum time in second to wait before refresh the blurred image.
/// If maxUpdateRate non-positive then just stop updating
/// </summary>
float MinUpdateCycle
{
get { return (MaxUpdateRate > 0) ? (1f / MaxUpdateRate) : float.PositiveInfinity; }
}
#endregion
#if UNITY_EDITOR
protected virtual void OnEnable()
{
if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
{
Start();
}
}
protected virtual void OnGUI()
{
if (!Preview) return;
if (UnityEditor.Selection.activeGameObject != gameObject) return;
var curBlurRegionNSS = BlurRegionNormalizedScreenSpace;
var newBlurRegionNSS = ResizableScreenRect.Draw(curBlurRegionNSS);
if (newBlurRegionNSS != curBlurRegionNSS)
{
UnityEditor.Undo.RecordObject(this, "Change Blur Region");
BlurRegionNormalizedScreenSpace = newBlurRegionNSS;
}
if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
}
#endif
protected virtual void Start()
{
previewMaterial = new Material(Shader.Find("Hidden/FillCrop"));
InitializeBlurAlgorithm();
CreateNewBlurredScreen(Vector2Int.RoundToInt(Cam.pixelRect.size));
lastDownsample = Downsample;
}
void OnDestroy()
{
if (BlurredScreen)
BlurredScreen.Release();
}
void InitializeBlurAlgorithm()
{
switch (blurConfig)
{
case ScalableBlurConfig _:
blurAlgorithm = new ScalableBlur();
break;
default:
blurAlgorithm = new ScalableBlur();
break;
}
}
protected virtual void CreateNewBlurredScreen(Vector2Int camPixelSize)
{
if (BlurredScreen)
BlurredScreen.Release();
#if ENABLE_VR
if (XRSettings.enabled)
{
BlurredScreen = new RenderTexture(XRSettings.eyeTextureDesc);
BlurredScreen.width = Mathf.RoundToInt(BlurredScreen.width * BlurRegion.width) >> Downsample;
BlurredScreen.height = Mathf.RoundToInt(BlurredScreen.height * BlurRegion.height) >> Downsample;
BlurredScreen.depth = 0;
}
else
#endif
{
BlurredScreen = new RenderTexture(Mathf.RoundToInt(camPixelSize.x * BlurRegion.width) >> Downsample,
Mathf.RoundToInt(camPixelSize.y * BlurRegion.height) >> Downsample, 0);
}
BlurredScreen.antiAliasing = 1;
BlurredScreen.useMipMap = false;
BlurredScreen.name = $"{gameObject.name} Translucent Image Source";
BlurredScreen.filterMode = FilterMode.Bilinear;
BlurredScreen.Create();
}
TextureDimension lastEyeTexDim;
public void OnBeforeBlur(Vector2Int camPixelSize)
{
if (
BlurredScreen == null
|| !BlurredScreen.IsCreated()
|| Downsample != lastDownsample
|| !BlurRegion.Approximately(lastBlurRegion)
|| camPixelSize != lastCamPixelSize
#if ENABLE_VR
|| XRSettings.deviceEyeTextureDimension != lastEyeTexDim
#endif
)
{
CreateNewBlurredScreen(camPixelSize);
lastDownsample = Downsample;
lastBlurRegion = BlurRegion;
lastCamPixelSize = camPixelSize;
#if ENABLE_VR
lastEyeTexDim = XRSettings.deviceEyeTextureDimension;
#endif
}
lastUpdate = GetTrueCurrentTime();
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (cmd == null)
{
cmd = new CommandBuffer();
cmd.name = "Translucent Image Source";
}
if (blurAlgorithm != null && BlurConfig != null)
{
if (ShouldUpdateBlur())
{
cmd.Clear();
OnBeforeBlur(Vector2Int.RoundToInt(Cam.pixelRect.size));
blurAlgorithm.Init(BlurConfig, true);
var blurExecData = new BlurExecutor.BlurExecutionData(source,
this,
blurAlgorithm);
BlurExecutor.ExecuteBlurWithTempTextures(cmd, ref blurExecData);
Graphics.ExecuteCommandBuffer(cmd);
}
if (Preview)
{
previewMaterial.SetVector(ShaderId.CROP_REGION, BlurRegion.ToMinMaxVector());
Graphics.Blit(BlurredScreen, destination, previewMaterial);
}
else
{
Graphics.Blit(source, destination);
}
}
else
{
Graphics.Blit(source, destination);
}
isRequested = false;
}
public void Request()
{
isRequested = true;
}
public bool ShouldUpdateBlur()
{
if (!enabled)
return false;
if (!Preview && !isRequested)
return false;
float now = GetTrueCurrentTime();
bool should = now - lastUpdate >= MinUpdateCycle;
return should;
}
private static float GetTrueCurrentTime()
{
#if UNITY_EDITOR
return (float)UnityEditor.EditorApplication.timeSinceStartup;
#else
return Time.unscaledTime;
#endif
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4ee01e66702087b4798e633ca34c7956
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 4bc9a290ca74e434499699e3db41c3f9, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,10 +0,0 @@
#if LETAI_TRUESHADOW
using LeTai.TrueShadow.PluginInterfaces;
namespace LeTai.Asset.TranslucentImage
{
public partial class TranslucentImage : ITrueShadowCustomHashProvider { }
}
#endif

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 11c1c8c5084246f884409330a477c153
timeCreated: 1688045792

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5fa3650b00009764888b5f90e8ec5241
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bba7ceb326d957d49bbc675bdf0856c0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,21 +0,0 @@
{
"name": "LeTai.TranslucentImage.UniversalRP.Editor",
"rootNamespace": "",
"references": [
"GUID:e646286fd75dc0f44bb2f84ffb34408d",
"GUID:15fc0a57446b3144c949da3e2b9737a9"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"LeTai_TranslucentImage"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: eba807230e676224b8e8e5b8859b2e7c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,81 +0,0 @@
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace LeTai.Asset.TranslucentImage.UniversalRP.Editor
{
[InitializeOnLoad]
public class RendererFeatureChecker : EditorWindow
{
static RendererFeatureChecker()
{
EditorApplication.update += DoCheck;
}
static void DoCheck()
{
EditorApplication.update -= DoCheck;
var pipelineAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
if (pipelineAsset == null)
return;
var rendererData = (ScriptableRendererData)
typeof(UniversalRenderPipelineAsset)
.GetProperty("scriptableRendererData", BindingFlags.Instance | BindingFlags.NonPublic)
?.GetValue(pipelineAsset);
if (rendererData == null)
return;
var haveFeature = rendererData.rendererFeatures.OfType<TranslucentImageBlurSource>().Any();
if (haveFeature)
return;
const float width = 400f;
const float height = 200f;
var window = GetWindowWithRect<RendererFeatureChecker>(
new Rect(
(Screen.width - width) / 2f,
(Screen.height - height) / 2f,
width, height
),
true,
"Translucent Image",
true
);
window.rendererData = rendererData;
}
ScriptableRendererData rendererData;
void OnGUI()
{
GUILayout.Label("Missing Renderer Feature", EditorStyles.largeLabel);
EditorGUILayout.Space();
GUILayout.Label(
"Translucent Image needs a renderer feature added to the active Renderer Asset. Do you want to add it now?",
EditorStyles.wordWrappedLabel
);
if (GUILayout.Button("More info", EditorStyles.linkLabel))
Application.OpenURL("https://leloctai.com/asset/translucentimage/docs/articles/universalrp.html");
GUILayout.FlexibleSpace();
if (GUILayout.Button("Select Current Renderer Asset"))
{
EditorGUIUtility.PingObject(rendererData);
Selection.activeObject = rendererData;
Close();
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6d7c06f482aa58a4ea6d2e6f18f373b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,31 +0,0 @@
using System;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
namespace LeTai.Asset.TranslucentImage.UniversalRP.Editor
{
[CustomEditor(typeof(TranslucentImageBlurSource))]
public class TranslucentImageBlurSourceEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
var feature = (TranslucentImageBlurSource)target;
if (feature.rendererType == RendererType.Renderer2D)
{
var ver = Version.Parse(Regex.Replace(Application.unityVersion, @"[^\d.]", "."));
if (
ver >= new Version(2023, 1, 7) ||
(ver.Major == 2022 && ver >= new Version(2022, 3, 7))
)
EditorGUILayout.HelpBox("The 2D Renderer is sometimes buggy with custom renderer features at the moment.\n\n" +
"If you're encountering problems, check if the built-in \"Full Screen Pass Renderer Feature\" is functioning correctly in the same setup. If it does not, Translucent Image is unlikely to be able to work either.\n\n" +
"Also, make sure you're on the latest Unity patch release for your minor version", MessageType.Warning, true);
else
EditorGUILayout.HelpBox("This version of the 2D Renderer includes a bug that prevents Translucent Image from working correctly in many cases. (UUM-14400)", MessageType.Error, true);
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6df7a801a41d7224f9848526015f4dd5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,31 +0,0 @@
{
"name": "LeTai.TranslucentImage.UniversalRP",
"rootNamespace": "",
"references": [
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:ff218ee40fe2b8648ab3234d56415557"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"LeTai_TranslucentImage"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "12",
"define": "URP12_OR_NEWER"
},
{
"name": "Unity",
"expression": "[2021.3,2021.3.13)",
"define": "UNITY_BUGGED_HAS_PASSES_AFTER_POSTPROCESS"
}
],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: e646286fd75dc0f44bb2f84ffb34408d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 59db9d0cfd142494ab067fbfbb1f1b6a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,220 +0,0 @@
#if UNITY_2022_3_OR_NEWER
#define HAS_DOUBLEBUFFER_BOTH
#endif
#if UNITY_2023_3_OR_NEWER
#define HAS_RENDERGRAPH
#endif
#if URP12_OR_NEWER
#define HAS_DOUBLEBUFFER_UNIVERSAL_RENDERER
#define HAS_RENDERORDER
#else
#define STATIC_AFTERPOSTTEX
#endif
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Scripting.APIUpdating;
namespace LeTai.Asset.TranslucentImage.UniversalRP
{
enum RendererType
{
Universal,
Renderer2D
}
[MovedFrom("LeTai.Asset.TranslucentImage.LWRP")]
public partial class TranslucentImageBlurRenderPass : ScriptableRenderPass
{
internal struct PassData
{
public TranslucentImageSource blurSource;
public IBlurAlgorithm blurAlgorithm;
public Vector2Int camPixelSize;
public bool shouldUpdateBlur;
public bool isPreviewing;
}
internal struct SRPassData
{
#if !HAS_DOUBLEBUFFER_BOTH
public RendererType rendererType;
public RenderTargetIdentifier cameraColorTarget;
#if HAS_RENDERORDER
public TranslucentImageBlurSource.RenderOrder renderOrder;
#endif
#endif
public bool canvasDisappearWorkaround;
}
public readonly struct PreviewExecutionData
{
public readonly TranslucentImageSource blurSource;
public readonly RenderTargetIdentifier previewTarget;
public readonly Material previewMaterial;
public PreviewExecutionData(
TranslucentImageSource blurSource,
RenderTargetIdentifier previewTarget,
Material previewMaterial
)
{
this.blurSource = blurSource;
this.previewTarget = previewTarget;
this.previewMaterial = previewMaterial;
}
}
private const string PROFILER_TAG = "Translucent Image Source";
#if STATIC_AFTERPOSTTEX
readonly RenderTargetIdentifier afterPostprocessTexture;
#endif
#if HAS_DOUBLEBUFFER_UNIVERSAL_RENDERER
readonly URPRendererInternal urpRendererInternal;
#endif
PassData currentPassData;
SRPassData currentSRPassData;
Material previewMaterial;
public Material PreviewMaterial
{
get
{
if (!previewMaterial)
previewMaterial = CoreUtils.CreateEngineMaterial("Hidden/FillCrop_UniversalRP");
return previewMaterial;
}
}
internal TranslucentImageBlurRenderPass(
#if HAS_DOUBLEBUFFER_UNIVERSAL_RENDERER
URPRendererInternal urpRendererInternal
#endif
)
{
#if STATIC_AFTERPOSTTEX
afterPostprocessTexture = new RenderTargetIdentifier(Shader.PropertyToID("_AfterPostProcessTexture"), 0, CubemapFace.Unknown, -1);
#endif
#if HAS_DOUBLEBUFFER_UNIVERSAL_RENDERER
this.urpRendererInternal = urpRendererInternal;
#endif
RenderGraphInit();
}
#if !HAS_DOUBLEBUFFER_BOTH
RenderTargetIdentifier GetAfterPostColor()
{
#if STATIC_AFTERPOSTTEX
return afterPostprocessTexture;
#else
return urpRendererInternal.GetAfterPostColor();
#endif
}
#endif
~TranslucentImageBlurRenderPass()
{
CoreUtils.Destroy(previewMaterial);
RenderGraphDispose();
}
internal void SetupSRP(SRPassData srPassData)
{
currentSRPassData = srPassData;
}
internal void Setup(PassData passData)
{
currentPassData = passData;
}
#if HAS_RENDERGRAPH
[Obsolete("This rendering path is for compatibility mode only (when Render Graph is disabled). Use Render Graph API instead.", false)]
#endif
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
var cmd = CommandBufferPool.Get(PROFILER_TAG);
RenderTargetIdentifier sourceTex;
#if !HAS_DOUBLEBUFFER_BOTH
var isPostProcessEnabled = renderingData.cameraData.postProcessEnabled;
void SetSource2DRenderer()
{
bool useAfterPostTex = isPostProcessEnabled;
#if HAS_RENDERORDER
useAfterPostTex &= currentSRPassData.renderOrder == TranslucentImageBlurSource.RenderOrder.AfterPostProcessing;
#endif
sourceTex = useAfterPostTex
? GetAfterPostColor()
: currentSRPassData.cameraColorTarget;
}
#endif
#if HAS_DOUBLEBUFFER_BOTH
sourceTex = urpRendererInternal.GetBackBuffer();
#elif HAS_DOUBLEBUFFER_UNIVERSAL_RENDERER
if (currentSRPassData.rendererType == RendererType.Universal)
{
sourceTex = urpRendererInternal.GetBackBuffer();
}
else
{
SetSource2DRenderer();
}
#else
SetSource2DRenderer();
#endif
var blurSource = currentPassData.blurSource;
bool shouldResetTarget = currentSRPassData.canvasDisappearWorkaround && renderingData.cameraData.resolveFinalTarget;
if (currentPassData.shouldUpdateBlur)
{
blurSource.OnBeforeBlur(currentPassData.camPixelSize);
var blurExecData = new BlurExecutor.BlurExecutionData(sourceTex,
blurSource,
currentPassData.blurAlgorithm);
BlurExecutor.ExecuteBlurWithTempTextures(cmd, ref blurExecData);
if (shouldResetTarget)
CoreUtils.SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget);
}
if (currentPassData.isPreviewing)
{
var previewTarget = shouldResetTarget ? BuiltinRenderTextureType.CameraTarget : sourceTex;
var previewExecData = new PreviewExecutionData(blurSource,
previewTarget,
PreviewMaterial);
ExecutePreview(cmd, ref previewExecData);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
public static void ExecutePreview(CommandBuffer cmd, ref PreviewExecutionData data)
{
var blurSource = data.blurSource;
data.previewMaterial.SetVector(ShaderId.CROP_REGION, blurSource.BlurRegion.ToMinMaxVector());
cmd.BlitCustom(blurSource.BlurredScreen, data.previewTarget, data.previewMaterial, 0);
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 05ed55b26a77f1b4aa7fc2236c80b9e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 4bc9a290ca74e434499699e3db41c3f9, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,148 +0,0 @@
#if UNITY_2023_3_OR_NEWER
#define HAS_RENDERGRAPH
#endif
#if HAS_RENDERGRAPH
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.Universal;
#endif
namespace LeTai.Asset.TranslucentImage.UniversalRP
{
public partial class TranslucentImageBlurRenderPass
{
#if HAS_RENDERGRAPH
class BlurRGPassData
{
public TextureHandle sourceTex;
public TextureHandle[] scratches;
public TranslucentImageSource blurSource;
public IBlurAlgorithm blurAlgorithm;
}
class PreviewRGPassData
{
public TranslucentImageSource blurSource;
public TextureHandle previewTarget;
public Material previewMaterial;
}
string[] scratchNames;
readonly Dictionary<RenderTexture, RTHandle> blurredScreenHdlDict = new();
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
var blurSource = currentPassData.blurSource;
if (currentPassData.shouldUpdateBlur)
{
blurSource.OnBeforeBlur(currentPassData.camPixelSize);
var blurredScreen = blurSource.BlurredScreen;
blurredScreenHdlDict.TryGetValue(blurredScreen, out var blurredScreenHdl);
if (blurredScreenHdl == null || blurredScreenHdl.rt != blurredScreen)
{
blurredScreenHdl?.Release();
blurredScreenHdl = RTHandles.Alloc(blurredScreen);
blurredScreenHdlDict[blurredScreen] = blurredScreenHdl;
}
// ReSharper disable once ConvertToUsingDeclaration
using (var builder = renderGraph.AddUnsafePass<BlurRGPassData>(PROFILER_TAG, out var data))
{
var blurAlgorithm = currentPassData.blurAlgorithm;
var scratchesCount = blurAlgorithm.GetScratchesCount();
var resourceData = frameData.Get<UniversalResourceData>();
data.sourceTex = resourceData.activeColorTexture;
data.scratches = new TextureHandle[scratchesCount];
data.blurSource = blurSource;
data.blurAlgorithm = blurAlgorithm;
builder.UseTexture(data.sourceTex, AccessFlags.Read);
var desc = blurSource.BlurredScreen.descriptor;
for (int i = 0; i < scratchesCount; i++)
{
blurAlgorithm.GetScratchDescriptor(i, ref desc);
data.scratches[i] = UniversalRenderer.CreateRenderGraphTexture(renderGraph,
desc,
scratchNames[i],
false,
FilterMode.Bilinear,
TextureWrapMode.Clamp);
builder.UseTexture(data.scratches[i], AccessFlags.ReadWrite);
}
var blurredScreenTHdl = renderGraph.ImportTexture(blurredScreenHdl);
builder.UseTexture(blurredScreenTHdl, AccessFlags.Write);
builder.SetRenderFunc(static (BlurRGPassData data, UnsafeGraphContext context) =>
{
var scratchesCount = data.blurAlgorithm.GetScratchesCount();
for (int i = 0; i < scratchesCount; i++)
data.blurAlgorithm.SetScratch(i, data.scratches[i]);
var blurExecData = new BlurExecutor.BlurExecutionData(
data.sourceTex,
data.blurSource,
data.blurAlgorithm
);
BlurExecutor.ExecuteBlur(CommandBufferHelpers.GetNativeCommandBuffer(context.cmd), ref blurExecData);
});
}
}
if (currentPassData.isPreviewing)
{
// ReSharper disable once ConvertToUsingDeclaration
using (var builder = renderGraph.AddUnsafePass<PreviewRGPassData>(PROFILER_TAG, out var data))
{
var resourceData = frameData.Get<UniversalResourceData>();
data.blurSource = blurSource;
data.previewMaterial = PreviewMaterial;
data.previewTarget = resourceData.activeColorTexture;
builder.UseTexture(data.previewTarget, AccessFlags.Write);
builder.SetRenderFunc(static (PreviewRGPassData data, UnsafeGraphContext context) =>
{
var previewExecData = new PreviewExecutionData(
data.blurSource,
data.previewTarget,
data.previewMaterial
);
ExecutePreview(CommandBufferHelpers.GetNativeCommandBuffer(context.cmd), ref previewExecData);
});
}
}
}
void RenderGraphInit()
{
scratchNames = new string[14];
for (var i = 0; i < scratchNames.Length; i++)
{
scratchNames[i] = $"TI_intermediate_rt_{i}";
}
}
void RenderGraphDispose()
{
foreach (var (_, hdl) in blurredScreenHdlDict)
{
hdl?.Release();
}
}
#else
void RenderGraphInit() { }
void RenderGraphDispose() { }
#endif
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9c44d0c2822b4034b31007221f773f14
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More