Compare commits

...

2 Commits

Author SHA1 Message Date
Nico
774688d692 Remove collision between player and enemies
Add knockback to enemies
2025-07-13 01:37:03 -07:00
Nico
6c74f32fc5 Create damage flash material and apply to player and enemy 2025-07-12 21:05:06 -07:00
180 changed files with 69924 additions and 1029 deletions

View File

@ -0,0 +1,795 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-9025164687659047112
MonoBehaviour:
m_ObjectHideFlags: 3
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: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 10
aperture:
m_OverrideState: 1
m_Value: 5.6
focalLength:
m_OverrideState: 1
m_Value: 50
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-7615929460463125418
MonoBehaviour:
m_ObjectHideFlags: 3
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: cdfbdbb87d3286943a057f7791b43141, type: 3}
m_Name: ChannelMixer
m_EditorClassIdentifier:
active: 1
redOutRedIn:
m_OverrideState: 1
m_Value: 100
redOutGreenIn:
m_OverrideState: 1
m_Value: 0
redOutBlueIn:
m_OverrideState: 1
m_Value: 0
greenOutRedIn:
m_OverrideState: 1
m_Value: 0
greenOutGreenIn:
m_OverrideState: 1
m_Value: 100
greenOutBlueIn:
m_OverrideState: 1
m_Value: 0
blueOutRedIn:
m_OverrideState: 1
m_Value: 0
blueOutGreenIn:
m_OverrideState: 1
m_Value: 0
blueOutBlueIn:
m_OverrideState: 1
m_Value: 100
--- !u!114 &-7142115490350746892
MonoBehaviour:
m_ObjectHideFlags: 3
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: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0
smoothness:
m_OverrideState: 1
m_Value: 0.2
rounded:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-5096611081857608513
MonoBehaviour:
m_ObjectHideFlags: 3
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: 3eb4b772797da9440885e8bd939e9560, type: 3}
m_Name: ColorCurves
m_EditorClassIdentifier:
active: 1
master:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
red:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
green:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
blue:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
hueVsHue:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 1
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
hueVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 1
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
satVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 0
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
lumVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 0
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &-4642136177615022457
MonoBehaviour:
m_ObjectHideFlags: 3
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: 70afe9e12c7a7ed47911bb608a23a8ff, type: 3}
m_Name: SplitToning
m_EditorClassIdentifier:
active: 1
shadows:
m_OverrideState: 1
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
highlights:
m_OverrideState: 1
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
balance:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-3950282100955119174
MonoBehaviour:
m_ObjectHideFlags: 3
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: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 1
m_Value: 2
acesPreset:
m_OverrideState: 1
m_Value: 3
hueShiftAmount:
m_OverrideState: 1
m_Value: 0
detectPaperWhite:
m_OverrideState: 1
m_Value: 0
paperWhite:
m_OverrideState: 1
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 1
m_Value: 1
minNits:
m_OverrideState: 1
m_Value: 0.005
maxNits:
m_OverrideState: 1
m_Value: 1000
--- !u!114 &-3618168053836463484
MonoBehaviour:
m_ObjectHideFlags: 3
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: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-1529881227596190608
MonoBehaviour:
m_ObjectHideFlags: 3
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: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0
contrast:
m_OverrideState: 1
m_Value: 0
colorFilter:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 1
m_Value: 0
saturation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-1141209695891651168
MonoBehaviour:
m_ObjectHideFlags: 3
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: 06437c1ff663d574d9447842ba0a72e4, type: 3}
m_Name: ScreenSpaceLensFlare
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
tintColor:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
bloomMip:
m_OverrideState: 1
m_Value: 1
firstFlareIntensity:
m_OverrideState: 1
m_Value: 1
secondaryFlareIntensity:
m_OverrideState: 1
m_Value: 1
warpedFlareIntensity:
m_OverrideState: 1
m_Value: 1
warpedFlareScale:
m_OverrideState: 1
m_Value: {x: 1, y: 1}
samples:
m_OverrideState: 1
m_Value: 1
sampleDimmer:
m_OverrideState: 1
m_Value: 0.5
vignetteEffect:
m_OverrideState: 1
m_Value: 1
startingPosition:
m_OverrideState: 1
m_Value: 1.25
scale:
m_OverrideState: 1
m_Value: 1.5
streaksIntensity:
m_OverrideState: 1
m_Value: 0
streaksLength:
m_OverrideState: 1
m_Value: 0.5
streaksOrientation:
m_OverrideState: 1
m_Value: 0
streaksThreshold:
m_OverrideState: 1
m_Value: 0.25
resolution:
m_OverrideState: 1
m_Value: 4
chromaticAbberationIntensity:
m_OverrideState: 1
m_Value: 0.5
--- !u!114 &-949798589189136431
MonoBehaviour:
m_ObjectHideFlags: 3
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: 558a8e2b6826cf840aae193990ba9f2e, type: 3}
m_Name: ShadowsMidtonesHighlights
m_EditorClassIdentifier:
active: 1
shadows:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
midtones:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
highlights:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
shadowsStart:
m_OverrideState: 1
m_Value: 0
shadowsEnd:
m_OverrideState: 1
m_Value: 0.3
highlightsStart:
m_OverrideState: 1
m_Value: 0.55
highlightsEnd:
m_OverrideState: 1
m_Value: 1
--- !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: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: DefaultVolumeProfile
m_EditorClassIdentifier:
components:
- {fileID: -3618168053836463484}
- {fileID: 4212648540871675152}
- {fileID: 6892635470908810990}
- {fileID: 7822953279580236600}
- {fileID: -3950282100955119174}
- {fileID: -949798589189136431}
- {fileID: -9025164687659047112}
- {fileID: -1529881227596190608}
- {fileID: -7142115490350746892}
- {fileID: -7615929460463125418}
- {fileID: 7977049305245818699}
- {fileID: 1365761464227568764}
- {fileID: -5096611081857608513}
- {fileID: 2182863260236259965}
- {fileID: 2670301738872112325}
- {fileID: 8677343765646317582}
- {fileID: -1141209695891651168}
- {fileID: -4642136177615022457}
- {fileID: 1530664459926503956}
--- !u!114 &1365761464227568764
MonoBehaviour:
m_ObjectHideFlags: 3
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: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.9
intensity:
m_OverrideState: 1
m_Value: 0
scatter:
m_OverrideState: 1
m_Value: 0.7
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 0
downscale:
m_OverrideState: 1
m_Value: 0
maxIterations:
m_OverrideState: 1
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &1530664459926503956
MonoBehaviour:
m_ObjectHideFlags: 3
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: 6bd486065ce11414fa40e631affc4900, type: 3}
m_Name: ProbeVolumesOptions
m_EditorClassIdentifier:
active: 1
normalBias:
m_OverrideState: 1
m_Value: 0.05
viewBias:
m_OverrideState: 1
m_Value: 0.1
scaleBiasWithMinProbeDistance:
m_OverrideState: 1
m_Value: 0
samplingNoise:
m_OverrideState: 1
m_Value: 0.1
animateSamplingNoise:
m_OverrideState: 1
m_Value: 1
leakReductionMode:
m_OverrideState: 1
m_Value: 2
minValidDotProductValue:
m_OverrideState: 1
m_Value: 0.1
occlusionOnlyReflectionNormalization:
m_OverrideState: 1
m_Value: 1
intensityMultiplier:
m_OverrideState: 1
m_Value: 1
skyOcclusionIntensityMultiplier:
m_OverrideState: 1
m_Value: 1
worldOffset:
m_OverrideState: 1
m_Value: {x: 0, y: 0, z: 0}
--- !u!114 &2182863260236259965
MonoBehaviour:
m_ObjectHideFlags: 3
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: fb60a22f311433c4c962b888d1393f88, type: 3}
m_Name: PaniniProjection
m_EditorClassIdentifier:
active: 1
distance:
m_OverrideState: 1
m_Value: 0
cropToFit:
m_OverrideState: 1
m_Value: 1
--- !u!114 &2670301738872112325
MonoBehaviour:
m_ObjectHideFlags: 3
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: 29fa0085f50d5e54f8144f766051a691, type: 3}
m_Name: FilmGrain
m_EditorClassIdentifier:
active: 1
type:
m_OverrideState: 1
m_Value: 0
intensity:
m_OverrideState: 1
m_Value: 0
response:
m_OverrideState: 1
m_Value: 0.8
texture:
m_OverrideState: 1
m_Value: {fileID: 0}
--- !u!114 &4212648540871675152
MonoBehaviour:
m_ObjectHideFlags: 3
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: e021b4c809a781e468c2988c016ebbea, type: 3}
m_Name: ColorLookup
m_EditorClassIdentifier:
active: 1
texture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
contribution:
m_OverrideState: 1
m_Value: 0
--- !u!114 &6892635470908810990
MonoBehaviour:
m_ObjectHideFlags: 3
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: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 0
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &7822953279580236600
MonoBehaviour:
m_ObjectHideFlags: 3
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: ccf1aba9553839d41ae37dd52e9ebcce, type: 3}
m_Name: MotionBlur
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
quality:
m_OverrideState: 1
m_Value: 0
intensity:
m_OverrideState: 1
m_Value: 0
clamp:
m_OverrideState: 1
m_Value: 0.05
--- !u!114 &7977049305245818699
MonoBehaviour:
m_ObjectHideFlags: 3
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: 5485954d14dfb9a4c8ead8edb0ded5b1, type: 3}
m_Name: LiftGammaGain
m_EditorClassIdentifier:
active: 1
lift:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
gamma:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
gain:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
--- !u!114 &8677343765646317582
MonoBehaviour:
m_ObjectHideFlags: 3
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: c5e1dc532bcb41949b58bc4f2abfbb7e, type: 3}
m_Name: LensDistortion
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
xMultiplier:
m_OverrideState: 1
m_Value: 1
yMultiplier:
m_OverrideState: 1
m_Value: 1
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
scale:
m_OverrideState: 1
m_Value: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 302614546fa979d47ae20c65a3cced53
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -48,7 +48,7 @@ CapsuleCollider2D:
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Bits: 512
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
@ -182,8 +182,8 @@ Transform:
m_GameObject: {fileID: 5621972084801698921}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.1984, z: 0}
m_LocalScale: {x: 0.62654996, y: 0.55155003, z: 1}
m_LocalPosition: {x: 0, y: 0.114, z: 0}
m_LocalScale: {x: 3, y: 3, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 243343966221896818}
@ -211,7 +211,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 475fbc277d3530045b66013cd2dc50b2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -232,8 +232,8 @@ SpriteRenderer:
m_SortingLayerID: 651355007
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: -9095717837082945937, guid: 207ee8102dd4143d288186ef0be518ee, type: 3}
m_Color: {r: 1, g: 0.084905505, b: 0.084905505, a: 1}
m_Sprite: {fileID: 21300000, guid: 748ae8b33df036b46a86e0387f1602cf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
@ -296,7 +296,7 @@ CapsuleCollider2D:
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Bits: 512
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
@ -339,7 +339,7 @@ Rigidbody2D:
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 8
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 1

View File

@ -9,7 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1897313902523258814}
m_Layer: 0
m_Layer: 9
m_Name: Visuals
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -46,7 +46,7 @@ GameObject:
- component: {fileID: 1787569555844345674}
- component: {fileID: 3647552498760287226}
- component: {fileID: 7014899162285736705}
m_Layer: 0
m_Layer: 9
m_Name: Character
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -91,7 +91,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 475fbc277d3530045b66013cd2dc50b2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -112,12 +112,12 @@ SpriteRenderer:
m_SortingLayerID: 651355007
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: 1468673379, guid: cca4ee180637d1442bc16ac530501cee, type: 3}
m_Sprite: {fileID: 9128384846270689552, guid: 6068df6a0f8c12a4496df681a7b310c6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 2}
m_Size: {x: 0.96, y: 0.8}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
@ -133,7 +133,7 @@ Animator:
m_GameObject: {fileID: 3555620562472737319}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 47d96364271d1944c8b2c9ed00c09341, type: 2}
m_Controller: {fileID: 9100000, guid: ba58731883bc8cb40be2ed19cc4be25a, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
@ -154,7 +154,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 3783325528514321640}
m_Layer: 0
m_Layer: 9
m_Name: Attacks
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -192,7 +192,7 @@ GameObject:
- component: {fileID: 7139240040885940656}
- component: {fileID: 8783676367030864381}
- component: {fileID: 1825172400684165510}
m_Layer: 0
m_Layer: 9
m_Name: MeleeAttacks
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -379,7 +379,7 @@ CapsuleCollider2D:
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
@ -394,7 +394,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5233403024226430001}
m_BodyType: 2
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
@ -405,10 +405,10 @@ Rigidbody2D:
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 128
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
@ -423,7 +423,8 @@ GameObject:
m_Component:
- component: {fileID: 7702329272476180476}
- component: {fileID: 746752959509100355}
m_Layer: 0
- component: {fileID: 6597882534697498354}
m_Layer: 9
m_Name: Trail
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -439,8 +440,8 @@ Transform:
m_GameObject: {fileID: 6399305692263416751}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.56999993, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: 0.028, y: -1.064, z: 0}
m_LocalScale: {x: 1, y: 0.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1897313902523258814}
@ -561,6 +562,61 @@ TrailRenderer:
m_Autodestruct: 0
m_Emitting: 1
m_ApplyActiveColorSpace: 1
--- !u!212 &6597882534697498354
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6399305692263416751}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 651355007
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: -2413806693520163455, guid: ebe73ca9363db456bacf42c025bb4847, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 0.83137256}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &9074809610135348735
GameObject:
m_ObjectHideFlags: 0
@ -572,13 +628,13 @@ GameObject:
- component: {fileID: 9053513097682960937}
- component: {fileID: 2353993781959106024}
- component: {fileID: 3461693610759608285}
m_Layer: 0
m_Layer: 9
m_Name: Aura
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &9053513097682960937
Transform:
m_ObjectHideFlags: 0
@ -588,7 +644,7 @@ Transform:
m_GameObject: {fileID: 9074809610135348735}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: -0.195, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -5405,13 +5461,13 @@ GameObject:
- component: {fileID: 4613858514893913661}
- component: {fileID: 1597424103648595187}
- component: {fileID: 4673608109423225760}
m_Layer: 0
m_Layer: 9
m_Name: Structural
m_TagString: Structural
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &4613858514893913661
Transform:
m_ObjectHideFlags: 0
@ -5421,7 +5477,7 @@ Transform:
m_GameObject: {fileID: 9098681062314285509}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: -0.434, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -5526,7 +5582,7 @@ BoxCollider2D:
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.5041871, y: 0.25876725}
m_Size: {x: 0.8092319, y: 0.33894694}
m_EdgeRadius: 0
--- !u!1 &9147163641451663911
GameObject:
@ -5541,7 +5597,7 @@ GameObject:
- component: {fileID: 1680573792925415762}
- component: {fileID: 1203434784585445923}
- component: {fileID: 9117212351613092415}
m_Layer: 0
m_Layer: 9
m_Name: Player
m_TagString: Player
m_Icon: {fileID: 0}
@ -5591,7 +5647,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Builder: {fileID: 7211159566486303287}
RigidBody: {fileID: 1203434784585445923}
Rigidbody: {fileID: 1203434784585445923}
Animator: {fileID: 7014899162285736705}
Renderer: {fileID: 3647552498760287226}
Aura: {fileID: 2353993781959106024}
@ -5600,12 +5656,44 @@ MonoBehaviour:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
FighterClass:
TimeElapsed: 0
MaxHealth: 0
MaxMana: 0
AttackPower: 0
MagicPower: 0
AnimationToPlay:
AvailableSkills: []
ComboResetTime: 0
LastComboTime: 0
ChargingAnAttack: 0
ChargeValue: 0
AllowBladeVortex: 0
ChargeTick: 0
ComboTimeElapsed: 0
Cooldown: 0
TimesUp: 0
CurrentState: 0
AttackAnimator: {fileID: 3038315303589083823}
StaminaMax: 100
Stamina: 0
StaminaRegenPerSecond: 20
StaminaSliderHud: {fileID: 0}
MoveSpeed: 16
DashMultiplier: 80
DriftSpeed: 80
DriftFactorial: 0.85
MoveSpeedDampener: 1
DashSpeedInitial: 200
DashSpeed: 0
DashDecayRate: 30
DashDelay1: 0.05
DashDelay2: 0.05
DashCooldown: 0.1
JumpDelay: 0.3
VfxDash: {fileID: 4566952472781634859, guid: daf6ae43ee06c424ba624a471e90b72c, type: 3}
VfxKineticSurge: {fileID: 4566952472781634859, guid: 0d7c4835b1f550241bb630daef9e33e8, type: 3}
VfxShockwave: {fileID: 8992219285309707884, guid: 1f334a9f024858d44b8a3ff8bd31dc97, type: 3}
PrevDirection: {x: 0, y: 0}
SkillInUse: 0
LastDirection: 1
--- !u!50 &1203434784585445923
Rigidbody2D:
serializedVersion: 5
@ -5628,7 +5716,7 @@ Rigidbody2D:
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Bits: 136
m_Interpolate: 1
m_SleepingMode: 1
m_CollisionDetection: 1
@ -5667,7 +5755,7 @@ BoxCollider2D:
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: -0.00097227097, y: -0.59421855}
m_Offset: {x: -0.00097227097, y: -1.0443913}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
@ -5677,5 +5765,5 @@ BoxCollider2D:
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.5041871, y: 0.25876725}
m_Size: {x: 0.84173715, y: 0.26204228}
m_EdgeRadius: 0

8
Assets/Renderers.meta Normal file
View File

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

View File

@ -0,0 +1,138 @@
%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: bf2edee5c58d82540a51f03df9d42094, type: 3}
m_Name: RendererURP
m_EditorClassIdentifier:
k_AssetVersion: 12
k_AssetPreviousVersion: 12
m_RendererType: 1
m_RendererData: {fileID: 0}
m_RendererDataList:
- {fileID: 11400000, guid: daac7c892efa8ec43b8aa2a0491fa697, type: 2}
m_DefaultRendererIndex: 0
m_RequireDepthTexture: 0
m_RequireOpaqueTexture: 0
m_OpaqueDownsampling: 1
m_SupportsTerrainHoles: 1
m_SupportsHDR: 1
m_HDRColorBufferPrecision: 0
m_MSAA: 1
m_RenderScale: 1
m_UpscalingFilter: 0
m_FsrOverrideSharpness: 0
m_FsrSharpness: 0.92
m_EnableLODCrossFade: 1
m_LODCrossFadeDitheringType: 1
m_ShEvalMode: 0
m_LightProbeSystem: 0
m_ProbeVolumeMemoryBudget: 1024
m_ProbeVolumeBlendingMemoryBudget: 256
m_SupportProbeVolumeGPUStreaming: 0
m_SupportProbeVolumeDiskStreaming: 0
m_SupportProbeVolumeScenarios: 0
m_SupportProbeVolumeScenarioBlending: 0
m_ProbeVolumeSHBands: 1
m_MainLightRenderingMode: 1
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 2048
m_AdditionalLightsRenderingMode: 1
m_AdditionalLightsPerObjectLimit: 4
m_AdditionalLightShadowsSupported: 0
m_AdditionalLightsShadowmapResolution: 2048
m_AdditionalLightsShadowResolutionTierLow: 256
m_AdditionalLightsShadowResolutionTierMedium: 512
m_AdditionalLightsShadowResolutionTierHigh: 1024
m_ReflectionProbeBlending: 0
m_ReflectionProbeBoxProjection: 0
m_ReflectionProbeAtlas: 1
m_ShadowDistance: 50
m_ShadowCascadeCount: 1
m_Cascade2Split: 0.25
m_Cascade3Split: {x: 0.1, y: 0.3}
m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467}
m_CascadeBorder: 0.2
m_ShadowDepthBias: 1
m_ShadowNormalBias: 1
m_AnyShadowsSupported: 1
m_SoftShadowsSupported: 0
m_ConservativeEnclosingSphere: 1
m_NumIterationsEnclosingSphere: 64
m_SoftShadowQuality: 2
m_AdditionalLightsCookieResolution: 2048
m_AdditionalLightsCookieFormat: 3
m_UseSRPBatcher: 1
m_SupportsDynamicBatching: 0
m_MixedLightingSupported: 1
m_SupportsLightCookies: 1
m_SupportsLightLayers: 0
m_DebugLevel: 0
m_StoreActionsOptimization: 0
m_UseAdaptivePerformance: 1
m_ColorGradingMode: 0
m_ColorGradingLutSize: 32
m_AllowPostProcessAlphaOutput: 0
m_UseFastSRGBLinearConversion: 0
m_SupportDataDrivenLensFlare: 1
m_SupportScreenSpaceLensFlare: 1
m_GPUResidentDrawerMode: 0
m_SmallMeshScreenPercentage: 0
m_GPUResidentDrawerEnableOcclusionCullingInCameras: 0
m_ShadowType: 1
m_LocalShadowsSupported: 0
m_LocalShadowsAtlasResolution: 256
m_MaxPixelLights: 0
m_ShadowAtlasResolution: 256
m_VolumeFrameworkUpdateMode: 0
m_VolumeProfile: {fileID: 0}
apvScenesData:
obsoleteSceneBounds:
m_Keys: []
m_Values: []
obsoleteHasProbeVolumes:
m_Keys: []
m_Values:
m_PrefilteringModeMainLightShadows: 1
m_PrefilteringModeAdditionalLight: 4
m_PrefilteringModeAdditionalLightShadows: 1
m_PrefilterXRKeywords: 0
m_PrefilteringModeForwardPlus: 1
m_PrefilteringModeDeferredRendering: 1
m_PrefilteringModeScreenSpaceOcclusion: 1
m_PrefilterDebugKeywords: 0
m_PrefilterWriteRenderingLayers: 0
m_PrefilterHDROutput: 0
m_PrefilterAlphaOutput: 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_PrefilterSoftShadows: 0
m_PrefilterScreenCoord: 0
m_PrefilterNativeRenderPass: 0
m_PrefilterUseLegacyLightmaps: 0
m_PrefilterBicubicLightmapSampling: 0
m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0
m_Textures:
blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3}
bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 08e270bcec171d54d975d649a5e90563
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
%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: de640fe3d0db1804a85f9fc8f5cadab6, type: 3}
m_Name: RendererURP_Renderer
m_EditorClassIdentifier:
debugShaders:
debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3}
hdrDebugViewPS: {fileID: 4800000, guid: 573620ae32aec764abd4d728906d2587, type: 3}
probeVolumeSamplingDebugComputeShader: {fileID: 7200000, guid: 53626a513ea68ce47b59dc1299fe3959, type: 3}
probeVolumeResources:
probeVolumeDebugShader: {fileID: 0}
probeVolumeFragmentationDebugShader: {fileID: 0}
probeVolumeOffsetDebugShader: {fileID: 0}
probeVolumeSamplingDebugShader: {fileID: 0}
probeSamplingDebugMesh: {fileID: 0}
probeSamplingDebugTexture: {fileID: 0}
probeVolumeBlendStatesCS: {fileID: 0}
m_RendererFeatures: []
m_RendererFeatureMap:
m_UseNativeRenderPass: 0
xrSystemData: {fileID: 0}
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
m_AssetVersion: 2
m_OpaqueLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_TransparentLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_DefaultStencilState:
overrideStencilState: 0
stencilReference: 0
stencilCompareFunction: 8
passOperation: 2
failOperation: 0
zFailOperation: 0
m_ShadowTransparentReceive: 1
m_RenderingMode: 0
m_DepthPrimingMode: 0
m_CopyDepthMode: 1
m_DepthAttachmentFormat: 0
m_DepthTextureFormat: 0
m_AccurateGbufferNormals: 0
m_IntermediateTextureMode: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: daac7c892efa8ec43b8aa2a0491fa697
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Samples.meta Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,289 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
// Example of how Blit operatrions can be handled using frameData using multiple ScriptaleRenderPasses.
public class BlitRendererFeature : ScriptableRendererFeature
{
// The class living in frameData. It will take care of managing the texture resources.
public class BlitData : ContextItem, IDisposable
{
// Textures used for the blit operations.
RTHandle m_TextureFront;
RTHandle m_TextureBack;
// Render graph texture handles.
TextureHandle m_TextureHandleFront;
TextureHandle m_TextureHandleBack;
// Scale bias is used to control how the blit operation is done. The x and y parameter controls the scale
// and z and w controls the offset.
static Vector4 scaleBias = new Vector4(1f, 1f, 0f, 0f);
// Bool to manage which texture is the most resent.
bool m_IsFront = true;
// The texture which contains the color buffer from the most resent blit operation.
public TextureHandle texture;
// Function used to initialize BlitDatat. Should be called before starting to use the class for each frame.
public void Init(RenderGraph renderGraph, RenderTextureDescriptor targetDescriptor, string textureName = null)
{
// Checks if the texture name is valid and puts in default value if not.
var texName = String.IsNullOrEmpty(textureName) ? "_BlitTextureData" : textureName;
// Reallocate if the RTHandles are being initialized for the first time or if the targetDescriptor has changed since last frame.
RenderingUtils.ReAllocateHandleIfNeeded(ref m_TextureFront, targetDescriptor, FilterMode.Bilinear, TextureWrapMode.Clamp, name: texName + "Front");
RenderingUtils.ReAllocateHandleIfNeeded(ref m_TextureBack, targetDescriptor, FilterMode.Bilinear, TextureWrapMode.Clamp, name: texName + "Back");
// Create the texture handles inside render graph by importing the RTHandles in render graph.
m_TextureHandleFront = renderGraph.ImportTexture(m_TextureFront);
m_TextureHandleBack = renderGraph.ImportTexture(m_TextureBack);
// Sets the active texture to the front buffer
texture = m_TextureHandleFront;
}
// We will need to reset the texture handle after each frame to avoid leaking invalid texture handles
// since the texture handles only lives for one frame.
public override void Reset()
{
// Resets the color buffers to avoid carrying invalid references to the next frame.
// This could be BlitData texture handles from last frame which will now be invalid.
m_TextureHandleFront = TextureHandle.nullHandle;
m_TextureHandleBack = TextureHandle.nullHandle;
texture = TextureHandle.nullHandle;
// Reset the acrive texture to be the front buffer.
m_IsFront = true;
}
// The data we use to transfer data to the render function.
class PassData
{
// When makeing a blit operation we will need a source, a destination and a material.
// The source and destination is used to know where to copy from and to.
public TextureHandle source;
public TextureHandle destination;
// The material is used to transform the color buffer while copying.
public Material material;
}
// For this function we don't take a material as argument to show that we should remember to reset values
// we don't use to avoid leaking values from last frame.
public void RecordBlitColor(RenderGraph renderGraph, ContextContainer frameData)
{
// Check if BlitData's texture is valid if it isn't initialize BlitData.
if (!texture.IsValid())
{
// Setup the descriptor we use for BlitData. We should use the camera target's descriptor as a start.
var cameraData = frameData.Get<UniversalCameraData>();
var descriptor = cameraData.cameraTargetDescriptor;
// We disable MSAA for the blit operations.
descriptor.msaaSamples = 1;
// We disable the depth buffer, since we are only makeing transformations to the color buffer.
descriptor.depthStencilFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.None;
Init(renderGraph, descriptor);
}
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
using (var builder = renderGraph.AddRasterRenderPass<PassData>("BlitColorPass", out var passData))
{
// Fetch UniversalResourceData from frameData to retrive the camera's active color attachment.
var resourceData = frameData.Get<UniversalResourceData>();
// Remember to reset material since it contains the value from last frame.
// If we don't do this we would get the material last commited to the BlitPassData using RenderGraph
// since we reuse the object allocation.
passData.material = null;
passData.source = resourceData.activeColorTexture;
passData.destination = texture;
// Sets input attachment to the cameras color buffer.
builder.UseTexture(passData.source);
// Sets output attachment 0 to BlitData's active texture.
builder.SetRenderAttachment(passData.destination, 0);
// Sets the render function.
builder.SetRenderFunc((PassData passData, RasterGraphContext rgContext) => ExecutePass(passData, rgContext));
}
}
// Records a render graph render pass which blits the BlitData's active texture back to the camera's color attachment.
public void RecordBlitBackToColor(RenderGraph renderGraph, ContextContainer frameData)
{
// Check if BlitData's texture is valid if it isn't it hasn't been initialized or an error has occured.
if (!texture.IsValid()) return;
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
using (var builder = renderGraph.AddRasterRenderPass<PassData>($"BlitBackToColorPass", out var passData))
{
// Fetch UniversalResourceData from frameData to retrive the camera's active color attachment.
var resourceData = frameData.Get<UniversalResourceData>();
// Remember to reset material. Otherwise you would use the last material used in RecordFullScreenPass.
passData.material = null;
passData.source = texture;
passData.destination = resourceData.activeColorTexture;
// Sets input attachment to BitData's active texture.
builder.UseTexture(passData.source);
// Sets output attachment 0 to the cameras color buffer.
builder.SetRenderAttachment(passData.destination, 0);
// Sets the render function.
builder.SetRenderFunc((PassData passData, RasterGraphContext rgContext) => ExecutePass(passData, rgContext));
}
}
// This function blits the whole screen for a given material.
public void RecordFullScreenPass(RenderGraph renderGraph, string passName, Material material)
{
// Checks if the data is previously initialized and if the material is valid.
if (!texture.IsValid() || material == null)
{
Debug.LogWarning("Invalid input texture handle, will skip fullscreen pass.");
return;
}
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
using (var builder = renderGraph.AddRasterRenderPass<PassData>(passName, out var passData))
{
// Switching the active texture handles to avoid blit. If we want the most recent
// texture we can simply look at the variable texture
m_IsFront = !m_IsFront;
// Setting data to be used when executing the render function.
passData.material = material;
passData.source = texture;
// Swap the active texture.
if (m_IsFront)
passData.destination = m_TextureHandleFront;
else
passData.destination = m_TextureHandleBack;
// Sets input attachment to BlitData's old active texture.
builder.UseTexture(passData.source);
// Sets output attachment 0 to BitData's new active texture.
builder.SetRenderAttachment(passData.destination, 0);
// Update the texture after switching.
texture = passData.destination;
// Sets the render function.
builder.SetRenderFunc((PassData passData, RasterGraphContext rgContext) => ExecutePass(passData, rgContext));
}
}
// ExecutePass is the render function for each of the blit render graph recordings.
// This is good practice to avoid using variables outside of the lambda it is called from.
// It is static to avoid using member variables which could cause unintended behaviour.
static void ExecutePass(PassData data, RasterGraphContext rgContext)
{
// We can use blit with or without a material both using the static scaleBias to avoid reallocations.
if (data.material == null)
Blitter.BlitTexture(rgContext.cmd, data.source, scaleBias, 0, false);
else
Blitter.BlitTexture(rgContext.cmd, data.source, scaleBias, data.material, 0);
}
// We need to release the textures once the renderer is released which will dispose every item inside
// frameData (also data types previously created in earlier frames).
public void Dispose()
{
m_TextureFront?.Release();
m_TextureBack?.Release();
}
}
// Initial render pass for the renderer feature which is run to initialize the data in frameData and copying
// the camera's color attachment to a texture inside BlitData so we can do transformations using blit.
class BlitStartRenderPass : ScriptableRenderPass
{
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Creating the data BlitData inside frameData.
var blitTextureData = frameData.Create<BlitData>();
// Copies the camera's color attachment to a texture inside BlitData.
blitTextureData.RecordBlitColor(renderGraph, frameData);
}
}
// Render pass which makes a blit for each material given to the renderer feature.
class BlitRenderPass : ScriptableRenderPass
{
List<Material> m_Materials;
// Setup function used to retrive the materials from the renderer feature.
public void Setup(List<Material> materials)
{
m_Materials = materials;
}
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Retrives the BlitData from the current frame.
var blitTextureData = frameData.Get<BlitData>();
foreach(var material in m_Materials)
{
// Skip current cycle if the material is null since there is no need to blit if no
// transformation happens.
if (material == null) continue;
// Records the material blit pass.
blitTextureData.RecordFullScreenPass(renderGraph, $"Blit {material.name} Pass", material);
}
}
}
// Final render pass to copying the texture back to the camera's color attachment.
class BlitEndRenderPass : ScriptableRenderPass
{
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Retrives the BlitData from the current frame and blit it back again to the camera's color attachment.
var blitTextureData = frameData.Get<BlitData>();
blitTextureData.RecordBlitBackToColor(renderGraph, frameData);
}
}
[SerializeField]
[Tooltip("Materials used for blitting. They will be blit in the same order they have in the list starting from index 0. ")]
List<Material> m_Materials;
BlitStartRenderPass m_StartPass;
BlitRenderPass m_BlitPass;
BlitEndRenderPass m_EndPass;
// Here you can create passes and do the initialization of them. This is called everytime serialization happens.
public override void Create()
{
m_StartPass = new BlitStartRenderPass();
m_BlitPass = new BlitRenderPass();
m_EndPass = new BlitEndRenderPass();
// Configures where the render pass should be injected.
m_StartPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
m_BlitPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
m_EndPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Early return if there is no texture to blit.
if (m_Materials == null || m_Materials.Count == 0) return;
// Pass the material to the blit render pass.
m_BlitPass.Setup(m_Materials);
// Since they have the same RenderPassEvent the order matters when enqueueing them.
renderer.EnqueuePass(m_StartPass);
renderer.EnqueuePass(m_BlitPass);
renderer.EnqueuePass(m_EndPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 653ba0c605ec5d741aba7b906b0160d0

View File

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

View File

@ -0,0 +1,75 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.RenderGraphModule.Util;
using UnityEngine.Rendering.Universal;
// This example copies the active color texture to a new texture. This example is for API demonstrative purposes,
// so the new texture is not used anywhere else in the frame, you can use the frame debugger to verify its contents.
public class CopyRenderFeature : ScriptableRendererFeature
{
class CopyRenderPass : ScriptableRenderPass
{
public CopyRenderPass()
{
//The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture.
//By setting this property, URP will automatically create an intermediate texture.
//It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature.
requiresIntermediateTexture = true;
}
// This is where the renderGraph handle can be accessed.
// Each ScriptableRenderPass can use the RenderGraph handle to add multiple render passes to the render graph
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
const string passName = "Copy To or From Temp Texture";
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures
// The active color and depth textures are the main color and depth buffers that the camera renders into
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
// The destination texture is created here,
// the texture is created with the same dimensions as the active color texture
var source = resourceData.activeColorTexture;
var destinationDesc = renderGraph.GetTextureDesc(source);
destinationDesc.name = $"CameraColor-{passName}";
destinationDesc.clearBuffer = false;
TextureHandle destination = renderGraph.CreateTexture(destinationDesc);
if (RenderGraphUtils.CanAddCopyPassMSAA())
{
// This simple pass copies the active color texture to a new texture.
renderGraph.AddCopyPass(resourceData.activeColorTexture, destination, passName: passName);
//Need to copy back otherwise the pass gets culled since the result of the previous copy is not read. This is just for demonstration purposes.
renderGraph.AddCopyPass(destination, resourceData.activeColorTexture, passName: passName);
}
else
{
Debug.Log("Can't add the copy pass due to MSAA");
}
}
}
CopyRenderPass m_CopyRenderPass;
/// <inheritdoc/>
public override void Create()
{
m_CopyRenderPass = new CopyRenderPass();
// Configures where the render pass should be injected.
m_CopyRenderPass.renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_CopyRenderPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a9d1e2329776926468ad438912df45f4

View File

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

View File

@ -0,0 +1,103 @@
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule.Util;
//This example blits the active CameraColor to a new texture. It shows how to do a blit with material, and how to use the ResourceData to avoid another blit back to the active color target.
//This example is for API demonstrative purposes.
// This pass blits the whole screen for a given material to a temp texture, and swaps the UniversalResourceData.cameraColor to this temp texture.
// Therefor, the next pass that references the cameraColor will reference this new temp texture as the cameraColor, saving us a blit.
// Using the ResourceData, you can manage swapping of resources yourself and don't need a bespoke API like the SwapColorBuffer API that was specific for the cameraColor.
// This allows you to write more decoupled passes without the added costs of avoidable copies/blits.
public class BlitAndSwapColorPass : ScriptableRenderPass
{
const string m_PassName = "BlitAndSwapColorPass";
// Material used in the blit operation.
Material m_BlitMaterial;
// Function used to transfer the material from the renderer feature to the render pass.
public void Setup(Material mat)
{
m_BlitMaterial = mat;
//The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture.
//By setting this property, URP will automatically create an intermediate texture. This has a performance cost so don't set this if you don't need it.
//It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature.
requiresIntermediateTexture = true;
}
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures
// The active color and depth textures are the main color and depth buffers that the camera renders into
var resourceData = frameData.Get<UniversalResourceData>();
//This should never happen since we set m_Pass.requiresIntermediateTexture = true;
//Unless you set the render event to AfterRendering, where we only have the BackBuffer.
if (resourceData.isActiveTargetBackBuffer)
{
Debug.LogError($"Skipping render pass. BlitAndSwapColorRendererFeature requires an intermediate ColorTexture, we can't use the BackBuffer as a texture input.");
return;
}
// The destination texture is created here,
// the texture is created with the same dimensions as the active color texture
var source = resourceData.activeColorTexture;
var destinationDesc = renderGraph.GetTextureDesc(source);
destinationDesc.name = $"CameraColor-{m_PassName}";
destinationDesc.clearBuffer = false;
TextureHandle destination = renderGraph.CreateTexture(destinationDesc);
RenderGraphUtils.BlitMaterialParameters para = new(source, destination, m_BlitMaterial, 0);
renderGraph.AddBlitPass(para, passName: m_PassName);
//FrameData allows to get and set internal pipeline buffers. Here we update the CameraColorBuffer to the texture that we just wrote to in this pass.
//Because RenderGraph manages the pipeline resources and dependencies, following up passes will correctly use the right color buffer.
//This optimization has some caveats. You have to be careful when the color buffer is persistent across frames and between different cameras, such as in camera stacking.
//In those cases you need to make sure your texture is an RTHandle and that you properly manage the lifecycle of it.
resourceData.cameraColor = destination;
}
}
public class BlitAndSwapColorRendererFeature : ScriptableRendererFeature
{
[Tooltip("The material used when making the blit operation.")]
public Material material;
[Tooltip("The event where to inject the pass.")]
public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
BlitAndSwapColorPass m_Pass;
// Here you can create passes and do the initialization of them. This is called everytime serialization happens.
public override void Create()
{
m_Pass = new BlitAndSwapColorPass();
// Configures where the render pass should be injected.
m_Pass.renderPassEvent = renderPassEvent;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Early exit if there are no materials.
if (material == null)
{
Debug.LogWarning(this.name + " material is null and will be skipped.");
return;
}
m_Pass.Setup(material);
renderer.EnqueuePass(m_Pass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 77eb6cb355f03b344a41286db9580ec6

View File

@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4672045526760888526
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BlitWithMaterial
m_Shader: {fileID: 4800000, guid: 385f641abc6b039499b848e66d7ca429, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

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

View File

@ -0,0 +1,35 @@
Shader "BlitWithMaterial"
{
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
ZWrite Off Cull Off
Pass
{
Name "BlitWithMaterialPass"
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#pragma vertex Vert
#pragma fragment Frag
// Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
float4 Frag(Varyings input) : SV_Target0
{
// this is needed so we account XR platform differences in how they handle texture arrays
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
// sample the texture using the SAMPLE_TEXTURE2D_X_LOD
float2 uv = input.texcoord.xy;
half4 color = SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearRepeat, uv, _BlitMipLevel);
// Modify the sampled color
return half4(0, 1, 0, 1) * color;
}
ENDHLSL
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,143 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
// This RendererFeature shows how a compute shader can be used together with RenderGraph.
// What this example doesn't show is that it can run together with render passes. If the
// compute shader is using resources which are also used by render passes then a dependency
// between the passes are created as they would have done for two render passes.
public class ComputeRendererFeature : ScriptableRendererFeature
{
// We will treat the compute pass as a normal Scriptable Render Pass.
class ComputePass : ScriptableRenderPass
{
// Compute shader.
ComputeShader cs;
// Compute buffers:
GraphicsBuffer inputBuffer;
GraphicsBuffer outputBuffer;
// Reflection of the data output. I use a preallocated list to avoid memory
// allocations each frame.
int[] outputData = new int[20];
// Constructor is used to initialize the compute buffers.
public ComputePass()
{
BufferDesc desc = new BufferDesc(20, sizeof(int));
inputBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, 20, sizeof(int));
var list = new List<int>();
for (int i = 0; i < 20; i++)
{
list.Add(i);
}
inputBuffer.SetData(list);
outputBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, 20, sizeof(int));
// We don't need to initialize the output normaly with data but I read the
// buffer from the start when each frame is starting to look at last frames result.
outputBuffer.SetData(list);
}
// Setup function to transfer the compute shader from the renderer feature to
// the render pass.
public void Setup(ComputeShader cs)
{
this.cs = cs;
}
// PassData is used to pass data when recording to the execution of the pass.
class PassData
{
// Compute shader.
public ComputeShader cs;
// Buffer handles for the compute buffers.
public BufferHandle input;
public BufferHandle output;
}
// Records a render graph render pass which blits the BlitData's active texture back to the camera's color attachment.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Last frame data should be done. Retrive the data if valid.
outputBuffer.GetData(outputData);
Debug.Log($"Output from compute shader: {string.Join(", ", outputData)}");
// We need to import buffers when they are created outside of the render graph.
BufferHandle inputHandle = renderGraph.ImportBuffer(inputBuffer);
BufferHandle outputHandle = renderGraph.ImportBuffer(outputBuffer);
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
// Notice that we use "AddComputePass" when we are working with compute.
using (var builder = renderGraph.AddComputePass("ComputePass", out PassData passData))
{
// Set the pass data so the data can be transfered from the recording to the execution.
passData.cs = cs;
passData.input = inputHandle;
passData.output = outputHandle;
// UseBuffer is used to setup render graph dependencies together with read and write flags.
builder.UseBuffer(passData.input);
builder.UseBuffer(passData.output, AccessFlags.Write);
// The execution function is also call SetRenderfunc for compute passes.
builder.SetRenderFunc((PassData data, ComputeGraphContext cgContext) => ExecutePass(data, cgContext));
}
}
// ExecutePass is the render function set in the render graph recordings.
// This is good practice to avoid using variables outside of the lambda it is called from.
// It is static to avoid using member variables which could cause unintended behaviour.
static void ExecutePass(PassData data, ComputeGraphContext cgContext)
{
// Attaches the compute buffers.
cgContext.cmd.SetComputeBufferParam(data.cs, data.cs.FindKernel("CSMain"), "inputData", data.input);
cgContext.cmd.SetComputeBufferParam(data.cs, data.cs.FindKernel("CSMain"), "outputData", data.output);
// Dispaches the compute shader with a given kernel as entrypoint.
// The amount of thread groups determine how many groups to execute of the kernel.
cgContext.cmd.DispatchCompute(data.cs, data.cs.FindKernel("CSMain"), 1, 1, 1);
}
}
[SerializeField]
ComputeShader computeShader;
ComputePass m_ComputePass;
/// <inheritdoc/>
public override void Create()
{
// Initialize the compute pass.
m_ComputePass = new ComputePass();
// Sets the renderer feature to execute before rendering.
m_ComputePass.renderPassEvent = RenderPassEvent.BeforeRendering;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Check if the system support compute shaders, if not make an early exit.
if (!SystemInfo.supportsComputeShaders)
{
Debug.LogWarning("Device does not support compute shaders. The pass will be skipped.");
return;
}
// Skip the render pass if the compute shader is null.
if (computeShader == null)
{
Debug.LogWarning("The compute shader is null. The pass will be skipped.");
return;
}
// Call Setup on the render pass and transfer the compute shader.
m_ComputePass.Setup(computeShader);
// Enqueue the compute pass.
renderer.EnqueuePass(m_ComputePass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: febcb3ead18d97042a101999937ced2f

View File

@ -0,0 +1,16 @@
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel CSMain
// Create a StructuredBuffer/ComputeBuffer with read only flag.
StructuredBuffer<int> inputData;
// Create a StructuredBuffer/ComputeBuffer with read & write flag.
RWStructuredBuffer<int> outputData;
// We allocate 20 threads one for each number given to the shader.
// CSMain is the entry point we use we have to define the entry points as kernel.
[numthreads(20,1,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
// We use the thead id as index for the data.
outputData[id.x] = 2 * inputData[id.x];
}

View File

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

View File

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

View File

@ -0,0 +1,131 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.Universal;
public class CullingRenderPassRendererFeature : ScriptableRendererFeature
{
// Layer mask used to filter objects to put in the renderer list.
public LayerMask m_LayerMask;
private CullingRenderPass m_CullingRenderPass;
public override void Create()
{
m_CullingRenderPass = new CullingRenderPass(m_LayerMask);
// Configures where the render pass should be injected.
m_CullingRenderPass.renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_CullingRenderPass);
}
protected override void Dispose(bool disposing)
{
m_CullingRenderPass = null;
}
}
public class CullingRenderPass : ScriptableRenderPass
{
private LayerMask m_LayerMask;
// List of shader tags used to build the renderer list.
private List<ShaderTagId> m_ShaderTagIdList = new List<ShaderTagId>();
public CullingRenderPass(LayerMask layerMask)
{
m_LayerMask = layerMask;
}
class PassData
{
public RendererListHandle rendererListHandle;
}
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
var passName = "RenderList Render Pass from Culling";
// This simple pass clears the current active color texture, then renders the scene geometry associated to the m_LayerMask layer using the culling results.
// Add scene geometry to your own custom layers and experiment switching the layer mask in the render feature UI.
// You can use the frame debugger to inspect the pass output.
using (var builder = renderGraph.AddRasterRenderPass<PassData>(passName, out var passData, profilingSampler))
{
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures.
// The active color and depth textures are the main color and depth buffers that the camera renders into.
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
var cameraData = frameData.Get<UniversalCameraData>();
// CullContextData contains the culling APIs.
var cullContextData = frameData.Get<CullContextData>();
// Retrieve the culling parameters for the camera used.
cameraData.camera.TryGetCullingParameters(false, out var cullingParameters);
// Perform culling using the CullContextData API.
var cullingResults = cullContextData.Cull(ref cullingParameters);
// Fill up the passData with the data needed by the pass
InitRendererLists(cullingResults, frameData, ref passData, renderGraph);
// Make sure the renderer list is valid
if (!passData.rendererListHandle.IsValid())
return;
// We declare the RendererList we just created as an input dependency to this pass, via UseRendererList().
builder.UseRendererList(passData.rendererListHandle);
// Setup as a render target via UseTextureFragment and UseTextureFragmentDepth, which are the equivalent of using the old cmd.SetRenderTarget(color,depth).
builder.SetRenderAttachment(resourceData.activeColorTexture, 0);
builder.SetRenderAttachmentDepth(resourceData.activeDepthTexture, AccessFlags.Write);
// Assign the ExecutePass function to the render pass delegate, which will be called by the render graph when executing the pass.
builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecutePass(data, context));
}
}
// This static method is used to execute the pass and passed as the RenderFunc delegate to the RenderGraph render pass.
static void ExecutePass(PassData data, RasterGraphContext context)
{
context.cmd.ClearRenderTarget(RTClearFlags.Color, Color.green, 1, 0);
context.cmd.DrawRendererList(data.rendererListHandle);
}
// Sample utility method that showcases how to create a renderer list via the RenderGraph API.
private void InitRendererLists(CullingResults cullResults, ContextContainer frameData, ref PassData passData, RenderGraph renderGraph)
{
// Access the relevant frame data from the Universal Render Pipeline
var universalRenderingData = frameData.Get<UniversalRenderingData>();
var cameraData = frameData.Get<UniversalCameraData>();
var lightData = frameData.Get<UniversalLightData>();
var sortFlags = cameraData.defaultOpaqueSortFlags;
var renderQueueRange = RenderQueueRange.opaque;
var filterSettings = new FilteringSettings(renderQueueRange, m_LayerMask);
var forwardOnlyShaderTagIds = new ShaderTagId[]
{
new ShaderTagId("UniversalForwardOnly"),
new ShaderTagId("UniversalForward"),
new ShaderTagId("SRPDefaultUnlit"), // Legacy shaders (do not have a gbuffer pass) are considered forward-only for backward compatibility.
new ShaderTagId("LightweightForward") // Legacy shaders (do not have a gbuffer pass) are considered forward-only for backward compatibility.
};
m_ShaderTagIdList.Clear();
foreach (ShaderTagId sid in forwardOnlyShaderTagIds)
m_ShaderTagIdList.Add(sid);
var drawSettings = RenderingUtils.CreateDrawingSettings(m_ShaderTagIdList, universalRenderingData, cameraData, lightData, sortFlags);
var param = new RendererListParams(cullResults, drawSettings, filterSettings);
passData.rendererListHandle = renderGraph.CreateRendererList(param);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 597b083b06f58a6428f36d566ae33e2b

View File

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

View File

@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4672045526760888526
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FrameBufferFetch
m_Shader: {fileID: 4800000, guid: 7d8f4c6028fc4cf409b7fb064464fc8f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e532af0922c9cb4f829b9b7bf9e7ccc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
Shader "FrameBufferFetch"
{
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
ZWrite Off Cull Off
Pass
{
Name "FrameBufferFetch"
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#pragma vertex Vert
#pragma fragment Frag
// Declares the framebuffer input as a texture 2d containing half.
FRAMEBUFFER_INPUT_HALF(0);
// Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
float4 Frag(Varyings input) : SV_Target0
{
// this is needed so we account XR platform differences in how they handle texture arrays
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
// read the current pixel from the framebuffer
float2 uv = input.texcoord.xy;
// read previous subpasses directly from the framebuffer.
half4 color = LOAD_FRAMEBUFFER_INPUT(0, input.positionCS.xy);
// Modify the sampled color
return half4(0,0,1,1) * color;
}
ENDHLSL
}
Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"}
ZWrite Off Cull Off
Pass
{
Name "FrameBufferFetchMS"
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma require msaatex
// Declares the framebuffer input as a texture 2d containing half.
FRAMEBUFFER_INPUT_HALF_MS(0);
// Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
float4 Frag(Varyings input, uint sampleID : SV_SampleIndex) : SV_Target0
{
// this is needed so we account XR platform differences in how they handle texture arrays
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
// read the current pixel from the framebuffer
float2 uv = input.texcoord.xy;
// read previous subpasses directly from the framebuffer.
half4 color = LOAD_FRAMEBUFFER_INPUT_MS(0, sampleID, input.positionCS.xy);
// Modify the sampled color
return half4(0,0,1,1) * color;
}
ENDHLSL
}
}
}

View File

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

View File

@ -0,0 +1,140 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.RenderGraphModule.Util;
using UnityEngine.Rendering.Universal;
// This example copies the target of the previous pass to a new texture using a custom material and framebuffer fetch. This example is for API demonstrative purposes,
// so the new texture is not used anywhere else in the frame, you can use the frame debugger to verify its contents.
// Framebuffer fetch: this is an advanced TBDR GPU optimization that allows subpasses to read the output of previous subpasses directly from the framebuffer,
// greatly reducing the bandwidth usage.
public class FrameBufferFetchRenderFeature : ScriptableRendererFeature
{
class FrameBufferFetchPass : ScriptableRenderPass
{
private Material m_BlitMaterial;
private Material m_FBFetchMaterial;
public FrameBufferFetchPass( Material fbFetchMaterial)
{
m_FBFetchMaterial = fbFetchMaterial;
//The pass will read the current color texture. That needs to be an intermediate texture. It's not supported to use the BackBuffer as input texture.
//By setting this property, URP will automatically create an intermediate texture. This has a performance cost so don't set this if you don't need it.
//It's good practice to set it here and not from the RenderFeature. This way, the pass is selfcontaining and you can use it to directly enqueue the pass from a monobehaviour without a RenderFeature.
requiresIntermediateTexture = true;
}
// This class stores the data needed by the pass, passed as parameter to the delegate function that executes the pass
private class PassData
{
internal TextureHandle src;
internal Material material;
internal bool useMSAA;
}
// This static method is used to execute the pass and passed as the RenderFunc delegate to the RenderGraph render pass
static void ExecuteFBFetchPass(PassData data, RasterGraphContext context)
{
context.cmd.DrawProcedural(Matrix4x4.identity, data.material, data.useMSAA? 1 : 0, MeshTopology.Triangles, 3, 1, null);
}
private void FBFetchPass(RenderGraph renderGraph, ContextContainer frameData, TextureHandle source, TextureHandle destination, bool useMSAA)
{
string passName = "FrameBufferFetchPass";
// This simple pass copies the target of the previous pass to a new texture using a custom material and framebuffer fetch. This sample is for API demonstrative purposes,
// so the new texture is not used anywhere else in the frame, you can use the frame debugger to verify its contents.
// add a raster render pass to the render graph, specifying the name and the data type that will be passed to the ExecutePass function
using (var builder = renderGraph.AddRasterRenderPass<PassData>(passName, out var passData))
{
// Fill the pass data
passData.material = m_FBFetchMaterial;
passData.useMSAA = useMSAA;
// We declare the src as input attachment. This is required for Frame buffer fetch.
builder.SetInputAttachment(source, 0, AccessFlags.Read);
// Setup as a render target via UseTextureFragment, which is the equivalent of using the old cmd.SetRenderTarget
builder.SetRenderAttachment(destination, 0);
// We disable culling for this pass for the demonstrative purpose of this sample, as normally this pass would be culled,
// since the destination texture is not used anywhere else
builder.AllowPassCulling(false);
// Assign the ExecutePass function to the render pass delegate, which will be called by the render graph when executing the pass
builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecuteFBFetchPass(data, context));
}
}
// This is where the renderGraph handle can be accessed.
// Each ScriptableRenderPass can use the RenderGraph handle to add multiple render passes to the render graph
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// This pass showcases how to implement framebuffer fetch: this is an advanced TBDR GPU optimization
// that allows subpasses to read the output of previous subpasses directly from the framebuffer, reducing greatly the bandwidth usage.
// The first pass BlitPass simply copies the Camera Color in a temporary render target, the second pass FBFetchPass copies the temporary render target
// to another render target using framebuffer fetch.
// As a result, the passes are merged (you can verify in the RenderGraph Visualizer) and the bandwidth usage is reduced, since we can discard the temporary render target.
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures
// The active color and depth textures are the main color and depth buffers that the camera renders into
var resourceData = frameData.Get<UniversalResourceData>();
// The destination texture is created here,
// the texture is created with the same dimensions as the active color texture
var source = resourceData.activeColorTexture;
var destinationDesc = renderGraph.GetTextureDesc(source);
destinationDesc.name = "FBFetchDestTexture";
destinationDesc.clearBuffer = false;
if (destinationDesc.msaaSamples == MSAASamples.None || RenderGraphUtils.CanAddCopyPassMSAA())
{
TextureHandle fbFetchDestination = renderGraph.CreateTexture(destinationDesc);
FBFetchPass(renderGraph, frameData, source, fbFetchDestination, destinationDesc.msaaSamples != MSAASamples.None);
//Copy back the FBF output to the camera color to easily see the result in the game view
//This copy pass also uses FBF under the hood. All the passes should be merged this way and the destination attachment should be memoryless (no load/store of memory).
renderGraph.AddCopyPass(fbFetchDestination, source, passName: "Copy Back FF Destination (also using FBF)");
}
else
{
Debug.Log("Can't add the FBF pass and the copy pass due to MSAA");
}
}
}
FrameBufferFetchPass m_FbFetchPass;
public Material m_FBFetchMaterial;
/// <inheritdoc/>
public override void Create()
{
m_FbFetchPass = new FrameBufferFetchPass(m_FBFetchMaterial);
// Configures where the render pass should be injected.
m_FbFetchPass.renderPassEvent = RenderPassEvent.BeforeRenderingTransparents;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Early exit if there are no materials.
if (m_FBFetchMaterial == null)
{
Debug.LogWarning( this.name + " material is null and will be skipped.");
return;
}
renderer.EnqueuePass(m_FbFetchPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 75a4d77ab0ab06a44ae1c4e4507bafdd

View File

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

View File

@ -0,0 +1,136 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2733923283665781058
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GBuffer_Visualization_Material_Sample
m_Shader: {fileID: 4800000, guid: 7162aac11dbe74392aa00f03f6625b04, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

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

View File

@ -0,0 +1,103 @@
Shader "Universal Render Pipeline/GBuffer_Visualization_Shader_Sample"
{
Properties
{
// BlendMode
[HideInInspector]_Surface("__surface", Float) = 0.0
[HideInInspector]_Blend("__mode", Float) = 0.0
[HideInInspector]_Cull("__cull", Float) = 2.0
[HideInInspector][ToggleUI] _AlphaClip("__clip", Float) = 0.0
[HideInInspector] _BlendOp("__blendop", Float) = 0.0
[HideInInspector] _SrcBlend("__src", Float) = 1.0
[HideInInspector] _DstBlend("__dst", Float) = 0.0
[HideInInspector] _SrcBlendAlpha("__srcA", Float) = 1.0
[HideInInspector] _DstBlendAlpha("__dstA", Float) = 0.0
[HideInInspector] _ZWrite("__zw", Float) = 1.0
}
SubShader
{
Tags
{
"RenderType" = "Opaque"
"IgnoreProjector" = "True"
"UniversalMaterialType" = "Unlit"
"RenderPipeline" = "UniversalPipeline"
}
LOD 100
// -------------------------------------
// Render State Commands
Blend [_SrcBlend][_DstBlend], [_SrcBlendAlpha][_DstBlendAlpha]
ZWrite [_ZWrite]
Cull [_Cull]
Pass
{
Name "Deferred_GBuffer_Visualization"
HLSLPROGRAM
#pragma target 2.0
// -------------------------------------
// Shader Stages
#pragma vertex GBufferVisPassVertex
#pragma fragment GBufferVisPassFragment
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GlobalSamplers.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
// Declare the GBuffer to sample as an input
TEXTURE2D_X(_GBuffer2);
struct Attributes
{
uint vertexID : SV_VertexID;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
Varyings GBufferVisPassVertex(Attributes input)
{
Varyings output;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float4 pos = GetFullScreenTriangleVertexPosition(input.vertexID);
float2 uv = GetFullScreenTriangleTexCoord(input.vertexID);
output.positionCS = pos;
output.texcoord = uv;
return output;
}
void GBufferVisPassFragment(Varyings input, out half4 outColor : SV_Target0)
{
UNITY_SETUP_INSTANCE_ID(input);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
float2 uv = input.texcoord;
#ifndef UNITY_UV_STARTS_AT_TOP
uv.y = 1.0 - uv.y;
#endif
// Change the sampled GBuffer here
outColor = SAMPLE_TEXTURE2D_X_LOD(_GBuffer2, sampler_PointClamp, uv, 0);
}
ENDHLSL
}
}
FallBack "Hidden/Universal Render Pipeline/FallbackError"
}

View File

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

View File

@ -0,0 +1,142 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule;
// This example uses the gBuffer components in a RenderPass when they are not global.
// The RenderPass will by default show the contents of the Specular Metallic Texture (_GBuffer2) on geometry in the scene,
// but you can change the sampled gBuffer component by modifying the example shader.
// Make sure to (1) set the rendering path to Deferred and (2) add a 3D object in your scene to see a result.
public class GbufferVisualizationRendererFeature : ScriptableRendererFeature
{
class GBufferVisualizationRenderPass : ScriptableRenderPass
{
Material m_Material;
string m_PassName = "Visualize GBuffer Components (and make gBuffer global)";
private static readonly int GbufferLightingIndex = 3;
// Other gBuffer components indices
// private static readonly int GBufferNormalSmoothnessIndex = 2;
// private static readonly int GbufferDepthIndex = 4;
// private static readonly int GBufferRenderingLayersIndex = 5;
// Components marked as optional are only present when the pipeline requests it.
// If for example there is no rendering layers texture, _GBuffer5 will contain the ShadowMask texture
private static readonly int[] s_GBufferShaderPropertyIDs = new int[]
{
// Contains Albedo Texture
Shader.PropertyToID("_GBuffer0"),
// Contains Specular Metallic Texture
Shader.PropertyToID("_GBuffer1"),
// Contains Normals and Smoothness, referenced as _CameraNormalsTexture in other shaders
Shader.PropertyToID("_GBuffer2"),
// Contains Lighting texture
Shader.PropertyToID("_GBuffer3"),
// Contains Depth texture, referenced as _CameraDepthTexture in other shaders (optional)
Shader.PropertyToID("_GBuffer4"),
// Contains Rendering Layers Texture, referenced as _CameraRenderingLayersTexture in other shaders (optional)
Shader.PropertyToID("_GBuffer5"),
// Contains ShadowMask texture (optional)
Shader.PropertyToID("_GBuffer6")
};
private class PassData
{
// In this example, we want to use the gBuffer components in our pass.
public TextureHandle[] gBuffer;
public Material material;
}
public void Setup(Material material)
{
m_Material = material;
}
// This method will draw the contents of the gBuffer component requested in the shader
static void ExecutePass(PassData data, RasterGraphContext context)
{
// Here, we read all the gBuffer components as an example even though the shader only needs one.
// We still need to set it explicitly since it is not accessible globally (so the
// shader won't have access to it by default).
for (int i = 0; i < data.gBuffer.Length; i++)
{
data.material.SetTexture(s_GBufferShaderPropertyIDs[i], data.gBuffer[i]);
}
// Draw the gBuffer component requested by the shader over the geometry
context.cmd.DrawProcedural(Matrix4x4.identity, data.material, 0, MeshTopology.Triangles, 3, 1);
}
// RecordRenderGraph is where the RenderGraph handle can be accessed, through which render passes can be added to the graph.
// FrameData is a context container through which URP resources can be accessed and managed.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
UniversalRenderingData universalRenderingData = frameData.Get<UniversalRenderingData>();
// The gBuffer components are only used in deferred mode
if (m_Material == null || universalRenderingData.renderingMode != RenderingMode.Deferred)
return;
// Get the gBuffer texture handles stored in the resourceData
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
TextureHandle[] gBuffer = resourceData.gBuffer;
using (var builder = renderGraph.AddRasterRenderPass<PassData>(m_PassName, out var passData))
{
passData.material = m_Material;
// For this pass, we want to write to the activeColorTexture, which is the gBuffer Lighting component (_GBuffer3) in the deferred path.
builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write);
// We are reading the gBuffer components in our pass, so we need call UseTexture on them.
// When they are global, they can be all read with builder.UseAllGlobalTexture(true), but
// in this pass they are not global.
for (int i = 0; i < resourceData.gBuffer.Length; i++)
{
if (i == GbufferLightingIndex)
{
// We already specify we are writing to it above (SetRenderAttachment)
continue;
}
builder.UseTexture(resourceData.gBuffer[i]);
}
// We need to set the gBuffer in the pass' data, otherwise the pass won't have access to it when it is executed.
passData.gBuffer = gBuffer;
// Assigns the ExecutePass function to the render pass delegate. This will be called by the render graph when executing the pass.
builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecutePass(data, context));
}
}
}
GBufferVisualizationRenderPass m_GBufferRenderPass;
public Material m_Material;
/// <inheritdoc/>
public override void Create()
{
m_GBufferRenderPass = new GBufferVisualizationRenderPass
{
// This pass must be injected after rendering the deferred lights or later.
renderPassEvent = RenderPassEvent.AfterRenderingDeferredLights
};
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// The gBuffers are only used in the Deferred rendering path
if (m_Material != null)
{
m_GBufferRenderPass.Setup(m_Material);
renderer.EnqueuePass(m_GBufferRenderPass);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e76c94290719a4f89ae960002048ebfb

View File

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

View File

@ -0,0 +1,133 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule;
// This example feature sets the gBuffer components as globals (it renders nothing itself). By adding this
// feature to the scriptable renderer, other passes after it can access the gBuffers as globals.
// Make sure to set the rendering path to Deferred for it to work.
// Setting the gBuffers as globals may lead to reduced performance and memory use. Ideally, it's better to manage the
// textures yourself and do builder.UseTexture only for the textures you actually need.
public class GlobalGbuffersRendererFeature : ScriptableRendererFeature
{
class GlobalGBuffersRenderPass : ScriptableRenderPass
{
Material m_Material;
string m_PassName = "Make gBuffer Components Global";
private static readonly int GBufferNormalSmoothnessIndex = 2;
private static readonly int GbufferLightingIndex = 3;
private static readonly int GBufferRenderingLayersIndex = 5;
// The pipeline already sets the gBuffer depth component to be global in a few places, so uncomment this code as needed
// private static readonly int GbufferDepthIndex = 4;
// Components marked as optional are only present when the pipeline requests it.
// If for example there is no rendering layers texture, _GBuffer5 will contain the ShadowMask texture
private static readonly int[] s_GBufferShaderPropertyIDs = new int[]
{
// Contains Albedo Texture
Shader.PropertyToID("_GBuffer0"),
// Contains Specular Metallic Texture
Shader.PropertyToID("_GBuffer1"),
// Contains Normals and Smoothness, referenced as _CameraNormalsTexture in other shaders
Shader.PropertyToID("_GBuffer2"),
// Contains Lighting texture
Shader.PropertyToID("_GBuffer3"),
// Contains Depth texture, referenced as _CameraDepthTexture in other shaders (optional)
Shader.PropertyToID("_GBuffer4"),
// Contains Rendering Layers Texture, referenced as _CameraRenderingLayersTexture in other shaders (optional)
Shader.PropertyToID("_GBuffer5"),
// Contains ShadowMask texture (optional)
Shader.PropertyToID("_GBuffer6")
};
private class PassData
{
}
// This sets the gBuffer components as global after the current pass. After the pass, the gBuffers components made global
// will be made accessible using 'builder.UseAllGlobalTextures(true)' instead of 'builder.UseTexture(gBuffer[i])
// Shaders that use global texture will be able to fetch them without the need to call 'material.SetTexture()'
// like we do in the ExecutePass function of this pass.
private void SetGlobalGBufferTextures(IRasterRenderGraphBuilder builder, TextureHandle[] gBuffer)
{
// This loop will make the gBuffers accessible by all shaders using _GBufferX texture shader IDs
for (int i = 0; i < gBuffer.Length; i++)
{
if (i != GbufferLightingIndex && gBuffer[i].IsValid())
builder.SetGlobalTextureAfterPass(gBuffer[i], s_GBufferShaderPropertyIDs[i]);
}
// Some global textures are accessed using specific shader IDs that are internal to URP. To use the gBuffer in these places, we
// need to set the ID to point to the corresponding gBuffer component.
if (gBuffer[GBufferNormalSmoothnessIndex].IsValid())
{
// After this pass, shaders that use the _CameraNormalsTexture will get the gBuffer's NormalsSmoothnessTexture component
builder.SetGlobalTextureAfterPass(gBuffer[GBufferNormalSmoothnessIndex],
Shader.PropertyToID("_CameraNormalsTexture"));
}
// The pipeline already sets the gBuffer depth component to be global in a few places, so uncomment this code as needed
// if (GbufferDepthIndex < gBuffer.Length && gBuffer[GbufferDepthIndex].IsValid())
// {
// // After this pass, shaders that use the _CameraDepthTexture will get the gBuffer's Depth component (note that it is also set global by the copy depth pass)
// builder.SetGlobalTextureAfterPass(gBuffer[GbufferDepthIndex],
// Shader.PropertyToID("_CameraDepthTexture"));
// }
if (GBufferRenderingLayersIndex < gBuffer.Length && gBuffer[GBufferRenderingLayersIndex].IsValid())
{
// After this pass, shaders that use the _CameraRenderingLayersTexture will get the gBuffer's RenderingLayersTexture component
builder.SetGlobalTextureAfterPass(gBuffer[GBufferRenderingLayersIndex],
Shader.PropertyToID("_CameraRenderingLayersTexture"));
}
}
// RecordRenderGraph is where the RenderGraph handle can be accessed, through which render passes can be added to the graph.
// FrameData is a context container through which URP resources can be accessed and managed.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
UniversalRenderingData universalRenderingData = frameData.Get<UniversalRenderingData>();
// The gBuffer components are only used in deferred mode
if (universalRenderingData.renderingMode != RenderingMode.Deferred)
return;
// Get the gBuffer texture handles are stored in the resourceData
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
TextureHandle[] gBuffer = resourceData.gBuffer;
using (var builder = renderGraph.AddRasterRenderPass<PassData>(m_PassName, out var passData))
{
builder.AllowPassCulling(false);
// Set the gBuffers to be global after the pass
SetGlobalGBufferTextures(builder, gBuffer);
builder.SetRenderFunc((PassData data, RasterGraphContext context) => { /* nothing to be rendered */ });
}
}
}
GlobalGBuffersRenderPass m_GlobalGbuffersRenderPass;
/// <inheritdoc/>
public override void Create()
{
m_GlobalGbuffersRenderPass = new GlobalGBuffersRenderPass
{
// This pass must be injected after rendering the deferred lights or later.
renderPassEvent = RenderPassEvent.AfterRenderingDeferredLights
};
}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_GlobalGbuffersRenderPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 86e4c5363f57b435eba17d3088e4e3a7

View File

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

View File

@ -0,0 +1,67 @@
Shader "Hidden/MrtColor"
{
Properties
{
_ColorTexture("ColorTexture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off
Pass
{
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/GlobalSamplers.hlsl"
TEXTURE2D_X(_ColorTexture);
struct Attributes
{
uint vertexID : SV_VertexID;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
Varyings Vert(Attributes input)
{
Varyings output;
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID);
return output;
}
// MRT shader
struct FragmentOutput
{
half4 dest0 : SV_Target0;
half4 dest1 : SV_Target1;
half4 dest2 : SV_Target2;
};
FragmentOutput frag(Varyings input) : SV_Target
{
half4 color = SAMPLE_TEXTURE2D_X(_ColorTexture, sampler_LinearRepeat, input.texcoord);
FragmentOutput output;
output.dest0 = half4(color.r, 0.0, 0.0, 1.0);
output.dest1 = half4(0.0, color.g, 0.0, 1.0);
output.dest2 = half4(0.0, 0.0, color.b, 1.0);
return output;
}
ENDHLSL
}
}
}

View File

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

View File

@ -0,0 +1,139 @@
%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: MrtMaterial
m_Shader: {fileID: 4800000, guid: 387b0ac98e9400a4cb11a9f5e3aaa00d, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
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}
- _ColorTexture:
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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &2154666813205368784
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

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

View File

@ -0,0 +1,155 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
// In this example it is shown how to use Multiple Render Targets (MRT) in RenderGraph using URP. This is useful when more than 4 channels of data (a single RGBA texture) needs to be written by a pass.
public class MrtRendererFeature : ScriptableRendererFeature
{
// This pass is using MRT and will output to 3 different Render Targets.
class MrtPass : ScriptableRenderPass
{
// The data we want to transfer to the render function after recording.
class PassData
{
// Texture handle for the color input.
public TextureHandle color;
// Input texture name for the material.
public string texName;
// Material used for the MRT Pass.
public Material material;
}
// Input texture name for the material.
string m_texName;
// Material used for the MRT Pass.
Material m_Material;
// RTHandle outputs for the MRT destinations.
RTHandle[] m_RTs = new RTHandle[3];
RenderTargetInfo[] m_RTInfos = new RenderTargetInfo[3];
// Function used to transfer the material from the renderer feature to the render pass.
public void Setup(string texName, Material material, RenderTexture[] renderTextures)
{
m_Material = material;
m_texName = String.IsNullOrEmpty(texName) ? "_ColorTexture" : texName;
//Create RTHandles from the RenderTextures if they have changed.
for (int i = 0; i < 3; i++)
{
if (m_RTs[i] == null || m_RTs[i].rt != renderTextures[i])
{
m_RTs[i]?.Release();
m_RTs[i] = RTHandles.Alloc(renderTextures[i], $"ChannelTexture[{i}]");
m_RTInfos[i] = new RenderTargetInfo()
{
format = renderTextures[i].graphicsFormat,
height = renderTextures[i].height,
width = renderTextures[i].width,
bindMS = renderTextures[i].bindTextureMS,
msaaSamples = 1,
volumeDepth = renderTextures[i].volumeDepth,
};
}
}
}
// This function blits the whole screen for a given material.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
var handles = new TextureHandle[3];
// Imports the texture handles them in RenderGraph.
for (int i = 0; i < 3; i++)
{
handles[i] = renderGraph.ImportTexture(m_RTs[i], m_RTInfos[i]);
}
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
using (var builder = renderGraph.AddRasterRenderPass<PassData>("MRT Pass", out var passData))
{
// Fetch the universal resource data to exstract the camera's color attachment.
var resourceData = frameData.Get<UniversalResourceData>();
// Fill in the pass data using by the render function.
// Use the camera's color attachment as input.
passData.color = resourceData.activeColorTexture;
// Input Texture name for the material.
passData.texName = m_texName;
// Material used in the pass.
passData.material = m_Material;
// Sets input attachment.
builder.UseTexture(passData.color);
// Sets color attachments.
for (int i = 0; i < 3; i++)
{
builder.SetRenderAttachment(handles[i], i);
}
// Sets the render function.
builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => ExecutePass(data, rgContext));
}
}
// ExecutePass is the render function for each of the blit render graph recordings.
// This is good practice to avoid using variables outside of the lambda it is called from.
// It is static to avoid using member variables which could cause unintended behaviour.
static void ExecutePass(PassData data, RasterGraphContext rgContext)
{
// Sets the input color texture to the name used in the MRTPass
data.material.SetTexture(data.texName, data.color);
// Draw the fullscreen triangle with the MRT shader.
rgContext.cmd.DrawProcedural(Matrix4x4.identity, data.material, 0, MeshTopology.Triangles, 3);
}
}
[Tooltip("The material used when making the MRT pass.")]
public Material mrtMaterial;
[Tooltip("Name to apply the camera's color attachment to for the given material.")]
public string textureName = "_ColorTexture";
[Tooltip("Render Textures to output the result to. Is has to have the size of 3.")]
public RenderTexture[] renderTextures = new RenderTexture[3];
MrtPass m_MrtPass;
// Here you can create passes and do the initialization of them. This is called everytime serialization happens.
public override void Create()
{
m_MrtPass = new MrtPass();
// Configures where the render pass should be injected.
m_MrtPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Since they have the same RenderPassEvent the order matters when enqueueing them.
// Early exit if there are no materials.
if (mrtMaterial == null || renderTextures.Length != 3)
{
Debug.LogWarning("Skipping MRTPass because the material is null or render textures doesn't have a size of 3.");
return;
}
foreach (var rt in renderTextures)
{
if (rt == null)
{
Debug.LogWarning("Skipping MRTPass because one of the render textures is null.");
return;
}
}
// Call the pass Setup function to transfer the RendererFeature settings to the RenderPass.
m_MrtPass.Setup(textureName, mrtMaterial, renderTextures);
renderer.EnqueuePass(m_MrtPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3ed4a568eb4f9324db09da85a07b1a18

View File

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

View File

@ -0,0 +1,644 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "cab51101bcf44084b39765c8c9d038aa",
"m_Properties": [
{
"m_Id": "081f747b4003483886664a3b43d7d9b1"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "60f58dee27e842df94122b554e129020"
}
],
"m_Nodes": [
{
"m_Id": "3d44e2c16ada474ba9e8f8b5e2bd6381"
},
{
"m_Id": "c4de461bc02647e7ad167620f6de6626"
},
{
"m_Id": "623165c6d9554bd1a4d0fd78f5717f78"
},
{
"m_Id": "07f333b36094443fadff1b974e16ef78"
},
{
"m_Id": "97849135523a4e16a81739315301f60e"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "07f333b36094443fadff1b974e16ef78"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "623165c6d9554bd1a4d0fd78f5717f78"
},
"m_SlotId": 2
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "623165c6d9554bd1a4d0fd78f5717f78"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "3d44e2c16ada474ba9e8f8b5e2bd6381"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "c4de461bc02647e7ad167620f6de6626"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "623165c6d9554bd1a4d0fd78f5717f78"
},
"m_SlotId": 1
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 620.0,
"y": -80.66666412353516
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 620.0,
"y": 158.6666259765625
},
"m_Blocks": [
{
"m_Id": "3d44e2c16ada474ba9e8f8b5e2bd6381"
},
{
"m_Id": "97849135523a4e16a81739315301f60e"
}
]
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"fileID\":10210,\"guid\":\"0000000000000000e000000000000000\",\"type\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "Shader Graphs",
"m_GraphPrecision": 1,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": ""
},
"m_SubDatas": [],
"m_ActiveTargets": [
{
"m_Id": "6e9e94dde4af4c2ebd8b8b1bb574d0de"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "024c5d0bfa484718938dc756a394911a",
"m_Id": 7,
"m_DisplayName": "A",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ScreenPositionNode",
"m_ObjectId": "07f333b36094443fadff1b974e16ef78",
"m_Group": {
"m_Id": ""
},
"m_Name": "Screen Position",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 75.55561828613281,
"y": 255.11105346679688,
"width": 207.9999237060547,
"height": 311.5555725097656
}
},
"m_Slots": [
{
"m_Id": "f96c2585f2d942ba9c5ea47b555c5c54"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_ScreenSpaceType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
"m_ObjectId": "081f747b4003483886664a3b43d7d9b1",
"m_Guid": {
"m_GuidSerialized": "2ab2229d-a39b-409b-84a0-8f1ce07207f7"
},
"m_Name": "_InputTexture",
"m_DefaultRefNameVersion": 1,
"m_RefNameGeneratedByDisplayName": "_InputTexture",
"m_DefaultReferenceName": "_InputTexture",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_Value": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"isMainTexture": false,
"useTilingAndOffset": false,
"m_Modifiable": true,
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
"m_ObjectId": "2d809721a14c44f39764d222e4f2c1b8",
"m_Id": 0,
"m_DisplayName": "_InputTexture",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot",
"m_ObjectId": "382c57c33193472a8b4d787a5d01e46e",
"m_Id": 2,
"m_DisplayName": "UV",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "UV",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [],
"m_Channel": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "3d44e2c16ada474ba9e8f8b5e2bd6381",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.BaseColor",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "4c7f69cf7cc74aafb764484100d40e08"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
"m_ObjectId": "4c7f69cf7cc74aafb764484100d40e08",
"m_Id": 0,
"m_DisplayName": "Base Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "BaseColor",
"m_StageCapability": 2,
"m_Value": {
"x": 0.5,
"y": 0.5,
"z": 0.5
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [],
"m_ColorMode": 0,
"m_DefaultColor": {
"r": 0.5,
"g": 0.5,
"b": 0.5,
"a": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "52901f72a10a48b6822e3cd75f35e288",
"m_Id": 0,
"m_DisplayName": "RGBA",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "RGBA",
"m_StageCapability": 2,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "60f58dee27e842df94122b554e129020",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "081f747b4003483886664a3b43d7d9b1"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode",
"m_ObjectId": "623165c6d9554bd1a4d0fd78f5717f78",
"m_Group": {
"m_Id": ""
},
"m_Name": "Sample Texture 2D",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 306.2221984863281,
"y": 181.77772521972657,
"width": 208.00003051757813,
"height": 432.44451904296877
}
},
"m_Slots": [
{
"m_Id": "52901f72a10a48b6822e3cd75f35e288"
},
{
"m_Id": "f59d9407e6a143d9bc2dee2da0416751"
},
{
"m_Id": "d54dfddc1d53404fba6afedfac14c57a"
},
{
"m_Id": "800b4e56b8314d8aa6b43dfac147b5a0"
},
{
"m_Id": "024c5d0bfa484718938dc756a394911a"
},
{
"m_Id": "965cca74adc747398d92f0878dc18b87"
},
{
"m_Id": "382c57c33193472a8b4d787a5d01e46e"
},
{
"m_Id": "a02191466f644c19ba90ab942204bbfd"
}
],
"synonyms": [
"tex2d"
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_TextureType": 0,
"m_NormalMapSpace": 0,
"m_EnableGlobalMipBias": true,
"m_MipSamplingMode": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "6959e50bacde4e5a99cc215b757ef7b7",
"m_Id": 0,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 2,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
"m_ObjectId": "6e9e94dde4af4c2ebd8b8b1bb574d0de",
"m_Datas": [
{
"m_Id": "e9e3fd6da311413e96be9b524993ae6a"
}
],
"m_ActiveSubTarget": {
"m_Id": "b48b7ed4833546e08b17cf9dfb23b995"
},
"m_AllowMaterialOverride": false,
"m_SurfaceType": 0,
"m_ZTestMode": 1,
"m_ZWriteControl": 2,
"m_AlphaMode": 0,
"m_RenderFace": 0,
"m_AlphaClip": false,
"m_CastShadows": false,
"m_ReceiveShadows": true,
"m_DisableTint": false,
"m_AdditionalMotionVectorMode": 0,
"m_AlembicMotionVectors": false,
"m_SupportsLODCrossFade": false,
"m_CustomEditorGUI": "",
"m_SupportVFX": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "800b4e56b8314d8aa6b43dfac147b5a0",
"m_Id": 6,
"m_DisplayName": "B",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
"m_ObjectId": "965cca74adc747398d92f0878dc18b87",
"m_Id": 1,
"m_DisplayName": "Texture",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Texture",
"m_StageCapability": 3,
"m_BareResource": false,
"m_Texture": {
"m_SerializedTexture": "",
"m_Guid": ""
},
"m_DefaultType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
"m_ObjectId": "97849135523a4e16a81739315301f60e",
"m_Group": {
"m_Id": ""
},
"m_Name": "SurfaceDescription.Alpha",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 0.0,
"y": 0.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "6959e50bacde4e5a99cc215b757ef7b7"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot",
"m_ObjectId": "a02191466f644c19ba90ab942204bbfd",
"m_Id": 3,
"m_DisplayName": "Sampler",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Sampler",
"m_StageCapability": 3,
"m_BareResource": false
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalFullscreenSubTarget",
"m_ObjectId": "b48b7ed4833546e08b17cf9dfb23b995"
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "c4de461bc02647e7ad167620f6de6626",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 128.888916015625,
"y": 220.88882446289063,
"width": 153.7777099609375,
"height": 33.777862548828128
}
},
"m_Slots": [
{
"m_Id": "2d809721a14c44f39764d222e4f2c1b8"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "081f747b4003483886664a3b43d7d9b1"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "d54dfddc1d53404fba6afedfac14c57a",
"m_Id": 5,
"m_DisplayName": "G",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "G",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.Rendering.Fullscreen.ShaderGraph.FullscreenData",
"m_ObjectId": "e9e3fd6da311413e96be9b524993ae6a",
"m_Version": 0,
"m_fullscreenMode": 0,
"m_BlendMode": 0,
"m_SrcColorBlendMode": 0,
"m_DstColorBlendMode": 1,
"m_ColorBlendOperation": 0,
"m_SrcAlphaBlendMode": 0,
"m_DstAlphaBlendMode": 1,
"m_AlphaBlendOperation": 0,
"m_EnableStencil": false,
"m_StencilReference": 0,
"m_StencilReadMask": 255,
"m_StencilWriteMask": 255,
"m_StencilCompareFunction": 8,
"m_StencilPassOperation": 0,
"m_StencilFailOperation": 0,
"m_StencilDepthFailOperation": 0,
"m_DepthWrite": false,
"m_depthWriteMode": 0,
"m_AllowMaterialOverride": false,
"m_DepthTestMode": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "f59d9407e6a143d9bc2dee2da0416751",
"m_Id": 4,
"m_DisplayName": "R",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "R",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "f96c2585f2d942ba9c5ea47b555c5c54",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 8f6a40d408f23e64e93e507e222c517e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,129 @@
using System;
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule.Util;
// MERGING: This pass can be merged with Draw Objects Pass and Draw Skybox pass if you set the m_PassEvent in
// the inspector to After Rendering Opagues and set the texture type to Normal.
// Your can observe this merging in the Render Graph Visualizer. If set to After Rendering Post Processing we
// can now see that the pass isn't merged with any thing.
// This RenderFeature shows how to used RenderGraph to output a specific texture used in URP, how a texture
// can be attached by name to a material and how two render passes can be merged if executed in the correct order.
public class OutputTextureRendererFeature : ScriptableRendererFeature
{
// Enum used to select which texture you want to output.
[Serializable]
enum TextureType
{
OpaqueColor,
Depth,
Normal,
MotionVector,
}
// Function to fetch the texture given the resource data and the texture type you want.
static TextureHandle GetTextureHandleFromType(UniversalResourceData resourceData, TextureType textureType)
{
switch (textureType)
{
case TextureType.OpaqueColor:
return resourceData.cameraOpaqueTexture;
case TextureType.Depth:
return resourceData.cameraDepthTexture;
case TextureType.Normal:
return resourceData.cameraNormalsTexture;
case TextureType.MotionVector:
return resourceData.motionVectorColor;
default:
return TextureHandle.nullHandle;
}
}
// Pass which outputs a texture from rendering to inspect a texture
class OutputTexturePass : ScriptableRenderPass
{
// The texture name you wish to bind the texture handle to for a given material.
string m_TextureName;
// The texture type you want to retrive from URP.
TextureType m_TextureType;
// The material used for blitting to the color output.
Material m_Material;
// Function set setup the ConfigureInput() and transfer the renderer feature settings to the render pass.
public void Setup(string textureName, TextureType textureType, Material material)
{
// Setup code to trigger each corrspoinding texture is ready for use one the pass is run.
if (textureType == TextureType.OpaqueColor)
ConfigureInput(ScriptableRenderPassInput.Color);
else if (textureType == TextureType.Depth)
ConfigureInput(ScriptableRenderPassInput.Depth);
else if (textureType == TextureType.Normal)
ConfigureInput(ScriptableRenderPassInput.Normal);
else if (textureType == TextureType.MotionVector)
ConfigureInput(ScriptableRenderPassInput.Motion);
// Setup the texture name, type and material used when blitting.
// In this example we will use a mateial using a custom name for the input texture name when blitting.
// This texture name has to match the material texture input you are using.
m_TextureName = String.IsNullOrEmpty(textureName) ? "_BlitTexture" : textureName;
// Texture type selects which input we would like to retrive from the camera.
m_TextureType = textureType;
// The material is used to blit the texture to the cameras color attachment.
m_Material = material;
}
// Records a render graph render pass which blits the BlitData's active texture back to the camera's color attachment.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Fetch UniversalResourceData from frameData to retrive the URP's texture handles.
var resourceData = frameData.Get<UniversalResourceData>();
// Sets the texture handle input using the helper function to fetch the correct handle from resourceData.
var source = GetTextureHandleFromType(resourceData, m_TextureType);
if (!source.IsValid())
{
Debug.Log("Input texture is not created. Likely the pass event is before the creation of the resource. Skipping OutputTexturePass.");
return;
}
RenderGraphUtils.BlitMaterialParameters para = new(source, resourceData.activeColorTexture, m_Material, 0);
para.sourceTexturePropertyID = Shader.PropertyToID(m_TextureName);
renderGraph.AddBlitPass(para, passName: "Blit Selected Resource");
}
}
// Inputs in the inspector to change the settings for the renderer feature.
[SerializeField]
RenderPassEvent m_PassEvent = RenderPassEvent.AfterRenderingTransparents;
[SerializeField]
string m_TextureName = "_InputTexture";
[SerializeField]
TextureType m_TextureType;
[SerializeField]
Material m_Material;
OutputTexturePass m_ScriptablePass;
/// <inheritdoc/>
public override void Create()
{
m_ScriptablePass = new OutputTexturePass();
// Configures where the render pass should be injected.
m_ScriptablePass.renderPassEvent = m_PassEvent;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Setup the correct data for the render pass, and transfers the data from the renderer feature to the render pass.
m_ScriptablePass.Setup(m_TextureName, m_TextureType, m_Material);
renderer.EnqueuePass(m_ScriptablePass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 844a96d8ebb8a904aaa6dc603c116808

View File

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

View File

@ -0,0 +1,131 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RendererUtils;
using UnityEngine.Rendering.Universal;
// This example clears the current active color texture, then renders the scene geometry associated to the m_LayerMask layer.
// Add scene geometry to your own custom layers and experiment switching the layer mask in the render feature UI.
// You can use the frame debugger to inspect the pass output.
public class RendererListRenderFeature : ScriptableRendererFeature
{
class RendererListPass : ScriptableRenderPass
{
// Layer mask used to filter objects to put in the renderer list
private LayerMask m_LayerMask;
// List of shader tags used to build the renderer list
private List<ShaderTagId> m_ShaderTagIdList = new List<ShaderTagId>();
public RendererListPass(LayerMask layerMask)
{
m_LayerMask = layerMask;
}
// This class stores the data needed by the pass, passed as parameter to the delegate function that executes the pass
private class PassData
{
public RendererListHandle rendererListHandle;
}
// Sample utility method that showcases how to create a renderer list via the RenderGraph API
private void InitRendererLists(ContextContainer frameData, ref PassData passData, RenderGraph renderGraph)
{
// Access the relevant frame data from the Universal Render Pipeline
UniversalRenderingData universalRenderingData = frameData.Get<UniversalRenderingData>();
UniversalCameraData cameraData = frameData.Get<UniversalCameraData>();
UniversalLightData lightData = frameData.Get<UniversalLightData>();
var sortFlags = cameraData.defaultOpaqueSortFlags;
RenderQueueRange renderQueueRange = RenderQueueRange.opaque;
FilteringSettings filterSettings = new FilteringSettings(renderQueueRange, m_LayerMask);
ShaderTagId[] forwardOnlyShaderTagIds = new ShaderTagId[]
{
new ShaderTagId("UniversalForwardOnly"),
new ShaderTagId("UniversalForward"),
new ShaderTagId("SRPDefaultUnlit"), // Legacy shaders (do not have a gbuffer pass) are considered forward-only for backward compatibility
new ShaderTagId("LightweightForward") // Legacy shaders (do not have a gbuffer pass) are considered forward-only for backward compatibility
};
m_ShaderTagIdList.Clear();
foreach (ShaderTagId sid in forwardOnlyShaderTagIds)
m_ShaderTagIdList.Add(sid);
DrawingSettings drawSettings = RenderingUtils.CreateDrawingSettings(m_ShaderTagIdList, universalRenderingData, cameraData, lightData, sortFlags);
var param = new RendererListParams(universalRenderingData.cullResults, drawSettings, filterSettings);
passData.rendererListHandle = renderGraph.CreateRendererList(param);
}
// This static method is used to execute the pass and passed as the RenderFunc delegate to the RenderGraph render pass
static void ExecutePass(PassData data, RasterGraphContext context)
{
context.cmd.ClearRenderTarget(RTClearFlags.Color, Color.green, 1,0);
context.cmd.DrawRendererList(data.rendererListHandle);
}
// This is where the renderGraph handle can be accessed.
// Each ScriptableRenderPass can use the RenderGraph handle to add multiple render passes to the render graph
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
string passName = "RenderList Render Pass";
// This simple pass clears the current active color texture, then renders the scene geometry associated to the m_LayerMask layer.
// Add scene geometry to your own custom layers and experiment switching the layer mask in the render feature UI.
// You can use the frame debugger to inspect the pass output
// add a raster render pass to the render graph, specifying the name and the data type that will be passed to the ExecutePass function
using (var builder = renderGraph.AddRasterRenderPass<PassData>(passName, out var passData))
{
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures
// The active color and depth textures are the main color and depth buffers that the camera renders into
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
// Fill up the passData with the data needed by the pass
InitRendererLists(frameData, ref passData, renderGraph);
// Make sure the renderer list is valid
//if (!passData.rendererListHandle.IsValid())
// return;
// We declare the RendererList we just created as an input dependency to this pass, via UseRendererList()
builder.UseRendererList(passData.rendererListHandle);
// Setup as a render target via UseTextureFragment and UseTextureFragmentDepth, which are the equivalent of using the old cmd.SetRenderTarget(color,depth)
builder.SetRenderAttachment(resourceData.activeColorTexture, 0);
builder.SetRenderAttachmentDepth(resourceData.activeDepthTexture, AccessFlags.Write);
// Assign the ExecutePass function to the render pass delegate, which will be called by the render graph when executing the pass
builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecutePass(data, context));
builder.SetRenderFunc<PassData>(ExecutePass);
}
}
}
RendererListPass m_ScriptablePass;
public LayerMask m_LayerMask;
/// <inheritdoc/>
public override void Create()
{
m_ScriptablePass = new RendererListPass(m_LayerMask);
// Configures where the render pass should be injected.
m_ScriptablePass.renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_ScriptablePass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e0f308632a61c8247b1df9f93dc00944

View File

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

View File

@ -0,0 +1,179 @@
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering.RenderGraphModule.Util;
// In this example we will create a texture reference ContextItem in frameData to hold a reference
// used by furture passes. This is usefull to avoid additional blit operations copying back and forth
// to the cameras color attachment. Instead of copying it back after the blit operation we can instead
// update the reference to the blit destination and use that for future passes.
// The is the prefered way to share resources between passes. Previously, it was common to use global textures for this.
// However, it's better to avoid using global textures where you can.
public class TextureRefRendererFeature : ScriptableRendererFeature
{
// The ContextItem used to store the texture reference at.
public class TexRefData : ContextItem
{
// The texture reference variable.
public TextureHandle texture = TextureHandle.nullHandle;
// Reset function required by ContextItem. It should reset all variables not carried
// over to next frame.
public override void Reset()
{
// We should always reset texture handles since they are only vaild for the current frame.
texture = TextureHandle.nullHandle;
}
}
// This pass updates the reference when making a blit operation using a material and the camera's color attachment.
class UpdateRefPass : ScriptableRenderPass
{
// The data we want to transfer to the render function after recording.
class PassData
{
// For the blit operation we will need the source and destination of the color attachments.
public TextureHandle source;
public TextureHandle destination;
// We will also need a material to transform the color attachment when making a blit operation.
public Material material;
}
// Scale bias is used to blit from source to distination given a 2d scale in the x and y parameters
// and an offset in the z and w parameters.
static Vector4 scaleBias = new Vector4(1f, 1f, 0f, 0f);
// Material used in the blit operation.
Material[] m_DisplayMaterials;
// Function used to transfer the material from the renderer feature to the render pass.
public void Setup(Material[] materials)
{
m_DisplayMaterials = materials;
}
// This function blits the whole screen for a given material.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
foreach (var mat in m_DisplayMaterials)
{
// Skip material if it is null.
if (mat == null)
{
Debug.LogWarning($"Skipping render pass for unassigned material.");
continue;
}
// Starts the recording of the render graph pass given the name of the pass
// and outputting the data used to pass data to the execution of the render function.
using (var builder = renderGraph.AddRasterRenderPass<PassData>($"UpdateRefPass_{mat.name}", out var passData))
{
var texRefExist = frameData.Contains<TexRefData>();
var texRef = frameData.GetOrCreate<TexRefData>();
// First time running this pass. Fetch ref from active color buffer.
if (!texRefExist)
{
var resourceData = frameData.Get<UniversalResourceData>();
// For this first occurence we would like
texRef.texture = resourceData.activeColorTexture;
}
// Fill in the pass data using by the render function.
// Use the old reference from TexRefData.
passData.source = texRef.texture;
var descriptor = passData.source.GetDescriptor(renderGraph);
// We disable MSAA for the blit operations.
descriptor.msaaSamples = MSAASamples.None;
descriptor.name = $"BlitMaterialRefTex_{mat.name}";
descriptor.clearBuffer = false;
// Create a new temporary texture to keep the blit result.
passData.destination = renderGraph.CreateTexture(descriptor);
// Material used in the blit operation.
passData.material = mat;
// Update the texture reference to the blit destination.
texRef.texture = passData.destination;
// Sets input attachment.
builder.UseTexture(passData.source);
// Sets color attachment 0.
builder.SetRenderAttachment(passData.destination, 0);
// Sets the render function.
builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => ExecutePass(data, rgContext));
}
}
}
// ExecutePass is the render function for each of the blit render graph recordings.
// This is good practice to avoid using variables outside of the lambda it is called from.
// It is static to avoid using member variables which could cause unintended behaviour.
static void ExecutePass(PassData data, RasterGraphContext rgContext)
{
Blitter.BlitTexture(rgContext.cmd, data.source, scaleBias, data.material, 0);
}
}
// After updating the reference we will need to use the result copying it back to camera's
// color attachment.
class CopyBackRefPass : ScriptableRenderPass
{
// This function blits the reference back to the camera's color attachment.
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
// Early exit if TexRefData doesn't exist within frameData since where is nothing to copy back.
if (!frameData.Contains<TexRefData>()) return;
// Fetch UniversalResourceData to retrive the camera's active color texture.
var resourceData = frameData.Get<UniversalResourceData>();
// Fetch TexRefData to retrive the texture reference.
var texRef = frameData.Get<TexRefData>();
renderGraph.AddBlitPass(texRef.texture, resourceData.activeColorTexture, Vector2.one, Vector2.zero, passName: "Blit Back Pass");
}
}
[Tooltip("The material used when making the blit operation.")]
public Material[] displayMaterials = new Material[1];
UpdateRefPass m_UpdateRefPass;
CopyBackRefPass m_CopyBackRefPass;
// Here you can create passes and do the initialization of them. This is called everytime serialization happens.
public override void Create()
{
m_UpdateRefPass = new UpdateRefPass();
m_CopyBackRefPass = new CopyBackRefPass();
// Configures where the render pass should be injected.
m_UpdateRefPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
m_CopyBackRefPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
// Since they have the same RenderPassEvent the order matters when enqueueing them.
// Early exit if there are no materials.
if (displayMaterials == null)
{
Debug.LogWarning("TexterRefRendererFeature materials is null and will be skipped.");
return;
}
m_UpdateRefPass.Setup(displayMaterials);
renderer.EnqueuePass(m_UpdateRefPass);
renderer.EnqueuePass(m_CopyBackRefPass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1593cc97174cf7a4c9c168bdf89f9d19

View File

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

View File

@ -0,0 +1,142 @@
using UnityEngine;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
// This example copies the active color texture to a new texture, it then downsamples the source texture twice. This example is for API demonstrative purposes,
// so the new textures are not used anywhere else in the frame, you can use the frame debugger to verify their contents.
// The key concept of this example, is the UnsafePass usage: these type of passes are unsafe and allow using command like SetRenderTarget() which are
// not compatible with RasterRenderPasses. Using UnsafePasses means that the RenderGraph won't try to optimize the pass by merging it inside a NativeRenderPass.
// In some cases using UnsafePasses makes sense, if for example we know that a set of adjacent passes are not mergeable, so this can optimize the RenderGraph
// compiling times, on top of simplifying the multiple passes setup.
public class UnsafePassRenderFeature : ScriptableRendererFeature
{
class UnsafePass : ScriptableRenderPass
{
// This class stores the data needed by the pass, passed as parameter to the delegate function that executes the pass
private class PassData
{
internal TextureHandle source;
internal TextureHandle destination;
internal TextureHandle destinationHalf;
internal TextureHandle destinationQuarter;
}
// This static method is used to execute the pass and passed as the RenderFunc delegate to the RenderGraph render pass
static void ExecutePass(PassData data, UnsafeGraphContext context)
{
// Set manually the RenderTarget for each blit. Each SetRenderTarget call would require a separate RasterCommandPass if we wanted
// to setup RenderGraph for merging passes when possible.
// In this case we know that these 3 subpasses are not compatible for merging, because RenderTargets have different dimensions,
// so we simplify our code to use an unsafe pass, also saving RenderGraph processing time.
// copy the current scene color
CommandBuffer unsafeCmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd);
context.cmd.SetRenderTarget(data.destination);
Blitter.BlitTexture(unsafeCmd, data.source, new Vector4(1, 1, 0, 0), 0, false);
// downscale x2
context.cmd.SetRenderTarget(data.destinationHalf);
Blitter.BlitTexture(unsafeCmd, data.destination, new Vector4(1, 1, 0, 0), 0, false);
context.cmd.SetRenderTarget(data.destinationQuarter);
Blitter.BlitTexture(unsafeCmd, data.destinationHalf, new Vector4(1, 1, 0, 0), 0, false);
// upscale x2
context.cmd.SetRenderTarget(data.destinationHalf);
Blitter.BlitTexture(unsafeCmd, data.destinationQuarter, new Vector4(1, 1, 0, 0), 0, false);
context.cmd.SetRenderTarget(data.destination);
Blitter.BlitTexture(unsafeCmd, data.destinationHalf, new Vector4(1, 1, 0, 0), 0, false);
}
// This is where the renderGraph handle can be accessed.
// Each ScriptableRenderPass can use the RenderGraph handle to add multiple render passes to the render graph
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
string passName = "Unsafe Pass";
// add a raster render pass to the render graph, specifying the name and the data type that will be passed to the ExecutePass function
using (var builder = renderGraph.AddUnsafePass<PassData>(passName, out var passData))
{
// UniversalResourceData contains all the texture handles used by the renderer, including the active color and depth textures
// The active color and depth textures are the main color and depth buffers that the camera renders into
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
// Fill up the passData with the data needed by the pass
// Get the active color texture through the frame data, and set it as the source texture for the blit
passData.source = resourceData.activeColorTexture;
// The destination textures are created here,
// the texture is created with the same dimensions as the active color texture, but with no depth buffer, being a copy of the color texture
// we also disable MSAA as we don't need multisampled textures for this sample
// the other two textures halve the resolution of the previous one
var descriptor = passData.source.GetDescriptor(renderGraph);
// We disable MSAA for the blit operations.
descriptor.msaaSamples = MSAASamples.None;
descriptor.clearBuffer = false;
// Create a new temporary texture to keep the blit result.
descriptor.name = "UnsafeTexture";
var destination = renderGraph.CreateTexture(descriptor);
descriptor.width /= 2;
descriptor.height /= 2;
descriptor.name = "UnsafeTexture2";
var destinationHalf = renderGraph.CreateTexture(descriptor);
descriptor.width /= 2;
descriptor.height /= 2;
descriptor.name = "UnsafeTexture3";
var destinationQuarter = renderGraph.CreateTexture(descriptor);
passData.destination = destination;
passData.destinationHalf = destinationHalf;
passData.destinationQuarter = destinationQuarter;
// We declare the src texture as an input dependency to this pass, via UseTexture()
builder.UseTexture(passData.source);
// UnsafePasses don't setup the outputs using UseTextureFragment/UseTextureFragmentDepth, you should specify your writes with UseTexture instead
builder.UseTexture(passData.destination, AccessFlags.WriteAll);
builder.UseTexture(passData.destinationHalf, AccessFlags.WriteAll);
builder.UseTexture(passData.destinationQuarter, AccessFlags.WriteAll);
// We disable culling for this pass for the demonstrative purpose of this sample, as normally this pass would be culled,
// since the destination texture is not used anywhere else
builder.AllowPassCulling(false);
// Assign the ExecutePass function to the render pass delegate, which will be called by the render graph when executing the pass
builder.SetRenderFunc((PassData data, UnsafeGraphContext context) => ExecutePass(data, context));
}
}
}
UnsafePass m_UnsafePass;
/// <inheritdoc/>
public override void Create()
{
m_UnsafePass = new UnsafePass();
// Configures where the render pass should be injected.
m_UnsafePass.renderPassEvent = RenderPassEvent.AfterRenderingTransparents;
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(m_UnsafePass);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d3bfdac9be62de0478c6aee44076cd95

View File

@ -233,13 +233,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 64029825}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 16.61, y: -15.86, z: 0}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 23.01954, y: -11.82811, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1252500659}
m_Father: {fileID: 0}
m_Father: {fileID: 267352325}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &64029827
MonoBehaviour:
@ -253,7 +253,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 297bf7fd6271a174194f3ff9950eb487, type: 3}
m_Name:
m_EditorClassIdentifier:
GoblerPreFab: {fileID: 6411951171763069002, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
EnemyPrefabKey: 00000000
EnemyPrefab:
- {fileID: 6411951171763069002, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
EnemySpawnCountForTesting: 05000000
CanStartSpawning: 1
--- !u!1 &92430589 stripped
GameObject:
@ -340,11 +343,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 142887252}
m_CullTransparentMesh: 1
--- !u!50 &164601440 stripped
Rigidbody2D:
m_CorrespondingSourceObject: {fileID: 1203434784585445923, guid: d00d92ab204198c489965b31a298b234, type: 3}
m_PrefabInstance: {fileID: 2316236105731553357}
m_PrefabAsset: {fileID: 0}
--- !u!1 &176512938
GameObject:
m_ObjectHideFlags: 0
@ -454,6 +452,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 64029826}
- {fileID: 2076322256}
- {fileID: 1302188856}
- {fileID: 176512939}
@ -872,66 +871,63 @@ MonoBehaviour:
m_PostInfinity: 2
m_RotationOrder: 4
CustomBlends: {fileID: 0}
--- !u!1 &607039651 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6399305692263416751, guid: d00d92ab204198c489965b31a298b234, type: 3}
m_PrefabInstance: {fileID: 2316236105731553357}
m_PrefabAsset: {fileID: 0}
--- !u!212 &607039654
SpriteRenderer:
--- !u!1001 &584901200
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 607039651}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 651355007
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: -2413806693520163455, guid: ebe73ca9363db456bacf42c025bb4847, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 0.83137256}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalPosition.x
value: -0.6309252
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalPosition.y
value: -0.25825265
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 243343966221896818, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6411951171763069002, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
propertyPath: m_Name
value: Gobler
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6447e7f877b893f46bc4efe1ebc9fe9e, type: 3}
--- !u!1 &646453418
GameObject:
m_ObjectHideFlags: 0
@ -86326,50 +86322,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: Stamina
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: JumpDelay
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: Rigidbody
value:
objectReference: {fileID: 164601440}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: VfxShockwave
value:
objectReference: {fileID: 8992219285309707884, guid: 1f334a9f024858d44b8a3ff8bd31dc97, type: 3}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: DashDecayRate
value: 30
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: DashMultiplier
value: 10
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: VfxKineticSurge
value:
objectReference: {fileID: 4566952472781634859, guid: 0d7c4835b1f550241bb630daef9e33e8, type: 3}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: DashSpeedInitial
value: 200
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: StaminaSliderHud
value:
objectReference: {fileID: 1940124276}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: StaminaRegenPerSecond
value: 20
objectReference: {fileID: 0}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: FighterClass.VfxKineticSurge
value:
objectReference: {fileID: 4566952472781634859, guid: 0d7c4835b1f550241bb630daef9e33e8, type: 3}
- target: {fileID: 1680573792925415762, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: 'ClassIndicators.Array.data[0]'
value:
@ -86386,38 +86342,6 @@ PrefabInstance:
propertyPath: 'ClassIndicators.Array.data[3]'
value:
objectReference: {fileID: 1731397399}
- target: {fileID: 1787569555844345674, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1825172400684165510, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_BodyType
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1825172400684165510, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_ExcludeLayers.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1825172400684165510, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IncludeLayers.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3647552498760287226, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.x
value: 0.96
objectReference: {fileID: 0}
- target: {fileID: 3647552498760287226, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.y
value: 0.8
objectReference: {fileID: 0}
- target: {fileID: 3647552498760287226, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 9128384846270689552, guid: 6068df6a0f8c12a4496df681a7b310c6, type: 3}
- target: {fileID: 3647552498760287226, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_WasSpriteAssigned
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4060073025839678449, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.x
value: -3.64
@ -86458,109 +86382,20 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4613858514893913661, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.y
value: -0.434
objectReference: {fileID: 0}
- target: {fileID: 4673608109423225760, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.x
value: 0.8092319
objectReference: {fileID: 0}
- target: {fileID: 4673608109423225760, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.y
value: 0.33894694
objectReference: {fileID: 0}
- target: {fileID: 4673608109423225760, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Offset.x
value: -0.00097227097
objectReference: {fileID: 0}
- target: {fileID: 5203709406065552287, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.x
value: 0.64
objectReference: {fileID: 0}
- target: {fileID: 5203709406065552287, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.y
value: 0.32
objectReference: {fileID: 0}
- target: {fileID: 7014899162285736705, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: ba58731883bc8cb40be2ed19cc4be25a, type: 2}
- target: {fileID: 7139240040885940656, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_EdgeRadius
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7139240040885940656, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IncludeLayers.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7702329272476180476, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7702329272476180476, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalScale.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7702329272476180476, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.x
value: 0.028
objectReference: {fileID: 0}
- target: {fileID: 7702329272476180476, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.y
value: -1.064
objectReference: {fileID: 0}
- target: {fileID: 8783676367030864381, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IsTrigger
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8783676367030864381, guid: d00d92ab204198c489965b31a298b234, type: 3}
- target: {fileID: 9117212351613092415, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_ExcludeLayers.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8783676367030864381, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IncludeLayers.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9053513097682960937, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_LocalPosition.y
value: -0.195
objectReference: {fileID: 0}
- target: {fileID: 9074809610135348735, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9098681062314285509, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9117212351613092415, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.x
value: 0.84173715
objectReference: {fileID: 0}
- target: {fileID: 9117212351613092415, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Size.y
value: 0.26204228
objectReference: {fileID: 0}
- target: {fileID: 9117212351613092415, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Offset.x
value: -0.00097227097
objectReference: {fileID: 0}
- target: {fileID: 9117212351613092415, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Offset.y
value: -1.0443913
value: 136
objectReference: {fileID: 0}
- target: {fileID: 9147163641451663911, guid: d00d92ab204198c489965b31a298b234, type: 3}
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_RemovedGameObjects:
- {fileID: 4553260134269457595, guid: d00d92ab204198c489965b31a298b234, type: 3}
- {fileID: 9098681062314285509, guid: d00d92ab204198c489965b31a298b234, type: 3}
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 6399305692263416751, guid: d00d92ab204198c489965b31a298b234, type: 3}
insertIndex: -1
addedObject: {fileID: 607039654}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d00d92ab204198c489965b31a298b234, type: 3}
--- !u!1001 &3495966144891276242
PrefabInstance:
@ -86942,4 +86777,4 @@ SceneRoots:
- {fileID: 2316236105731553357}
- {fileID: 1341160148}
- {fileID: 268356502}
- {fileID: 64029826}
- {fileID: 584901200}

View File

@ -7,6 +7,6 @@ using static UnityEditor.PlayerSettings;
namespace AI.Base {
public class EnemyStateManager : MonoBehaviour {
public static EnemyStateManager Instance;
public static List<GoblerStateManager> Goblers = new List<GoblerStateManager>();
public static List<Gobler> Goblers = new List<Gobler>();
}
}

View File

@ -2,11 +2,14 @@
using NUnit.Framework.Internal.Execution;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using UnityEngine;
using UnityEngine.AI;
using static EnemySpawnerData;
public class GoblerStateManager : Alive {
public class Gobler : Alive {
[Header("Mechanics Attributes")]
[SerializeField] public float ChaseDistance = 10f;
[SerializeField] public float ChaseDistanceBuffer = 1f;
@ -28,13 +31,16 @@ public class GoblerStateManager : Alive {
private Vector2 CrystalPos { get { return GameManager.Crystal.transform.position; } }
private GameObject Owner;
private Rigidbody2D Rigidbody;
private Transform MyTransform { get { return Owner.transform; } }
private Vector2 MyPos { get { return MyTransform.position; } set { MyTransform.position = value; } }
private NavMeshAgent PathAgent;
private List<Material> Materials;
public GoblerStateManager(GameObject owner) {
public Gobler(GameObject owner) {
Owner = owner;
PathAgent = Owner.GetComponent<NavMeshAgent>();
PathAgent.updateRotation = false;
@ -44,11 +50,15 @@ public class GoblerStateManager : Alive {
MaxHealth = 100;
CurrentHealth = MaxHealth;
OnTakeDamage += (damage, direction) => SetState(State.TakeDamage);
OnDeath += () => SetState(State.Die);
Rigidbody = Owner.GetComponent<Rigidbody2D>();
Materials = Owner.GetComponentsInChildren<SpriteRenderer>().Select(x => x.material).ToList();
SetState(State.GoToCrystal);
EnemySpawnerManager.UpdateTick += Update;
EnemySpawnerManager.GizmoTick += OnDrawGizmos;
EnemyManagers[Enemies.Gobler].UpdateTick += Update;
EnemyManagers[Enemies.Gobler].GizmoTick += OnDrawGizmos;
}
public float DistFromPlayer { get; private set; }
@ -62,14 +72,15 @@ public class GoblerStateManager : Alive {
AttackCrystal,
ChasePlayer,
AttackPlayer,
Damaged,
TakeDamage,
Die
}
protected void SetPriorityState() {
if (CurrentState == State.AttackPlayer) return;
if (CurrentState == State.ChasePlayer) return;
if (CurrentState == State.Damaged) return;
if (CurrentState == State.TakeDamage) return;
if (CurrentState == State.Die) return;
if (DistFromPlayer > ChaseDistance) return;
SetState(State.ChasePlayer);
@ -88,14 +99,13 @@ public class GoblerStateManager : Alive {
switch (CurrentState) {
case State.None:
SetState(State.GoToCrystal);
break;
case State.GoToCrystal:
PathAgent.SetDestination(CrystalPos);
//if (DistFromCrystal < 1)
// SetState(State.Die);
break;
@ -104,25 +114,28 @@ public class GoblerStateManager : Alive {
case State.ChasePlayer:
//MyPos += (PlayerPos - MyPos).normalized * Speed * Time.deltaTime;
PathAgent.SetDestination(PlayerPos);
if (DistFromPlayer > ChaseDistance + ChaseDistanceBuffer)
SetState(State.GoToCrystal);
//else if (DistFromPlayer < 1)
// SetState(State.Die);
if (DistFromPlayer > ChaseDistance + ChaseDistanceBuffer)
SetState(State.GoToCrystal);
else
PathAgent.SetDestination(PlayerPos);
break;
case State.AttackPlayer:
break;
case State.Damaged:
case State.TakeDamage:
Rigidbody.linearVelocity = DirectionOfDamage * 100 * InvincibilityLeft;
Materials.ForEach(x => x.SetFloat("_FlashAmount", InvincibilityLeft));
if (!IsInvincible) SetState(State.None);
break;
case State.Die:
EnemySpawnerManager.RemoveGobler(Owner);
EnemySpawnerManager.DestroyEnemy(Owner, Enemies.Gobler);
SetState(State.None);
break;
@ -133,10 +146,12 @@ public class GoblerStateManager : Alive {
}
protected void SetState(State newState) {
CurrentState = newState;
switch (CurrentState) {
case State.None:
PathAgent.isStopped = false;
break;
@ -156,7 +171,9 @@ public class GoblerStateManager : Alive {
break;
case State.Damaged:
case State.TakeDamage:
PathAgent.isStopped = true;
Materials.ForEach(x => x.SetColor("_FlashColor", Color.white));
break;
@ -169,7 +186,6 @@ public class GoblerStateManager : Alive {
protected void OnDrawGizmos() {
if (Owner == null) return;
@ -178,8 +194,11 @@ public class GoblerStateManager : Alive {
DrawAttackReach();
}
private void DrawWireSphere(Color color, Vector2 center, float radius) => EnemyManagers[Enemies.Gobler].DrawWireSphere(color, center, radius);
private void DrawChaseDistance() {
EnemySpawnerManager.DrawWireSphere(Color.green, MyPos, ChaseDistance);
DrawWireSphere(Color.green, MyPos, ChaseDistance);
}
private void DrawAttackDistance() {
@ -190,39 +209,44 @@ public class GoblerStateManager : Alive {
private void DrawAttackReach() {
//if (CurrentState != (IState)AttackState) return;
Gizmos.color = Color.red;
//Gizmos.color = Color.red;
Vector2 direction2D = (PlayerPos - MyPos).normalized;
Vector2 point2D = MyPos + direction2D * AttackDistance;
//Gizmos.DrawWireSphere(point2D, AttackMaskDiameter);
EnemySpawnerManager.DrawWireSphere(Color.red, point2D, AttackMaskDiameter);
DrawWireSphere(Color.red, point2D, AttackMaskDiameter);
}
}
public class Alive {
public int MaxHealth { get; protected set; }
public int CurrentHealth { get; protected set; }
public bool IsDead => CurrentHealth <= 0;
public bool IsInvincible => Time.time < invincibleUntil;
protected float invincibleUntil = 0f;
protected float invincibilityDuration = 1f;
public bool IsInvincible => Time.time < InvincibleUntil;
protected float InvincibleUntil = 0f;
protected float InvincibilityLeft => Math.Max(0, InvincibleUntil - Time.time);
protected float InvincibilityDuration = 0.2f;
public event Action<int, Vector2> OnTakeDamage;
public event Action OnDeath;
public event Action<int> OnHeal;
protected int DamageTaken;
protected Vector2 DirectionOfDamage;
public void TakeDamage(int amount, Vector2 hitDirection) {
if (IsDead || IsInvincible) return;
CurrentHealth -= amount;
CurrentHealth = Mathf.Max(CurrentHealth, 0);
invincibleUntil = Time.time + invincibilityDuration;
InvincibleUntil = Time.time + InvincibilityDuration;
DamageTaken = amount;
hitDirection = hitDirection.normalized;
if (hitDirection == Vector2.zero) hitDirection = Vector2.up;
DirectionOfDamage = hitDirection;
OnTakeDamage?.Invoke(amount, hitDirection);
if (CurrentHealth == 0) OnDeath?.Invoke();
@ -238,6 +262,6 @@ public class Alive {
public void Reset() {
CurrentHealth = MaxHealth;
invincibleUntil = 0f;
InvincibleUntil = 0f;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 25cbd57f9b1673e41934e4fe6d8c6067

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: a5c89455bac58d943a2e1e110d37a24d

View File

@ -102,6 +102,7 @@ public class ClassBase {
if (AttackCoroutine != null)
Player.Instance.StopCoroutine(AttackCoroutine);
var center = PlayerPos + Player.PrevDirection * centerOffset;
hitDelay = 0;
AttackCoroutine = Player.Instance.StartCoroutine(CreateHitBoxHelper(center, radius, hitDelay, hitDuration));
}

View File

@ -71,8 +71,8 @@ public class MeleeFighterClass : ClassBase {
case AttackState.BasicAttack3:
if (ComboTimeElapsed <= 0.1) break;
ChangeState(AttackState.KineticSurgeRelease);
AttackAnimator.MeleeResetKineticCharge();
AttackAnimator.MeleeKineticSurge();
AttackAnimator?.MeleeResetKineticCharge();
AttackAnimator?.MeleeKineticSurge();
AnimationToPlay = "Attack1";
TextPopUp.SpawnFloatingText("KineticSurge", Color.red, 3);
AllowBladeVortex = ComboTimeElapsed <= 0.1f;
@ -97,7 +97,7 @@ public class MeleeFighterClass : ClassBase {
if (!ChargingAnAttack && TimesUp || Player.IsJumping) {
Player.MoveSpeedDampener = 1;
ChangeState(AttackState.None);
AttackAnimator.MeleeResetKineticCharge();
AttackAnimator?.MeleeResetKineticCharge();
Player.SkillInUse = false;
}
}
@ -231,19 +231,19 @@ public class MeleeFighterClass : ClassBase {
case AttackState.BasicAttack1:
AnimationToPlay = "Attack1";
AttackAnimator.MeleeBasic(1);
AttackAnimator?.MeleeBasic(1);
CreateHitBoxOffset(2, 3, 0.1f, 0.1f);
break;
case AttackState.BasicAttack2:
AnimationToPlay = "Attack2";
AttackAnimator.MeleeBasic(2);
AttackAnimator?.MeleeBasic(2);
CreateHitBoxOffset(2, 3, 0.1f, 0.1f);
break;
case AttackState.BasicAttack3:
AnimationToPlay = "Attack1";
AttackAnimator.MeleeBasic(3);
AttackAnimator?.MeleeBasic(3);
CreateHitBoxOffset(2, 3, 0.1f, 0.1f);
break;

View File

@ -203,7 +203,8 @@ public class Player : MonoBehaviour {
if (!hit.CompareTag("EnemyHurtBox")) continue;
GameObject parent = hit.transform.parent?.gameObject;
EnemySpawnerData.Goblers[parent].TakeDamage(30, transform.position - parent.transform.position);
//EnemySpawnerData.EnemyMap[parent].TakeDamage(0, transform.position - parent.transform.position);
EnemySpawnerData.EnemyMap[parent].TakeDamage(0, PrevDirection);
}
}

View File

@ -1,42 +1,55 @@
using AI.Base;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UIElements;
using static EnemySpawnerManager;
using static EnemySpawnerData;
using static UnityEngine.EventSystems.EventTrigger;
public class EnemySpawnerManager : MonoBehaviour {
public static EnemySpawnerManager Instance;
public static Action UpdateTick;
public static Action GizmoTick;
[SerializeField] public GameObject GoblerPreFab;
private GameObjectPool GoblerPool;
[SerializeField] public List<Enemies> EnemyPrefabKey;
[SerializeField] public List<GameObject> EnemyPrefab;
[SerializeField] public List<int> EnemySpawnCountForTesting;
[SerializeField] public bool CanStartSpawning = true;
private Dictionary<Enemies, int> PrefabIndex = new Dictionary<Enemies, int>();
private Dictionary<Enemies, int> EnemySpawnCountForTestingDict = new Dictionary<Enemies, int>();
private List<Enemies> ListOfEnemies;
public class Gobler {
public GameObject Object;
public GoblerStateManager Manager;
public Gobler(GameObject obj, GoblerStateManager manager) {
Object = obj;
Manager = manager;
}
}
public void Awake() {
Instance = this;
EnemySpawnerData.Goblers.Clear();
GoblerPool = new GameObjectPool(GoblerPreFab, 50, 200);
for (int i = 0; i < EnemyPrefabKey.Count; i++) {
PrefabIndex.Add(EnemyPrefabKey[i], i);
EnemySpawnCountForTestingDict.Add(EnemyPrefabKey[i], EnemySpawnCountForTesting[i]);
}
//ListOfEnemies = Enum.GetValues(typeof(Enemies)).Cast<Enemies>().ToList();
ListOfEnemies = EnemyPrefabKey;
Owner = this.GameObject();
RestartData();
foreach (var enemy in ListOfEnemies) {
InitializeEnemyData(enemy, EnemyPrefab[PrefabIndex[enemy]]);
ApplyInitialTestSpawnIfApplicable(enemy);
}
}
public static void RemoveGobler(GameObject gameObject) {
private void ApplyInitialTestSpawnIfApplicable(Enemies enemy) {
if (!EnemySpawnCountForTestingDict.ContainsKey(enemy)) return;
MaxSpawnCount[enemy] = EnemySpawnCountForTestingDict[enemy];
}
public static void DestroyEnemy(GameObject gameObject, Enemies enemy) {
Destroy(gameObject);
EnemySpawnerData.Goblers.Remove(gameObject);
CurrentSpawnCount[enemy]--;
}
public void Update() {
@ -47,14 +60,20 @@ public class EnemySpawnerManager : MonoBehaviour {
public void StartSpawning() {
if (!CanStartSpawning) return;
while (EnemySpawnerData.Goblers.Count() < EnemySpawnerData.MaxGoblers) {
var gobler = GoblerPool.Get(transform.position, Quaternion.identity);
EnemySpawnerData.Goblers.Add(gobler, new GoblerStateManager(gobler));
}
foreach (var enemy in ListOfEnemies)
while (CurrentSpawnCount[enemy] < MaxSpawnCount[enemy]) {
var enemyObject = EnemyGameObjectPools[enemy].Get(transform.position, Quaternion.identity);
var enemyScript = new Gobler(enemyObject);
EnemyMap.Add(enemyObject, enemyScript);
CurrentSpawnCount[enemy]++;
}
CanStartSpawning = false;
}
public void OnDrawGizmos() {
GizmoTick?.Invoke();
}
@ -65,7 +84,57 @@ public class EnemySpawnerManager : MonoBehaviour {
}
}
public static class EnemySpawnerData {
public static Dictionary<GameObject, GoblerStateManager> Goblers = new Dictionary<GameObject, GoblerStateManager>();
public static int MaxGoblers = 100;
public class EnemyManager : MonoBehaviour {
public Action UpdateTick;
public Action GizmoTick;
public void Update() {
UpdateTick?.Invoke();
}
public void OnDrawGizmos() {
GizmoTick?.Invoke();
}
public void DrawWireSphere(Color color, Vector3 center, float radius) {
Gizmos.color = color;
Gizmos.DrawWireSphere(center, radius);
}
}
public static class EnemySpawnerData {
public enum Enemies {
Gobler,
}
public static GameObject Owner;
public static Dictionary<Enemies, GameObject> ObjectPrefabs = new Dictionary<Enemies, GameObject>();
public static Dictionary<Enemies, GameObjectPool> EnemyGameObjectPools = new Dictionary<Enemies, GameObjectPool>();
public static Dictionary<Enemies, EnemyManager> EnemyManagers = new Dictionary<Enemies, EnemyManager>();
public static Dictionary<Enemies, int> MaxSpawnCount = new Dictionary<Enemies, int>();
public static Dictionary<Enemies, int> CurrentSpawnCount = new Dictionary<Enemies, int>();
public static Dictionary<GameObject, Alive> EnemyMap = new Dictionary<GameObject, Alive>();
public static void RestartData() {
ObjectPrefabs = new Dictionary<Enemies, GameObject>();
EnemyGameObjectPools = new Dictionary<Enemies, GameObjectPool>();
EnemyManagers = new Dictionary<Enemies, EnemyManager>();
MaxSpawnCount = new Dictionary<Enemies, int>();
CurrentSpawnCount = new Dictionary<Enemies, int>();
EnemyMap = new Dictionary<GameObject, Alive>();
}
public static void InitializeEnemyData(Enemies enemy, GameObject prefab) {
EnemyGameObjectPools.Add(enemy, new GameObjectPool(prefab, 50, 200));
EnemyManagers.Add(enemy, Owner.AddComponent<EnemyManager>());
MaxSpawnCount.Add(enemy, 0);
CurrentSpawnCount.Add(enemy, 0);
}
//public static Dictionary<GameObject, Gobler> Goblers = new Dictionary<GameObject, Gobler>();
//public static int MaxGoblers = 100;
}

8
Assets/Shaders.meta Normal file
View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 25dc0689c13a49f46a6126510b2a6c15
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,77 @@
%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: DamageFlashMat
m_Shader: {fileID: -6465566751694194690, guid: 25dc0689c13a49f46a6126510b2a6c15, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex2:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Texture2D:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _FlashAmount: 0
m_Colors:
- _FlashColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &8384475329286551399
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

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

8
Assets/TextMesh Pro.meta Normal file
View File

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

View File

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

View File

@ -0,0 +1,46 @@
Digitized data copyright (c) 2010 Google Corporation
with Reserved Font Arimo, Tinos and Cousine.
Copyright (c) 2012 Red Hat, Inc.
with Reserved Font Name Liberation.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6e59c59b81ab47f9b6ec5781fa725d2c
timeCreated: 1484171296
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e3265ab4bf004d28a9537516768c1c75
timeCreated: 1484171297
licenseType: Pro
TrueTypeFontImporter:
serializedVersion: 2
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
use2xBehaviour: 0
fontNames: []
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 731f1baa9d144a9897cb1d341c2092b8
folderAsset: yes
timeCreated: 1442040525
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,106 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF - Drop Shadow
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords: OUTLINE_ON UNDERLAY_ON
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FaceTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
- _BevelClamp: 0
- _BevelOffset: 0
- _BevelRoundness: 0
- _BevelWidth: 0
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _Diffuse: 0.5
- _DiffusePower: 1
- _FaceDilate: 0.1
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlowInner: 0.05
- _GlowOffset: 0
- _GlowOuter: 0.05
- _GlowPower: 0.75
- _GradientScale: 10
- _LightAngle: 3.1416
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0.1
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.64125
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _SpecularPower: 2
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 1024
- _TextureWidth: 1024
- _UnderlayDilate: 0
- _UnderlayOffsetX: 0.5
- _UnderlayOffsetY: -0.5
- _UnderlaySoftness: 0.05
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 0.75
- _WeightNormal: 0
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e73a58f6e2794ae7b1b7e50b7fb811b0
timeCreated: 1484172806
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,348 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2180264
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Material
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
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}
- _FaceTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 28268798066460806}
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}
- _OutlineTex:
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_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
- _BevelClamp: 0
- _BevelOffset: 0
- _BevelRoundness: 0
- _BevelWidth: 0
- _BumpFace: 0
- _BumpOutline: 0
- _BumpScale: 1
- _ColorMask: 15
- _CullMode: 0
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _Diffuse: 0.5
- _DstBlend: 0
- _FaceDilate: 0
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _GlowInner: 0.05
- _GlowOffset: 0
- _GlowOuter: 0.05
- _GlowPower: 0.75
- _GradientScale: 10
- _LightAngle: 3.1416
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _Parallax: 0.02
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.90909094
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.7386364
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SpecularPower: 2
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 512
- _TextureWidth: 512
- _UVSec: 0
- _UnderlayDilate: 0
- _UnderlayOffsetX: 0
- _UnderlayOffsetY: 0
- _UnderlaySoftness: 0
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 0.75
- _WeightNormal: 0
- _ZWrite: 1
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
--- !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: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
m_Name: LiberationSans SDF - Fallback
m_EditorClassIdentifier:
m_Version: 1.1.0
m_Material: {fileID: 2180264}
m_SourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
m_SourceFontFile: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
m_AtlasPopulationMode: 1
InternalDynamicOS: 0
m_FaceInfo:
m_FaceIndex: 0
m_FamilyName: Liberation Sans
m_StyleName: Regular
m_PointSize: 86
m_Scale: 1
m_UnitsPerEM: 2048
m_LineHeight: 98.8916
m_AscentLine: 77.853516
m_CapLine: 59
m_MeanLine: 45
m_Baseline: 0
m_DescentLine: -18.22461
m_SuperscriptOffset: 77.853516
m_SuperscriptSize: 0.5
m_SubscriptOffset: -18.22461
m_SubscriptSize: 0.5
m_UnderlineOffset: -12.261719
m_UnderlineThickness: 6.298828
m_StrikethroughOffset: 18
m_StrikethroughThickness: 6.298828
m_TabWidth: 24
m_GlyphTable: []
m_CharacterTable: []
m_AtlasTextures:
- {fileID: 28268798066460806}
m_AtlasTextureIndex: 0
m_IsMultiAtlasTexturesEnabled: 1
m_ClearDynamicDataOnBuild: 1
m_UsedGlyphRects: []
m_FreeGlyphRects:
- m_X: 0
m_Y: 0
m_Width: 511
m_Height: 511
m_fontInfo:
Name: Liberation Sans
PointSize: 86
Scale: 1
CharacterCount: 250
LineHeight: 98.90625
Baseline: 0
Ascender: 77.84375
CapHeight: 59.1875
Descender: -18.21875
CenterLine: 0
SuperscriptOffset: 77.84375
SubscriptOffset: -12.261719
SubSize: 0.5
Underline: -12.261719
UnderlineThickness: 6.298828
strikethrough: 23.675
strikethroughThickness: 0
TabWidth: 239.0625
Padding: 9
AtlasWidth: 1024
AtlasHeight: 1024
atlas: {fileID: 0}
m_AtlasWidth: 512
m_AtlasHeight: 512
m_AtlasPadding: 9
m_AtlasRenderMode: 4169
m_glyphInfoList: []
m_KerningTable:
kerningPairs: []
m_FontFeatureTable:
m_MultipleSubstitutionRecords: []
m_LigatureSubstitutionRecords: []
m_GlyphPairAdjustmentRecords: []
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
fallbackFontAssets: []
m_FallbackFontAssetTable: []
m_CreationSettings:
sourceFontFileName:
sourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
faceIndex: 0
pointSizeSamplingMode: 0
pointSize: 86
padding: 9
paddingMode: 0
packingMode: 4
atlasWidth: 512
atlasHeight: 512
characterSetSelectionMode: 1
characterSequence: 32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633
referencedFontAssetGUID: 8f586378b4e144a9851e7b34d9b748ee
referencedTextAssetGUID:
fontStyle: 0
fontStyleModifier: 0
renderMode: 4169
includeFontFeatures: 1
m_FontWeightTable:
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
fontWeights:
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
- regularTypeface: {fileID: 0}
italicTypeface: {fileID: 0}
normalStyle: 0
normalSpacingOffset: 0
boldStyle: 0.75
boldSpacing: 7
italicStyle: 35
tabSize: 10
--- !u!28 &28268798066460806
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Atlas
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 1
m_MipCount: 1
m_IsReadable: 1
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 1
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e498d1c8094910479dc3e1b768306a4
timeCreated: 1484171803
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,104 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF - Outline
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords: OUTLINE_ON
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FaceTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
- _BevelClamp: 0
- _BevelOffset: 0
- _BevelRoundness: 0
- _BevelWidth: 0
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _Diffuse: 0.5
- _FaceDilate: 0.1
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlowInner: 0.05
- _GlowOffset: 0
- _GlowOuter: 0.05
- _GlowPower: 0.75
- _GradientScale: 10
- _LightAngle: 3.1416
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0.1
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.64125
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _SpecularPower: 2
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 1024
- _TextureWidth: 1024
- _UnderlayDilate: 0
- _UnderlayOffsetX: 0
- _UnderlayOffsetY: 0
- _UnderlaySoftness: 0
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 0.75
- _WeightNormal: 0
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 79459efec17a4d00a321bdcc27bbc385
timeCreated: 1484172856
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

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