Add AIServer, character art pipeline, and Art package boot integration.
Bring in MaleExplorer assets/shaders, model tooling and Hunyuan updates, plus boot/YooAsset Art package support. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,7 @@ namespace AOT.Boot
|
||||
public string CdnRoot;
|
||||
public string PackageName;
|
||||
public ResourcePackage Package;
|
||||
public string HttpBase;
|
||||
public string WsUrlTemplate;
|
||||
|
||||
public string BuildWsUrl(string pid, string token = null)
|
||||
|
||||
@@ -66,6 +66,11 @@ namespace AOT.Boot
|
||||
_view?.SetProgress(1f);
|
||||
_view?.SetStatus("热更已启动");
|
||||
Debug.Log($"[Boot] OK app={ctx.AppVersion} res={ctx.ResVersion} cdn={ctx.CdnRoot}");
|
||||
|
||||
// 让热更侧完成首帧生成后再撤掉全屏启动遮罩
|
||||
yield return null;
|
||||
yield return null;
|
||||
_view?.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ namespace AOT.Boot
|
||||
[Tooltip("热更 DLL 在包内的定位地址")]
|
||||
public string HotUpdateDllLocation = "HotUpdate.Runtime";
|
||||
|
||||
[Tooltip("登录服 HTTP 根(/register /login)")]
|
||||
public string HttpBase = "https://game.xworld.ren";
|
||||
|
||||
[Tooltip("WebSocket 模板,{pid}/{token} 会被替换")]
|
||||
public string WsUrlTemplate = "wss://game.xworld.ren/ws?pid={pid}&token={token}";
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace AOT.Patch
|
||||
ResVersion = version.resVersion,
|
||||
CdnRoot = cdnRoot,
|
||||
PackageName = _settings.PackageName,
|
||||
HttpBase = _settings.HttpBase,
|
||||
WsUrlTemplate = _settings.WsUrlTemplate,
|
||||
};
|
||||
|
||||
|
||||
@@ -104,6 +104,16 @@ namespace AOT.UI
|
||||
_fill.color = new Color(0.85f, 0.3f, 0.3f, 1f);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void DestroyUi()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
static GameObject CreateUiObject(string name, Transform parent)
|
||||
{
|
||||
var go = new GameObject(name, typeof(RectTransform));
|
||||
|
||||
@@ -38,3 +38,25 @@ MonoBehaviour:
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags: aot
|
||||
UserData:
|
||||
- PackageName: Art
|
||||
PackageDesc: "\u89D2\u8272/\u573A\u666F\u7F8E\u672F"
|
||||
EnableAddressable: 1
|
||||
SupportExtensionless: 1
|
||||
LocationToLower: 0
|
||||
IncludeAssetGUID: 0
|
||||
AutoCollectShaders: 1
|
||||
IgnoreRuleName: NormalIgnoreRule
|
||||
Groups:
|
||||
- GroupName: Characters
|
||||
GroupDesc:
|
||||
AssetTags: art
|
||||
ActiveRuleName: EnableGroup
|
||||
Collectors:
|
||||
- CollectPath: Assets/Bundles/Characters
|
||||
CollectorGUID: 9022903d083ef5e48a260c7146d9c3d0
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackDirectory
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags: art
|
||||
UserData:
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9022903d083ef5e48a260c7146d9c3d0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5de8b303c51073744b95736c9efa04cc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,109 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e7306923b3941041b15fc08a96215f4
|
||||
ModelImporter:
|
||||
serializedVersion: 22200
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 0
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
removeConstantScaleCurves: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 2
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importPhysicalCameras: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
nodeNameCollisionStrategy: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
bakeAxisConversion: 0
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
optimizeBones: 1
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVMarginMethod: 1
|
||||
secondaryUVMinLightmapResolution: 40
|
||||
secondaryUVMinObjectScale: 1
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
strictVertexDataChecks: 0
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 0
|
||||
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||
importBlendShapeDeformPercent: 1
|
||||
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,135 @@
|
||||
%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: MaleExplorer
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _METALLICSPECGLOSSMAP
|
||||
- _NORMALMAP
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 2800000, guid: c579bc2bc4f3d1d4ca6357e196647a1c, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 2800000, guid: bf759bb4be79da040a36f6323376395f, type: 3}
|
||||
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: 2800000, guid: c579bc2bc4f3d1d4ca6357e196647a1c, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 2800000, guid: ff662381d729e41439bba157f4fd986e, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 2800000, guid: 677ccffc54808d74ca91daefb7ff4d82, type: 3}
|
||||
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:
|
||||
- _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.45
|
||||
- _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: []
|
||||
--- !u!114 &2338677793862294356
|
||||
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: 7
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35936ffb5462d8540b0cac78a2667a68
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,166 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4818435621640061303
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 671829433351447729}
|
||||
- component: {fileID: 5968824582601252609}
|
||||
- component: {fileID: 8346968313850684562}
|
||||
m_Layer: 0
|
||||
m_Name: ShadowDisc
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &671829433351447729
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4818435621640061303}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.02, z: 0}
|
||||
m_LocalScale: {x: 0.7, y: 0.015, z: 0.7}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7751142206369119175}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5968824582601252609
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4818435621640061303}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &8346968313850684562
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4818435621640061303}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 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: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1001 &7789872454374415404
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1.6454926
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1.6454926
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1.6454926
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071067
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -7511558181221131132, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_Materials.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 35936ffb5462d8540b0cac78a2667a68, type: 2}
|
||||
- target: {fileID: 919132149155446097, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: MaleExplorer
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 671829433351447729}
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
--- !u!4 &7751142206369119175 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 4e7306923b3941041b15fc08a96215f4, type: 3}
|
||||
m_PrefabInstance: {fileID: 7789872454374415404}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed5026598de73104fbe7b7b800be4c69
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 677ccffc54808d74ca91daefb7ff4d82
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.9 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c579bc2bc4f3d1d4ca6357e196647a1c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff662381d729e41439bba157f4fd986e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf759bb4be79da040a36f6323376395f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 1
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9a7df2df44db4d48911507f73af520e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -0,0 +1,153 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cc915e55ce2c8945ba546d42029a5be
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bf2ea9f18173e349a1d79eadbc7b486
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0575d8260b338e84aacc3f29aab3cc72
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2579b7f8d4760cf479310562e005a7b4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ebefd2fae1b32d488e2acd694285b30
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0ed5e8d619c68a4fb7a5375f27dc6d8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 614b6a9d6d273944b9fd0edf5139f5ee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c47d37ac743dcb46a06ff644f139c36
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,216 @@
|
||||
Shader "Test/XPbr"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[MainColor] _BaseColor("Color", Color) = (1,1,1,1)
|
||||
[MainTexture] _MainTex("Base (RGB:Albedo A:Alpha/AO)", 2D) = "white" {}
|
||||
_MixTex("Mix (RG:Normal B:Metallic A:Roughness)", 2D) = "white" {}
|
||||
|
||||
// 勾选:A 通道当透明(AlphaTest 裁剪);不勾选:A 通道当 AO
|
||||
[Toggle(_ALPHATEST_ON)] _AlphaTest("Alpha As Transparency (Clip)", Float) = 0
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
_Metallic("Metallic", Range(0.0, 1.0)) = 0.8
|
||||
_Roughness("Roughness", Range(0.0, 1.0)) = 0.6
|
||||
_AO("AO", Range(0.0, 1.0)) = 1.0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags{ "LightMode" = "UniversalForward" }
|
||||
|
||||
ZWrite on
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard SRP library
|
||||
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XPbr_Base.hlsl"
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
|
||||
|
||||
// normalWS and tangentWS already normalize.
|
||||
// this is required to avoid skewing the direction during interpolation
|
||||
// also required for per-vertex lighting and SH evaluation
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS, input.tangentOS);
|
||||
|
||||
half3 vertexLight = VertexLighting(vertexInput.positionWS, normalInput.normalWS);
|
||||
|
||||
half fogFactor = 0;
|
||||
#if !defined(_FOG_FRAGMENT)
|
||||
fogFactor = ComputeFogFactor(vertexInput.positionCS.z);
|
||||
#endif
|
||||
|
||||
half3 viewDirWS = GetCameraPositionWS() - vertexInput.positionWS;
|
||||
output.normalWS = half4(normalInput.normalWS, viewDirWS.x);
|
||||
output.tangentWS = half4(normalInput.tangentWS, viewDirWS.y);
|
||||
output.bitangentWS = half4(normalInput.bitangentWS, viewDirWS.z);
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
output.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
output.positionWS = vertexInput.positionWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
output.positionCS = vertexInput.positionCS;
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _MainTex);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
// 基础贴图:rgb 漫反射,a 透明或 AO(由 _ALPHATEST_ON 决定语义)
|
||||
half4 albedoAlpha = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv);
|
||||
// 混合贴图:rg 压缩法线,b 金属度,a 粗糙度
|
||||
half4 mixTex = SAMPLE_TEXTURE2D(_MixTex, sampler_MixTex, input.uv);
|
||||
|
||||
#if defined(_ALPHATEST_ON)
|
||||
clip(albedoAlpha.a - _Cutoff);
|
||||
half occlusion = 1.0;
|
||||
half alpha = albedoAlpha.a;
|
||||
#else
|
||||
half occlusion = lerp(1.0, albedoAlpha.a, _AO);
|
||||
half alpha = 1.0;
|
||||
#endif
|
||||
|
||||
half3 normalTS = DecodeSphereMap(mixTex.rg);
|
||||
half3 normalWS = TransformTangentToWorld(normalTS,
|
||||
half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
|
||||
SurfaceData surfaceData = (SurfaceData)0;
|
||||
surfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
|
||||
surfaceData.metallic = saturate(mixTex.b * _Metallic);
|
||||
surfaceData.smoothness = 1.0 - saturate(mixTex.a * _Roughness);
|
||||
surfaceData.alpha = alpha;
|
||||
surfaceData.normalTS = normalTS;
|
||||
surfaceData.specular = half3(0.0, 0.0, 0.0);
|
||||
surfaceData.emission = half3(0.0, 0.0, 0.0);
|
||||
surfaceData.occlusion = occlusion;
|
||||
surfaceData.clearCoatMask = half(0.0);
|
||||
surfaceData.clearCoatSmoothness = half(0.0);
|
||||
|
||||
InputData inputData;
|
||||
input.normalWS.rgb = normalWS;//法线需要传入
|
||||
InitializeInputData(input, surfaceData.normalTS, inputData);
|
||||
|
||||
half4 color = UniversalFragmentPBR(inputData, surfaceData);
|
||||
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
return color;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags{ "LightMode" = "ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard srp library
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XPbr_Base.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
|
||||
float3 _LightDirection;
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
|
||||
|
||||
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, _LightDirection));
|
||||
|
||||
#if UNITY_REVERSED_Z
|
||||
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
|
||||
output.positionCS = positionCS;
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _MainTex);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_TARGET
|
||||
{
|
||||
#if defined(_ALPHATEST_ON)
|
||||
half alpha = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv).a;
|
||||
clip(alpha - _Cutoff);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cab897163f45445fa34263d6670bfc9e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
- _MixTex: {instanceID: 0}
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,145 @@
|
||||
#ifndef XPBR_LIT_BASE
|
||||
#define XPBR_LIT_BASE
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _MainTex_ST;
|
||||
half4 _BaseColor;
|
||||
half _Cutoff;
|
||||
half _Metallic;
|
||||
half _Roughness;
|
||||
half _AO;
|
||||
CBUFFER_END
|
||||
half _XRuntimeAmbientEnabled;
|
||||
half4 _XRuntimeAmbientSky;
|
||||
half4 _XRuntimeAmbientEquator;
|
||||
half4 _XRuntimeAmbientGround;
|
||||
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
TEXTURE2D(_MixTex); SAMPLER(sampler_MixTex);
|
||||
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(staticLightmapUV, vertexSH, 1);
|
||||
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
float4 positionCS : SV_POSITION;
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD8;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
//解码 RG 两通道球面映射压缩法线(有符号,ModelTranslator 工具编码:enc = n.xy/sqrt(2*(1+n.z)) * 0.5 + 0.5)
|
||||
float3 DecodeSphereMap(float2 encoded)
|
||||
{
|
||||
encoded = encoded * 2.0 - 1.0; //rg 无符号存储,重映射回有符号
|
||||
float4 nn = float4(encoded, 1, -1);
|
||||
float l = dot(nn.xyz, -nn.xyw);
|
||||
nn.z = l;
|
||||
nn.xy *= sqrt(l);
|
||||
return nn.xyz * 2 + float3(0, 0, -1);
|
||||
}
|
||||
|
||||
half3 SampleXRuntimeAmbient(half3 normalWS)
|
||||
{
|
||||
half y = normalize(normalWS).y;
|
||||
half useGlobal = step(0.5h, _XRuntimeAmbientEnabled);
|
||||
half3 sky = lerp(half3(1.353h, 1.452h, 1.568h), _XRuntimeAmbientSky.rgb, useGlobal);
|
||||
half3 equator = lerp(half3(1.023h, 1.122h, 1.254h), _XRuntimeAmbientEquator.rgb, useGlobal);
|
||||
half3 ground = lerp(half3(0.561h, 0.528h, 0.462h), _XRuntimeAmbientGround.rgb, useGlobal);
|
||||
half3 upper = lerp(equator, sky, saturate(y));
|
||||
half3 lower = lerp(equator, ground, saturate(-y));
|
||||
return lerp(lower, upper, step(0.0h, y));
|
||||
}
|
||||
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData)
|
||||
{
|
||||
inputData = (InputData)0;
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
// 法线已在 frag 中经 TBN 转换到世界空间后写回 input.normalWS
|
||||
inputData.normalWS = input.normalWS.xyz;
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactor);
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#elif defined(LIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#else
|
||||
inputData.bakedGI = SampleSH(inputData.normalWS);
|
||||
#endif
|
||||
// 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图,
|
||||
// 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光)
|
||||
if (_XRuntimeAmbientEnabled > 0.5h)
|
||||
inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS);
|
||||
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
|
||||
#if defined(DEBUG_DISPLAY)
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.dynamicLightmapUV = input.dynamicLightmapUV;
|
||||
#endif
|
||||
#if defined(LIGHTMAP_ON)
|
||||
inputData.staticLightmapUV = input.staticLightmapUV;
|
||||
#else
|
||||
inputData.vertexSH = input.vertexSH;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eca966a3db5d4e8aaa2b324e0dfc9f92
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,322 @@
|
||||
Shader "XWorld/XTerrain"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
// 四层颜色贴图
|
||||
_LayerTex0 ("Layer 0 (R)", 2D) = "white" {}
|
||||
_LayerTex1 ("Layer 1 (G)", 2D) = "white" {}
|
||||
_LayerTex2 ("Layer 2 (B)", 2D) = "white" {}
|
||||
_LayerTex3 ("Layer 3 (A)", 2D) = "white" {}
|
||||
// 混合贴图(RGBA 分别对应四层权重)
|
||||
_Control ("Control (RGBA)", 2D) = "white" {}
|
||||
_Tiling ("Tiling", Float) = 20
|
||||
|
||||
_BumpScale("BumpScale", Range(0.0, 10)) = 5
|
||||
_Roughness("Roughness", Range(0.0, 2.0)) = 0.3
|
||||
_Metallic("Metallic", Range(0.0, 2.0)) = 0.3
|
||||
_AO("AO", Range(0.0, 3.0)) = 1.0
|
||||
//_EmissiveIntensity("EmissiveIntensity", Range(0.0, 2.0)) = 0.3
|
||||
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
|
||||
// this Subshader will fail. One can add a subshader below or fallback to Standard built-in to make this
|
||||
// material work with both Universal Render Pipeline and Builtin Unity Pipeline
|
||||
Tags{ "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
|
||||
Pass
|
||||
{
|
||||
// Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
|
||||
// no LightMode tag are also rendered by Universal Render Pipeline
|
||||
Name "ForwardLit"
|
||||
Tags{ "LightMode" = "UniversalForward" }
|
||||
|
||||
ZWrite on
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard SRP library
|
||||
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile _ _MIXTEX_ON
|
||||
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XTerrain_Base.hlsl"
|
||||
|
||||
// 声明纹理和采样器
|
||||
|
||||
|
||||
struct AttData
|
||||
{
|
||||
float3 normal;
|
||||
float ao;//获得夹角越狭窄越强
|
||||
float roughness;//周围高度差越多,越粗糙;颜色越相同越低;
|
||||
float metallic;//使用平均亮度值
|
||||
};
|
||||
float3 _LightDirection;
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
|
||||
|
||||
// normalWS and tangentWS already normalize.
|
||||
// this is required to avoid skewing the direction during interpolation
|
||||
// also required for per-vertex lighting and SH evaluation
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS, input.tangentOS);
|
||||
|
||||
half3 vertexLight = VertexLighting(vertexInput.positionWS, normalInput.normalWS);
|
||||
|
||||
half fogFactor = 0;
|
||||
#if !defined(_FOG_FRAGMENT)
|
||||
fogFactor = ComputeFogFactor(vertexInput.positionCS.z);
|
||||
#endif
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _LayerTex0);
|
||||
|
||||
// already normalized from normal transform to WS.
|
||||
// half3 viewDirWS = GetWorldSpaceNormalizeViewDir(vertexInput.positionWS);
|
||||
// output.normalWS = half4(normalInput.normalWS, viewDirWS.x);//normalInput.normalWS;//
|
||||
//#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR) || defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
// real sign = input.tangentOS.w * GetOddNegativeScale();
|
||||
// half4 tangentWS = half4(normalInput.tangentWS.xyz, sign);
|
||||
//#endif
|
||||
//#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
// output.tangentWS = tangentWS;
|
||||
//#endif
|
||||
half3 viewDirWS = GetCameraPositionWS() - vertexInput.positionWS;
|
||||
output.normalWS = half4(normalInput.normalWS, viewDirWS.x);
|
||||
output.tangentWS = half4(normalInput.tangentWS, viewDirWS.y);
|
||||
output.bitangentWS = half4(normalInput.bitangentWS, viewDirWS.z);
|
||||
|
||||
#if defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
|
||||
half3 viewDirTS = GetViewDirectionTangentSpace(tangentWS, output.normalWS, viewDirWS);
|
||||
output.viewDirTS = viewDirTS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
output.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
output.positionWS = vertexInput.positionWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
output.positionCS = vertexInput.positionCS;
|
||||
|
||||
return output;
|
||||
}
|
||||
//生成灰度图(高度)
|
||||
float GetGrayColor(half3 color)
|
||||
{
|
||||
//return color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;
|
||||
//return color.r * 0.3 + color.g * 0.59 + color.b * 0.11;
|
||||
return 0.299f * color.r + 0.587f * color.g + 0.114f * color.b;
|
||||
}
|
||||
//生成法线 ao 粗糙度,金属度
|
||||
AttData GetNormalByGray(float2 uv, half4 col4)
|
||||
{
|
||||
AttData ad;
|
||||
half bumpscale = _BumpScale * _LayerTex0_TexelSize.x;
|
||||
float2 deltaU = float2(_LayerTex0_TexelSize.x, 0);
|
||||
float h0 = GetGrayColor(col4.xyz);
|
||||
float h1_u = GetGrayColor(SAMPLE_TEXTURE2D(_LayerTex0, sampler_LayerTex0, uv - deltaU).rgb);
|
||||
float h2_u = GetGrayColor(SAMPLE_TEXTURE2D(_LayerTex0, sampler_LayerTex0, uv + deltaU).rgb);
|
||||
//float3 tangent_u = float3(deltaU.x, 0, (h2_u - h0) * bumpscale);
|
||||
float3 tangent_u = float3(deltaU.x, 0, (h2_u - h1_u) * bumpscale);
|
||||
|
||||
float2 deltaV = float2(0, _LayerTex0_TexelSize.y);
|
||||
float h1_v = GetGrayColor(SAMPLE_TEXTURE2D(_LayerTex0, sampler_LayerTex0, uv - deltaV).rgb);
|
||||
float h2_v = GetGrayColor(SAMPLE_TEXTURE2D(_LayerTex0, sampler_LayerTex0, uv + deltaV).rgb);
|
||||
//float3 tangent_v = float3(0, deltaV.y, (h2_v - h0) * bumpscale);
|
||||
float3 tangent_v = float3(0, deltaV.y, (h2_v - h1_v) * bumpscale);
|
||||
|
||||
//算ao. 两个向量夹角《
|
||||
float ao;// = 0;
|
||||
//ad.ao = 0;
|
||||
ad.normal = normalize(cross(tangent_v, tangent_u));
|
||||
ad.normal.z *= -1;
|
||||
float3 vVA = float3(0, deltaV.y, (h2_v - h0) * bumpscale);
|
||||
float3 vVB = float3(0, deltaV.y, (h1_v - h0) * bumpscale);
|
||||
float3 VecV = cross(vVA, vVB);
|
||||
//if (VecV.y > 0)
|
||||
{//锐角,判断根据锐角度得到夹角深度
|
||||
ao = saturate(acos(dot(normalize(vVA), normalize(vVB))));
|
||||
}
|
||||
float3 vUA = float3(deltaU.x, 0, (h2_u - h0) * bumpscale);
|
||||
float3 vUB = float3(deltaU.x, 0, (h1_u - h0) * bumpscale);
|
||||
float3 VecU = cross(vUA, vUB);
|
||||
//if (VecU.y > 0)
|
||||
{//锐角,判断根据锐角度得到夹角深度
|
||||
ad.ao = saturate(acos(dot(normalize(vUA), normalize(vUB))));
|
||||
}
|
||||
ad.ao = saturate(1.0f - max(ao, ad.ao) * _AO);
|
||||
//
|
||||
//粗糙度
|
||||
ad.roughness = saturate((abs(h1_u - h0) + abs(h2_u - h0) + abs(h1_v - h0) + abs(h2_v - h0)) + _Roughness);
|
||||
//金属度
|
||||
ad.metallic = saturate((h0 + h1_u + h2_u + h1_v + h2_v) / 5 * _Metallic);
|
||||
return ad;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
#if defined(_PARALLAXMAP)
|
||||
#if defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
half3 viewDirTS = input.viewDirTS;
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
half3 viewDirTS = GetViewDirectionTangentSpace(input.tangentWS, input.normalWS, viewDirWS);
|
||||
#endif
|
||||
ApplyPerPixelDisplacement(viewDirTS, input.uv);
|
||||
#endif
|
||||
|
||||
// 采样混合权重
|
||||
half4 splat_control = SAMPLE_TEXTURE2D(_Control, sampler_Control, input.uv);
|
||||
|
||||
// 各层颜色采样,使用同一套 UV 并乘以 Tiling
|
||||
float2 uv = input.uv * _Tiling;
|
||||
half4 col0 = SAMPLE_TEXTURE2D(_LayerTex0, sampler_LayerTex0, uv);
|
||||
half4 col1 = SAMPLE_TEXTURE2D(_LayerTex1, sampler_LayerTex1, uv);
|
||||
half4 col2 = SAMPLE_TEXTURE2D(_LayerTex2, sampler_LayerTex2, uv);
|
||||
half4 col3 = SAMPLE_TEXTURE2D(_LayerTex3, sampler_LayerTex3, uv);
|
||||
|
||||
// 按权重混合
|
||||
float total = splat_control.r + splat_control.g + splat_control.b + splat_control.a ;
|
||||
float a = 1 - max(max(splat_control.r, splat_control.g), splat_control.b);
|
||||
|
||||
half4 col = col0 * splat_control.r / total
|
||||
+ col1 * splat_control.g / total
|
||||
+ col2 * splat_control.b / total
|
||||
+ col3 * splat_control.a / total ;
|
||||
|
||||
//得到法线
|
||||
AttData ad = GetNormalByGray(uv, col);
|
||||
half3 normalWS = TransformTangentToWorld(ad.normal,
|
||||
half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
|
||||
SurfaceData surfaceData;
|
||||
surfaceData.specular = half3(0.0, 0.0, 0.0);
|
||||
|
||||
surfaceData.albedo = col.rgb;
|
||||
surfaceData.metallic = ad.metallic;
|
||||
surfaceData.smoothness = 1.0 - ad.roughness; // 新版URP中smoothness直接控制高光
|
||||
surfaceData.alpha = col.a;
|
||||
surfaceData.normalTS = ad.normal;//input.tangentWS;//
|
||||
//surfaceData.specular = 0;
|
||||
surfaceData.emission = half3(0.0, 0.0, 0.0);
|
||||
surfaceData.occlusion = ad.ao;
|
||||
surfaceData.clearCoatMask = half(0.0);
|
||||
surfaceData.clearCoatSmoothness = half(0.0);
|
||||
|
||||
InputData inputData;
|
||||
input.normalWS.rgb = normalWS;//法线需要传入
|
||||
InitializeInputData(input, surfaceData.normalTS, inputData);
|
||||
|
||||
half4 color = UniversalFragmentPBR(inputData, surfaceData);
|
||||
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
//color.rgb = ad.ao;//ad.normal;
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags{ "LightMode" = "ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard srp library
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XTex_Base.hlsl"
|
||||
|
||||
float3 _LightDirection;
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
|
||||
|
||||
float4 positionCS = TransformWorldToHClip(positionWS);
|
||||
|
||||
#if UNITY_REVERSED_Z
|
||||
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
|
||||
output.positionCS = positionCS;
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _MainTex);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_TARGET
|
||||
{
|
||||
return SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a;
|
||||
//return 0;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
//UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c62f5ca63149bac4c8bcb39cf97084a2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,170 @@
|
||||
#ifndef XTERRAIN_LIT_BASE
|
||||
#define XTERRAIN_LIT_BASE
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _LayerTex0_ST;
|
||||
float4 _LayerTex1_ST;
|
||||
float4 _LayerTex2_ST;
|
||||
float4 _LayerTex3_ST;
|
||||
//half4 _BaseColor;
|
||||
float _Tiling;
|
||||
half _BumpScale;
|
||||
half _Roughness;
|
||||
half _Metallic;
|
||||
half _AO;
|
||||
half _EmissiveIntensity;
|
||||
half _useCustomGI;
|
||||
half3 _CustomGIColor;
|
||||
float4 _LayerTex0_TexelSize;
|
||||
CBUFFER_END
|
||||
half _XRuntimeAmbientEnabled;
|
||||
half4 _XRuntimeAmbientSky;
|
||||
half4 _XRuntimeAmbientEquator;
|
||||
half4 _XRuntimeAmbientGround;
|
||||
|
||||
//TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
|
||||
TEXTURE2D(_LayerTex0);
|
||||
SAMPLER(sampler_LayerTex0);
|
||||
TEXTURE2D(_LayerTex1);
|
||||
SAMPLER(sampler_LayerTex1);
|
||||
TEXTURE2D(_LayerTex2);
|
||||
SAMPLER(sampler_LayerTex2);
|
||||
TEXTURE2D(_LayerTex3);
|
||||
SAMPLER(sampler_LayerTex3);
|
||||
TEXTURE2D(_Control);
|
||||
SAMPLER(sampler_Control);
|
||||
|
||||
// 声明变量
|
||||
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
half4 color : COLOR;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(staticLightmapUV, vertexSH, 1);
|
||||
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
half4 lightDir : TEXCOORD8;
|
||||
half4 viewDir : TEXCOORD9;
|
||||
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
|
||||
float4 positionCS : SV_POSITION;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD10;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
half3 SampleXRuntimeAmbient(half3 normalWS)
|
||||
{
|
||||
half y = normalize(normalWS).y;
|
||||
half useGlobal = step(0.5h, _XRuntimeAmbientEnabled);
|
||||
half3 sky = lerp(half3(1.353h, 1.452h, 1.568h), _XRuntimeAmbientSky.rgb, useGlobal);
|
||||
half3 equator = lerp(half3(1.023h, 1.122h, 1.254h), _XRuntimeAmbientEquator.rgb, useGlobal);
|
||||
half3 ground = lerp(half3(0.561h, 0.528h, 0.462h), _XRuntimeAmbientGround.rgb, useGlobal);
|
||||
half3 upper = lerp(equator, sky, saturate(y));
|
||||
half3 lower = lerp(equator, ground, saturate(-y));
|
||||
return lerp(lower, upper, step(0.0h, y));
|
||||
}
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData)
|
||||
{
|
||||
inputData = (InputData)0;
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
#if defined(_NORMALMAP) || defined(_DETAIL)
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
inputData.tangentToWorld = tangentToWorld;
|
||||
#endif
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, tangentToWorld);
|
||||
#else
|
||||
inputData.normalWS = input.normalWS.xyz;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactor);
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#elif defined(LIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#else
|
||||
inputData.bakedGI = SampleSH(inputData.normalWS);
|
||||
#endif
|
||||
// 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图,
|
||||
// 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光)
|
||||
if (_XRuntimeAmbientEnabled > 0.5h)
|
||||
inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS);
|
||||
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
|
||||
#if defined(DEBUG_DISPLAY)
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.dynamicLightmapUV = input.dynamicLightmapUV;
|
||||
#endif
|
||||
#if defined(LIGHTMAP_ON)
|
||||
inputData.staticLightmapUV = input.staticLightmapUV;
|
||||
#else
|
||||
inputData.vertexSH = input.vertexSH;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3538332e45c8b1a4f9d4964380ddc6a9
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,322 @@
|
||||
Shader "Test/XTex"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
||||
[MainColor] _BaseColor("Color", Color) = (1,1,1,1)
|
||||
[MainTexture] _MainTex("Albedo", 2D) = "white" {}
|
||||
|
||||
[Toggle(_MIXTEX_ON)] _UseMixTex("Use Mix Map", Float) = 0
|
||||
[MixTexture] _MixTex("MixTex", 2D) = "white" {}
|
||||
|
||||
_BumpScale("BumpScale", Range(0.0, 10)) = 5
|
||||
_Roughness("Roughness", Range(0.0, 2.0)) = 0.4
|
||||
_Metallic("Metallic", Range(0.0, 2.0)) = 0.3
|
||||
_AO("AO", Range(0.0, 3.0)) = 1.0
|
||||
_EmissiveIntensity("EmissiveIntensity", Range(0.0, 2.0)) = 0.3
|
||||
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
// Universal Pipeline tag is required. If Universal render pipeline is not set in the graphics settings
|
||||
// this Subshader will fail. One can add a subshader below or fallback to Standard built-in to make this
|
||||
// material work with both Universal Render Pipeline and Builtin Unity Pipeline
|
||||
Tags{ "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
|
||||
Pass
|
||||
{
|
||||
// Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
|
||||
// no LightMode tag are also rendered by Universal Render Pipeline
|
||||
Name "ForwardLit"
|
||||
Tags{ "LightMode" = "UniversalForward" }
|
||||
|
||||
ZWrite on
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard SRP library
|
||||
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile _ _MIXTEX_ON
|
||||
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XTex_Base.hlsl"
|
||||
|
||||
struct AttData
|
||||
{
|
||||
float3 normal;
|
||||
float ao;//获得夹角越狭窄越强
|
||||
float roughness;//周围高度差越多,越粗糙;颜色越相同越低;
|
||||
float metallic;//使用平均亮度值
|
||||
};
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
|
||||
|
||||
// normalWS and tangentWS already normalize.
|
||||
// this is required to avoid skewing the direction during interpolation
|
||||
// also required for per-vertex lighting and SH evaluation
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS, input.tangentOS);
|
||||
|
||||
half3 vertexLight = VertexLighting(vertexInput.positionWS, normalInput.normalWS);
|
||||
|
||||
half fogFactor = 0;
|
||||
#if !defined(_FOG_FRAGMENT)
|
||||
fogFactor = ComputeFogFactor(vertexInput.positionCS.z);
|
||||
#endif
|
||||
|
||||
|
||||
// already normalized from normal transform to WS.
|
||||
// half3 viewDirWS = GetWorldSpaceNormalizeViewDir(vertexInput.positionWS);
|
||||
// output.normalWS = half4(normalInput.normalWS, viewDirWS.x);//normalInput.normalWS;//
|
||||
//#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR) || defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
// real sign = input.tangentOS.w * GetOddNegativeScale();
|
||||
// half4 tangentWS = half4(normalInput.tangentWS.xyz, sign);
|
||||
//#endif
|
||||
//#if defined(REQUIRES_WORLD_SPACE_TANGENT_INTERPOLATOR)
|
||||
// output.tangentWS = tangentWS;
|
||||
//#endif
|
||||
half3 viewDirWS = GetCameraPositionWS() - vertexInput.positionWS;
|
||||
output.normalWS = half4(normalInput.normalWS, viewDirWS.x);
|
||||
output.tangentWS = half4(normalInput.tangentWS, viewDirWS.y);
|
||||
output.bitangentWS = half4(normalInput.bitangentWS, viewDirWS.z);
|
||||
|
||||
#if defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
|
||||
half3 viewDirTS = GetViewDirectionTangentSpace(tangentWS, output.normalWS, viewDirWS);
|
||||
output.viewDirTS = viewDirTS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
output.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
output.positionWS = vertexInput.positionWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
output.positionCS = vertexInput.positionCS;
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _MainTex);
|
||||
|
||||
return output;
|
||||
}
|
||||
//生成灰度图(高度)
|
||||
float GetGrayColor(half3 color)
|
||||
{
|
||||
//return color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;
|
||||
//return color.r * 0.3 + color.g * 0.59 + color.b * 0.11;
|
||||
return 0.299f * color.r + 0.587f * color.g + 0.114f * color.b;
|
||||
}
|
||||
//生成法线 ao 粗糙度,金属度
|
||||
AttData GetNormalByGray(float2 uv, half4 col4)
|
||||
{
|
||||
AttData ad;
|
||||
half bumpscale = _BumpScale * _MainTex_TexelSize.x;
|
||||
float2 deltaU = float2(_MainTex_TexelSize.x, 0);
|
||||
float h0 = GetGrayColor(col4.xyz);
|
||||
float h1_u = GetGrayColor(SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv - deltaU).rgb);
|
||||
float h2_u = GetGrayColor(SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + deltaU).rgb);
|
||||
//float3 tangent_u = float3(deltaU.x, 0, (h2_u - h0) * bumpscale);
|
||||
float3 tangent_u = float3(deltaU.x, 0, (h2_u - h1_u) * bumpscale);
|
||||
|
||||
float2 deltaV = float2(0, _MainTex_TexelSize.y);
|
||||
float h1_v = GetGrayColor(SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv - deltaV).rgb);
|
||||
float h2_v = GetGrayColor(SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + deltaV).rgb);
|
||||
//float3 tangent_v = float3(0, deltaV.y, (h2_v - h0) * bumpscale);
|
||||
float3 tangent_v = float3(0, deltaV.y, (h2_v - h1_v) * bumpscale);
|
||||
|
||||
//算ao. 两个向量夹角《
|
||||
float ao;// = 0;
|
||||
//ad.ao = 0;
|
||||
ad.normal = normalize(cross(tangent_v, tangent_u));
|
||||
ad.normal.z *= -1;
|
||||
float3 vVA = float3(0, deltaV.y, (h2_v - h0) * bumpscale);
|
||||
float3 vVB = float3(0, deltaV.y, (h1_v - h0) * bumpscale);
|
||||
float3 VecV = cross(vVA, vVB);
|
||||
//if (VecV.y > 0)
|
||||
{//锐角,判断根据锐角度得到夹角深度
|
||||
ao = saturate(acos(dot(normalize(vVA), normalize(vVB))));
|
||||
}
|
||||
float3 vUA = float3(deltaU.x, 0, (h2_u - h0) * bumpscale);
|
||||
float3 vUB = float3(deltaU.x, 0, (h1_u - h0) * bumpscale);
|
||||
float3 VecU = cross(vUA, vUB);
|
||||
//if (VecU.y > 0)
|
||||
{//锐角,判断根据锐角度得到夹角深度
|
||||
ad.ao = saturate(acos(dot(normalize(vUA), normalize(vUB))));
|
||||
}
|
||||
ad.ao = saturate(1.0f - max(ao, ad.ao) * _AO);
|
||||
//
|
||||
//粗糙度
|
||||
ad.roughness = saturate((abs(h1_u - h0) + abs(h2_u - h0) + abs(h1_v - h0) + abs(h2_v - h0)) + _Roughness);
|
||||
//金属度
|
||||
ad.metallic = saturate((h0 + h1_u + h2_u + h1_v + h2_v) / 5 * _Metallic);
|
||||
return ad;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
#if defined(_PARALLAXMAP)
|
||||
#if defined(REQUIRES_TANGENT_SPACE_VIEW_DIR_INTERPOLATOR)
|
||||
half3 viewDirTS = input.viewDirTS;
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
half3 viewDirTS = GetViewDirectionTangentSpace(input.tangentWS, input.normalWS, viewDirWS);
|
||||
#endif
|
||||
ApplyPerPixelDisplacement(viewDirTS, input.uv);
|
||||
#endif
|
||||
|
||||
SurfaceData surfaceData;
|
||||
//InitializeStandardLitSurfaceData(input.uv, surfaceData);
|
||||
half4 albedoAlpha = SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_MainTex, sampler_MainTex));
|
||||
half3 albedo = albedoAlpha.rgb * _BaseColor.rgb;
|
||||
//Light mainLight = GetMainLight();
|
||||
#ifdef _MIXTEX_ON
|
||||
half4 mixTex = SAMPLE_TEXTURE2D(_MixTex, sampler_MixTex, input.uv);
|
||||
AttData ad;// = GetNormalByGray(input.uv, albedoAlpha);;
|
||||
ad.normal.rgb = DecodeSphereMap(mixTex.rg);
|
||||
ad.ao = saturate(1.0 - (1.0 - mixTex.a) * _AO);
|
||||
ad.roughness = mixTex.a * _Roughness;
|
||||
ad.metallic = mixTex.b * _Metallic;
|
||||
#else
|
||||
//得到法线
|
||||
AttData ad = GetNormalByGray(input.uv, albedoAlpha);
|
||||
//half gray = GetGrayColor(albedoAlpha.xyz);
|
||||
//ad.normal.rgb = half3(gray,gray,gray);
|
||||
#endif
|
||||
|
||||
//half3 viewDirWS = half3(input.normalWS.w, input.tangentWS.w, input.bitangentWS.w);
|
||||
half3 normalWS = TransformTangentToWorld(ad.normal,
|
||||
half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz));
|
||||
|
||||
surfaceData.specular = half3(0.0, 0.0, 0.0);
|
||||
|
||||
surfaceData.albedo = albedo;
|
||||
surfaceData.metallic = ad.metallic;
|
||||
surfaceData.smoothness = 1.0 - ad.roughness; // 新版URP中smoothness直接控制高光
|
||||
surfaceData.alpha = albedoAlpha.a;
|
||||
surfaceData.normalTS = ad.normal;//input.tangentWS;//
|
||||
//surfaceData.specular = 0;
|
||||
surfaceData.emission = half3(0.0, 0.0, 0.0);
|
||||
surfaceData.occlusion = ad.ao;
|
||||
surfaceData.clearCoatMask = half(0.0);
|
||||
surfaceData.clearCoatSmoothness = half(0.0);
|
||||
|
||||
InputData inputData;
|
||||
input.normalWS.rgb = normalWS;//ad.normal;//法线需要传入
|
||||
InitializeInputData(input, surfaceData.normalTS, inputData);
|
||||
|
||||
|
||||
//SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv, _BaseMap);
|
||||
|
||||
//#ifdef _DBUFFER
|
||||
// ApplyDecalToSurfaceData(input.positionCS, surfaceData, inputData);
|
||||
//#endif
|
||||
|
||||
half4 color = UniversalFragmentPBR(inputData, surfaceData);
|
||||
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
//color.a = OutputAlpha(color.a, _Surface);
|
||||
|
||||
//color.rgb = input.tangentWS;//normalWS;//surfaceData.normalTS;//
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags{ "LightMode" = "ShadowCaster" }
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard srp library
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "XTex_Base.hlsl"
|
||||
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
|
||||
|
||||
float4 positionCS = TransformWorldToHClip(positionWS);
|
||||
|
||||
#if UNITY_REVERSED_Z
|
||||
positionCS.z = min(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
positionCS.z = max(positionCS.z, positionCS.w * UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
|
||||
output.positionCS = positionCS;
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _MainTex);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(Varyings input) : SV_TARGET
|
||||
{
|
||||
return SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a;
|
||||
//return 0;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
//UsePass "Universal Render Pipeline/Lit/ShadowCaster"
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32be331071e4bc34895b26703115c3e6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _MainTex: {instanceID: 0}
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,172 @@
|
||||
#ifndef XTEX_LIT_BASE
|
||||
#define XTEX_LIT_BASE
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _MainTex_ST;
|
||||
half4 _BaseColor;
|
||||
half _BumpScale;
|
||||
half _Roughness;
|
||||
half _Metallic;
|
||||
half _AO;
|
||||
half _EmissiveIntensity;
|
||||
half _useCustomGI;
|
||||
half3 _CustomGIColor;
|
||||
float4 _MainTex_TexelSize;
|
||||
#ifdef _MIXTEX_ON
|
||||
float4 _MixTex_ST;
|
||||
#endif
|
||||
CBUFFER_END
|
||||
half _XRuntimeAmbientEnabled;
|
||||
half4 _XRuntimeAmbientSky;
|
||||
half4 _XRuntimeAmbientEquator;
|
||||
half4 _XRuntimeAmbientGround;
|
||||
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
#ifdef _MIXTEX_ON
|
||||
TEXTURE2D(_MixTex); SAMPLER(sampler_MixTex);
|
||||
#endif
|
||||
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
half4 color : COLOR;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
DECLARE_LIGHTMAP_OR_SH(staticLightmapUV, vertexSH, 1);
|
||||
|
||||
float3 positionWS : TEXCOORD2;
|
||||
|
||||
half4 normalWS : TEXCOORD3; // xyz: normal, w: viewDir.x
|
||||
half4 tangentWS : TEXCOORD4; // xyz: tangent, w: viewDir.y
|
||||
half4 bitangentWS : TEXCOORD5; // xyz: bitangent, w: viewDir.z
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
half4 lightDir : TEXCOORD8;
|
||||
half4 viewDir : TEXCOORD9;
|
||||
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
float4 positionCS : SV_POSITION;
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD10;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
real3 SafeNormalize_Half3(real3 inVec)
|
||||
{
|
||||
real dp3 = max(REAL_MIN, dot(inVec, inVec));
|
||||
return inVec * rsqrt(dp3);
|
||||
}
|
||||
|
||||
float3 DecodeSphereMap(float2 encoded)
|
||||
{
|
||||
float4 nn = float4(encoded, 1, -1);
|
||||
float l = dot(nn.xyz, -nn.xyw);
|
||||
nn.z = l;
|
||||
nn.xy *= sqrt(l);
|
||||
return nn.xyz * 2 + float3(0, 0, -1);
|
||||
}
|
||||
|
||||
half3 SampleXRuntimeAmbient(half3 normalWS)
|
||||
{
|
||||
half y = normalize(normalWS).y;
|
||||
half useGlobal = step(0.5h, _XRuntimeAmbientEnabled);
|
||||
half3 sky = lerp(half3(1.353h, 1.452h, 1.568h), _XRuntimeAmbientSky.rgb, useGlobal);
|
||||
half3 equator = lerp(half3(1.023h, 1.122h, 1.254h), _XRuntimeAmbientEquator.rgb, useGlobal);
|
||||
half3 ground = lerp(half3(0.561h, 0.528h, 0.462h), _XRuntimeAmbientGround.rgb, useGlobal);
|
||||
half3 upper = lerp(equator, sky, saturate(y));
|
||||
half3 lower = lerp(equator, ground, saturate(-y));
|
||||
return lerp(lower, upper, step(0.0h, y));
|
||||
}
|
||||
|
||||
void InitializeInputData(Varyings input, half3 normalTS, out InputData inputData)
|
||||
{
|
||||
inputData = (InputData)0;
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
#if defined(_NORMALMAP) || defined(_DETAIL)
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
inputData.tangentToWorld = tangentToWorld;
|
||||
#endif
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, tangentToWorld);
|
||||
#else
|
||||
inputData.normalWS = input.normalWS.xyz;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactor);
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#elif defined(LIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
#else
|
||||
inputData.bakedGI = SampleSH(inputData.normalWS);
|
||||
#endif
|
||||
// 仅在运行时全局环境光开启后才覆盖(Game.cs 设置);否则保留场景自身 SH/光照贴图,
|
||||
// 避免编辑器预览比 URP Lit 亮(旧写法无条件覆盖成硬编码的高强度三色环境光)
|
||||
if (_XRuntimeAmbientEnabled > 0.5h)
|
||||
inputData.bakedGI = SampleXRuntimeAmbient(inputData.normalWS);
|
||||
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
|
||||
#if defined(DEBUG_DISPLAY)
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.dynamicLightmapUV = input.dynamicLightmapUV;
|
||||
#endif
|
||||
#if defined(LIGHTMAP_ON)
|
||||
inputData.staticLightmapUV = input.staticLightmapUV;
|
||||
#else
|
||||
inputData.vertexSH = input.vertexSH;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a68f172b57b5e5e4f8842cd5a63f22a3
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 297292b243665ee45b0e0f266b016347
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,296 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using YooAsset.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// M3:角色目录约定 Assets/Bundles/Characters/{ActorName}/ + Art 包收集。
|
||||
/// </summary>
|
||||
public static class SetupM3Character
|
||||
{
|
||||
public const string ActorName = "MaleExplorer";
|
||||
public const string ActorRoot = "Assets/Bundles/Characters/" + ActorName;
|
||||
const string FbxPath = ActorRoot + "/" + ActorName + ".fbx";
|
||||
const string BasePath = ActorRoot + "/" + ActorName + "_base.png";
|
||||
const string MixPath = ActorRoot + "/" + ActorName + "_mix.png";
|
||||
const string ColorPath = ActorRoot + "/" + ActorName + "_color.png";
|
||||
const string NormalPath = ActorRoot + "/" + ActorName + "_normal.png";
|
||||
const string AoPath = ActorRoot + "/" + ActorName + "_ao.png";
|
||||
const string MetallicPath = ActorRoot + "/" + ActorName + "_metallic.png";
|
||||
const string RoughnessPath = ActorRoot + "/" + ActorName + "_roughness.png";
|
||||
const string ConceptPath = ActorRoot + "/concept.png";
|
||||
const string MatPath = ActorRoot + "/" + ActorName + ".mat";
|
||||
const string PrefabPath = ActorRoot + "/" + ActorName + ".prefab";
|
||||
const string ArtPackage = "Art";
|
||||
const string XPbrShaderName = "Test/XPbr";
|
||||
|
||||
[MenuItem("AIGame/M3/Setup Character Prefab + Art Collector")]
|
||||
public static string SetupAll()
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
var a = EnsureTextureImports();
|
||||
var b = EnsureMaterialAndPrefab();
|
||||
var c = EnsureArtCollector();
|
||||
CleanupLegacyLayout();
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
return $"ok textures={a} prefab={b} art={c}";
|
||||
}
|
||||
|
||||
public static string EnsureTextureImports()
|
||||
{
|
||||
var paths = new[] { BasePath, MixPath, ColorPath, NormalPath, AoPath, MetallicPath, RoughnessPath, ConceptPath };
|
||||
var ok = 0;
|
||||
foreach (var path in paths)
|
||||
{
|
||||
if (!File.Exists(path)) continue;
|
||||
var importer = AssetImporter.GetAtPath(path) as TextureImporter;
|
||||
if (importer == null) continue;
|
||||
var isMix = path == MixPath;
|
||||
var isNormal = path == NormalPath;
|
||||
var isData = path == MetallicPath || path == RoughnessPath || path == AoPath || isMix;
|
||||
importer.textureType = isNormal ? TextureImporterType.NormalMap : TextureImporterType.Default;
|
||||
importer.sRGBTexture = !isNormal && !isData;
|
||||
importer.mipmapEnabled = true;
|
||||
importer.alphaIsTransparency = path == ConceptPath || path == BasePath;
|
||||
importer.SaveAndReimport();
|
||||
ok++;
|
||||
}
|
||||
|
||||
if (File.Exists(FbxPath))
|
||||
{
|
||||
var model = AssetImporter.GetAtPath(FbxPath) as ModelImporter;
|
||||
if (model != null)
|
||||
{
|
||||
// XPbr:保留 externalObjects 材质重映射;无 .mat 时再 None
|
||||
model.materialImportMode = File.Exists(MatPath)
|
||||
? ModelImporterMaterialImportMode.ImportViaMaterialDescription
|
||||
: ModelImporterMaterialImportMode.None;
|
||||
model.meshCompression = ModelImporterMeshCompression.Medium;
|
||||
model.isReadable = false;
|
||||
model.SaveAndReimport();
|
||||
}
|
||||
}
|
||||
|
||||
return $"imported={ok} fbx={(File.Exists(FbxPath) ? "yes" : "no")}";
|
||||
}
|
||||
|
||||
public static string EnsureMaterialAndPrefab()
|
||||
{
|
||||
if (File.Exists(FbxPath) && (File.Exists(BasePath) || File.Exists(ColorPath)))
|
||||
return EnsureMeshPrefab();
|
||||
if (File.Exists(ConceptPath))
|
||||
return EnsureBillboardPrefab();
|
||||
return "missing MaleExplorer mesh/concept under " + ActorRoot;
|
||||
}
|
||||
|
||||
static string EnsureMeshPrefab()
|
||||
{
|
||||
var baseMap = AssetDatabase.LoadAssetAtPath<Texture2D>(BasePath);
|
||||
var mixMap = AssetDatabase.LoadAssetAtPath<Texture2D>(MixPath);
|
||||
var color = baseMap != null ? baseMap : AssetDatabase.LoadAssetAtPath<Texture2D>(ColorPath);
|
||||
if (color == null) return "base/color texture missing";
|
||||
|
||||
var xpbr = Shader.Find(XPbrShaderName);
|
||||
var urpLit = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Standard");
|
||||
var useXpbr = xpbr != null && mixMap != null;
|
||||
var shader = useXpbr ? xpbr : urpLit;
|
||||
|
||||
var mat = AssetDatabase.LoadAssetAtPath<Material>(MatPath);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new Material(shader);
|
||||
AssetDatabase.CreateAsset(mat, MatPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.shader = shader;
|
||||
}
|
||||
|
||||
if (useXpbr)
|
||||
{
|
||||
if (mat.HasProperty("_MainTex")) mat.SetTexture("_MainTex", color);
|
||||
if (mat.HasProperty("_MixTex")) mat.SetTexture("_MixTex", mixMap);
|
||||
if (mat.HasProperty("_BaseColor")) mat.SetColor("_BaseColor", Color.white);
|
||||
if (mat.HasProperty("_Metallic")) mat.SetFloat("_Metallic", 1f);
|
||||
if (mat.HasProperty("_Roughness")) mat.SetFloat("_Roughness", 1f);
|
||||
if (mat.HasProperty("_AO")) mat.SetFloat("_AO", 1f);
|
||||
if (mat.HasProperty("_AlphaTest")) mat.SetFloat("_AlphaTest", 0f);
|
||||
mat.DisableKeyword("_ALPHATEST_ON");
|
||||
}
|
||||
else
|
||||
{
|
||||
var normal = AssetDatabase.LoadAssetAtPath<Texture2D>(NormalPath);
|
||||
var ao = AssetDatabase.LoadAssetAtPath<Texture2D>(AoPath);
|
||||
var metallic = AssetDatabase.LoadAssetAtPath<Texture2D>(MetallicPath);
|
||||
var roughness = AssetDatabase.LoadAssetAtPath<Texture2D>(RoughnessPath);
|
||||
if (mat.HasProperty("_BaseMap")) mat.SetTexture("_BaseMap", color);
|
||||
if (mat.HasProperty("_MainTex")) mat.SetTexture("_MainTex", color);
|
||||
if (mat.HasProperty("_BumpMap") && normal != null)
|
||||
{
|
||||
mat.SetTexture("_BumpMap", normal);
|
||||
mat.EnableKeyword("_NORMALMAP");
|
||||
}
|
||||
if (mat.HasProperty("_OcclusionMap") && ao != null)
|
||||
mat.SetTexture("_OcclusionMap", ao);
|
||||
if (mat.HasProperty("_MetallicGlossMap") && metallic != null)
|
||||
{
|
||||
mat.SetTexture("_MetallicGlossMap", metallic);
|
||||
mat.EnableKeyword("_METALLICSPECGLOSSMAP");
|
||||
}
|
||||
if (mat.HasProperty("_Smoothness") && roughness != null)
|
||||
mat.SetFloat("_Smoothness", 0.45f);
|
||||
if (mat.HasProperty("_BaseColor")) mat.SetColor("_BaseColor", Color.white);
|
||||
}
|
||||
EditorUtility.SetDirty(mat);
|
||||
|
||||
var modelRoot = AssetDatabase.LoadAssetAtPath<GameObject>(FbxPath);
|
||||
if (modelRoot == null) return "fbx not loaded";
|
||||
|
||||
var instance = (GameObject)PrefabUtility.InstantiatePrefab(modelRoot);
|
||||
instance.name = ActorName;
|
||||
foreach (var renderer in instance.GetComponentsInChildren<Renderer>())
|
||||
renderer.sharedMaterial = mat;
|
||||
|
||||
// 落地参考盘
|
||||
var ground = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
|
||||
ground.name = "ShadowDisc";
|
||||
ground.transform.SetParent(instance.transform, false);
|
||||
ground.transform.localPosition = new Vector3(0f, 0.02f, 0f);
|
||||
ground.transform.localScale = new Vector3(0.7f, 0.015f, 0.7f);
|
||||
Object.DestroyImmediate(ground.GetComponent<Collider>());
|
||||
var gMat = new Material(urpLit != null ? urpLit : shader);
|
||||
if (gMat.HasProperty("_BaseColor")) gMat.SetColor("_BaseColor", new Color(0.12f, 0.12f, 0.14f, 1f));
|
||||
if (gMat.HasProperty("_Color")) gMat.color = new Color(0.12f, 0.12f, 0.14f, 1f);
|
||||
ground.GetComponent<MeshRenderer>().sharedMaterial = gMat;
|
||||
ground.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.Off;
|
||||
|
||||
// 粗略归一化身高约 1.8m
|
||||
var bounds = new Bounds(instance.transform.position, Vector3.zero);
|
||||
var renderers = instance.GetComponentsInChildren<Renderer>();
|
||||
foreach (var r in renderers)
|
||||
{
|
||||
if (r.name == "ShadowDisc") continue;
|
||||
bounds.Encapsulate(r.bounds);
|
||||
}
|
||||
if (bounds.size.y > 0.01f)
|
||||
{
|
||||
var scale = 1.8f / bounds.size.y;
|
||||
instance.transform.localScale = Vector3.one * scale;
|
||||
}
|
||||
|
||||
PrefabUtility.SaveAsPrefabAsset(instance, PrefabPath);
|
||||
Object.DestroyImmediate(instance);
|
||||
return PrefabPath;
|
||||
}
|
||||
|
||||
static string EnsureBillboardPrefab()
|
||||
{
|
||||
var tex = AssetDatabase.LoadAssetAtPath<Texture2D>(ConceptPath);
|
||||
if (tex == null) return "concept not loaded";
|
||||
|
||||
var shader = Shader.Find("Universal Render Pipeline/Unlit");
|
||||
if (shader == null) shader = Shader.Find("Unlit/Transparent");
|
||||
if (shader == null) shader = Shader.Find("Sprites/Default");
|
||||
|
||||
var mat = AssetDatabase.LoadAssetAtPath<Material>(MatPath);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new Material(shader);
|
||||
AssetDatabase.CreateAsset(mat, MatPath);
|
||||
}
|
||||
else mat.shader = shader;
|
||||
|
||||
if (mat.HasProperty("_BaseMap")) mat.SetTexture("_BaseMap", tex);
|
||||
if (mat.HasProperty("_MainTex")) mat.SetTexture("_MainTex", tex);
|
||||
if (mat.HasProperty("_BaseColor")) mat.SetColor("_BaseColor", Color.white);
|
||||
if (mat.HasProperty("_Surface")) mat.SetFloat("_Surface", 1f);
|
||||
mat.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
mat.renderQueue = (int)RenderQueue.Transparent;
|
||||
EditorUtility.SetDirty(mat);
|
||||
|
||||
var root = new GameObject(ActorName);
|
||||
root.transform.localScale = new Vector3(1.2f, 2.0f, 1f);
|
||||
var quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
|
||||
quad.name = "Billboard";
|
||||
quad.transform.SetParent(root.transform, false);
|
||||
quad.transform.localPosition = new Vector3(0f, 1.0f, 0f);
|
||||
Object.DestroyImmediate(quad.GetComponent<MeshCollider>());
|
||||
quad.GetComponent<MeshRenderer>().sharedMaterial = mat;
|
||||
PrefabUtility.SaveAsPrefabAsset(root, PrefabPath);
|
||||
Object.DestroyImmediate(root);
|
||||
return PrefabPath + " (billboard fallback)";
|
||||
}
|
||||
|
||||
static void CleanupLegacyLayout()
|
||||
{
|
||||
// 旧 M3 扁平目录,迁移后删除空壳
|
||||
var legacy = new[]
|
||||
{
|
||||
"Assets/Bundles/Characters/Prefabs/MaleExplorer.prefab",
|
||||
"Assets/Bundles/Characters/Textures/male_explorer.png",
|
||||
"Assets/Bundles/Characters/Textures/MaleExplorer_Billboard.mat",
|
||||
};
|
||||
foreach (var path in legacy)
|
||||
{
|
||||
if (File.Exists(path) || AssetDatabase.LoadMainAssetAtPath(path) != null)
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
}
|
||||
}
|
||||
|
||||
public static string EnsureArtCollector()
|
||||
{
|
||||
var setting = BundleCollectorSettingData.Setting;
|
||||
setting.ShowPackageView = true;
|
||||
|
||||
var package = setting.Packages.Find(p => p.PackageName == ArtPackage);
|
||||
if (package == null)
|
||||
package = BundleCollectorSettingData.CreatePackage(ArtPackage);
|
||||
|
||||
package.PackageDesc = "角色/场景美术";
|
||||
package.EnableAddressable = true;
|
||||
package.SupportExtensionless = true;
|
||||
package.AutoCollectShaders = true;
|
||||
package.IgnoreRuleName = nameof(NormalIgnoreRule);
|
||||
BundleCollectorSettingData.ModifyPackage(package);
|
||||
|
||||
var group = package.Groups.Find(g => g.GroupName == "Characters");
|
||||
if (group == null)
|
||||
group = BundleCollectorSettingData.CreateGroup(package, "Characters");
|
||||
group.ActiveRuleName = nameof(EnableGroup);
|
||||
group.AssetTags = "art";
|
||||
BundleCollectorSettingData.ModifyGroup(package, group);
|
||||
|
||||
const string collectPath = "Assets/Bundles/Characters";
|
||||
var collector = group.Collectors.Find(c => c.CollectPath == collectPath);
|
||||
if (collector == null)
|
||||
{
|
||||
collector = new BundleCollector
|
||||
{
|
||||
CollectPath = collectPath,
|
||||
CollectorGUID = AssetDatabase.AssetPathToGUID(collectPath),
|
||||
CollectorType = ECollectorType.MainAssetCollector,
|
||||
AddressRuleName = nameof(AddressByFileName),
|
||||
PackRuleName = nameof(PackDirectory),
|
||||
FilterRuleName = nameof(CollectAll),
|
||||
AssetTags = "art",
|
||||
};
|
||||
BundleCollectorSettingData.CreateCollector(group, collector);
|
||||
}
|
||||
else
|
||||
{
|
||||
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collectPath);
|
||||
collector.AddressRuleName = nameof(AddressByFileName);
|
||||
collector.PackRuleName = nameof(PackDirectory);
|
||||
collector.FilterRuleName = nameof(CollectAll);
|
||||
BundleCollectorSettingData.ModifyCollector(group, collector);
|
||||
}
|
||||
|
||||
package.CheckConfigError();
|
||||
BundleCollectorSettingData.SaveFile();
|
||||
return $"package={ArtPackage} collect={collectPath} pack=PackDirectory";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15d1983461c3f204ca40fed18bc55a6f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,122 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
using YooAsset.Editor;
|
||||
|
||||
namespace AOT.Editor.YooAssetTools
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建 Art 包(角色等)并暂存 CDN / StreamingAssets。
|
||||
/// </summary>
|
||||
public static class BuildAndStageArt
|
||||
{
|
||||
public const string PackageName = "Art";
|
||||
public const string AppVersion = "1.0.0";
|
||||
public const string Channel = "wechat";
|
||||
|
||||
static string RepoRoot => Path.GetFullPath(Path.Combine(Application.dataPath, "..", ".."));
|
||||
static string CdnRoot => Path.Combine(RepoRoot, "Tools", "cdn_root");
|
||||
static string ProjectBundlesRoot => BundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||
|
||||
[MenuItem("AIGame/YooAsset/Build And Stage Art")]
|
||||
public static string BuildAndStage()
|
||||
{
|
||||
SetupM3Character.SetupAll();
|
||||
|
||||
var target = EditorUserBuildSettings.activeBuildTarget;
|
||||
string packageVersion = DateTime.Now.ToString("yyyyMMdd.HHmmss");
|
||||
var buildResult = BuildArtPackage(target, packageVersion);
|
||||
if (!buildResult.Success)
|
||||
return $"fail: {buildResult.ErrorInfo}";
|
||||
|
||||
string packageDir = buildResult.OutputPackageDirectory;
|
||||
string stageDir = Path.Combine(CdnRoot, Channel, AppVersion, PackageName);
|
||||
StageDirectory(packageDir, stageDir);
|
||||
|
||||
// 合并 version.json packages 列表
|
||||
MergeVersionPackages(packageVersion);
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
return $"ok ver={packageVersion} dir={packageDir} stage={stageDir}";
|
||||
}
|
||||
|
||||
static BuildResult BuildArtPackage(BuildTarget target, string packageVersion)
|
||||
{
|
||||
var uniqueBundleName = BundleCollectorSettingData.Setting.UniqueBundleName;
|
||||
var packRuleResult = DefaultBundlePackRule.CreateShadersPackRuleResult();
|
||||
var builtinShaderBundleName = packRuleResult.GetBundleName(PackageName, uniqueBundleName);
|
||||
|
||||
var buildParameters = new ScriptableBuildParameters
|
||||
{
|
||||
BuildOutputRoot = ProjectBundlesRoot,
|
||||
BundledFileRoot = BundleBuilderHelper.GetStreamingAssetsRoot(),
|
||||
BuildPipeline = EBuildPipeline.ScriptableBuildPipeline.ToString(),
|
||||
BuildBundleType = (int)EBundleType.AssetBundle,
|
||||
BuildTarget = target,
|
||||
PackageName = PackageName,
|
||||
PackageVersion = packageVersion,
|
||||
EnableSharePackRule = true,
|
||||
VerifyBuildingResult = true,
|
||||
FileNameStyle = EFileNameStyle.HashName,
|
||||
BundledCopyOption = EBundledCopyOption.ClearAndCopyAll,
|
||||
BundledCopyParams = string.Empty,
|
||||
CompressOption = ECompressOption.LZ4,
|
||||
ClearBuildCacheFiles = false,
|
||||
UseAssetDependencyDB = true,
|
||||
BuiltinShadersBundleName = builtinShaderBundleName,
|
||||
};
|
||||
|
||||
var pipeline = new ScriptableBuildPipeline();
|
||||
return pipeline.Run(buildParameters, true);
|
||||
}
|
||||
|
||||
static void StageDirectory(string src, string dst)
|
||||
{
|
||||
if (Directory.Exists(dst))
|
||||
Directory.Delete(dst, true);
|
||||
Directory.CreateDirectory(dst);
|
||||
foreach (var file in Directory.GetFiles(src, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
var rel = file.Substring(src.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
var destFile = Path.Combine(dst, rel);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(destFile) ?? dst);
|
||||
File.Copy(file, destFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void MergeVersionPackages(string resVersion)
|
||||
{
|
||||
var path = Path.Combine(CdnRoot, Channel, "version.json");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? CdnRoot);
|
||||
var localCdn = $"http://127.0.0.1:8787/{Channel}/{AppVersion}/{BuildAndStageHotUpdate.PackageName}";
|
||||
var json =
|
||||
"{\n" +
|
||||
$" \"appVersionMin\": \"{AppVersion}\",\n" +
|
||||
$" \"appVersionMax\": \"{AppVersion}\",\n" +
|
||||
$" \"resVersion\": \"{resVersion}\",\n" +
|
||||
$" \"cdnRoot\": \"{localCdn}\",\n" +
|
||||
" \"packages\": [ \"DefaultPackage\", \"Art\" ],\n" +
|
||||
" \"forceUpdate\": false,\n" +
|
||||
" \"notice\": \"\"\n" +
|
||||
"}\n";
|
||||
File.WriteAllText(path, json);
|
||||
File.WriteAllText(Path.Combine(Application.streamingAssetsPath, "cdn", "version.json"), json);
|
||||
|
||||
var prod =
|
||||
"{\n" +
|
||||
$" \"appVersionMin\": \"{AppVersion}\",\n" +
|
||||
$" \"appVersionMax\": \"{AppVersion}\",\n" +
|
||||
$" \"resVersion\": \"{resVersion}\",\n" +
|
||||
$" \"cdnRoot\": \"https://www.xworld.ren/{Channel}/{AppVersion}/{BuildAndStageHotUpdate.PackageName}\",\n" +
|
||||
" \"packages\": [ \"DefaultPackage\", \"Art\" ],\n" +
|
||||
" \"forceUpdate\": false,\n" +
|
||||
" \"notice\": \"\"\n" +
|
||||
"}\n";
|
||||
File.WriteAllText(Path.Combine(CdnRoot, Channel, "version.prod.json"), prod);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db0c7c0cdfa612f47bea89cc1bd02a6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,13 +3,12 @@ using AOT.Boot;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using YooAsset;
|
||||
|
||||
namespace AOT.Editor.YooAssetTools
|
||||
{
|
||||
/// <summary>
|
||||
/// 切换 BootDriver 的 M1 验证模式(Offline / Host / Direct)。
|
||||
/// 切换 BootDriver 的运行模式 / 服务器地址。
|
||||
/// </summary>
|
||||
public static class ConfigureBootPlayMode
|
||||
{
|
||||
@@ -30,6 +29,33 @@ namespace AOT.Editor.YooAssetTools
|
||||
versionUrl: "http://127.0.0.1:8787/wechat/version.json",
|
||||
defaultCdn: "http://127.0.0.1:8787/wechat/1.0.0/DefaultPackage");
|
||||
|
||||
[MenuItem("AIGame/Boot/Server/Production game.xworld.ren")]
|
||||
public static string SetServerProd() => ApplyServer(
|
||||
"https://game.xworld.ren",
|
||||
"wss://game.xworld.ren/ws?pid={pid}&token={token}");
|
||||
|
||||
[MenuItem("AIGame/Boot/Server/Local AIServer :8080")]
|
||||
public static string SetServerLocal() => ApplyServer(
|
||||
"http://127.0.0.1:8080",
|
||||
"ws://127.0.0.1:8080/ws?pid={pid}&token={token}");
|
||||
|
||||
static string ApplyServer(string httpBase, string wsTemplate)
|
||||
{
|
||||
var scene = EditorSceneManager.OpenScene(BootScene, OpenSceneMode.Single);
|
||||
var boot = Object.FindObjectOfType<BootDriver>();
|
||||
if (boot == null)
|
||||
return "fail: BootDriver not found in Boot scene";
|
||||
|
||||
var so = new SerializedObject(boot);
|
||||
var settings = so.FindProperty("settings");
|
||||
settings.FindPropertyRelative("HttpBase").stringValue = httpBase;
|
||||
settings.FindPropertyRelative("WsUrlTemplate").stringValue = wsTemplate;
|
||||
so.ApplyModifiedPropertiesWithoutUndo();
|
||||
EditorSceneManager.MarkSceneDirty(scene);
|
||||
EditorSceneManager.SaveScene(scene);
|
||||
return $"ok http={httpBase} ws={wsTemplate}";
|
||||
}
|
||||
|
||||
static string Apply(EPlayMode playMode, bool editorDirect, string versionUrl = null, string defaultCdn = null)
|
||||
{
|
||||
var scene = EditorSceneManager.OpenScene(BootScene, OpenSceneMode.Single);
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
using System.Collections;
|
||||
using AOT.Boot;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace HotUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// M3:加载示例角色 MaleExplorer 进场景。
|
||||
/// </summary>
|
||||
public sealed class CharacterSpawner : MonoBehaviour
|
||||
{
|
||||
public const string PrefabAddress = "MaleExplorer";
|
||||
public const string EditorPrefabPath = "Assets/Bundles/Characters/MaleExplorer/MaleExplorer.prefab";
|
||||
public const string ArtPackageName = "Art";
|
||||
|
||||
BootContext _ctx;
|
||||
GameObject _instance;
|
||||
|
||||
public void Bind(BootContext ctx) => _ctx = ctx;
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
StartCoroutine(SpawnCo());
|
||||
}
|
||||
|
||||
IEnumerator SpawnCo()
|
||||
{
|
||||
GameObject prefab = null;
|
||||
|
||||
// 1) YooAsset Art 包(Offline/Host 已初始化时)
|
||||
if (YooAssets.IsInitialized && YooAssets.TryGetPackage(ArtPackageName, out var art) &&
|
||||
art.InitializeStatus == EOperationStatus.Succeeded)
|
||||
{
|
||||
var handle = art.LoadAssetAsync<GameObject>(PrefabAddress);
|
||||
yield return handle;
|
||||
if (handle.Status == EOperationStatus.Succeeded)
|
||||
{
|
||||
prefab = handle.GetAssetObject<GameObject>();
|
||||
Debug.Log($"[CharacterSpawner] loaded from YooAsset Art address={PrefabAddress}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[CharacterSpawner] Art load failed: {handle.Error}");
|
||||
handle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
// 2) 编辑器直通:AssetDatabase
|
||||
#if UNITY_EDITOR
|
||||
if (prefab == null)
|
||||
{
|
||||
prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(EditorPrefabPath);
|
||||
if (prefab != null)
|
||||
Debug.Log($"[CharacterSpawner] loaded via AssetDatabase {EditorPrefabPath}");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (prefab == null)
|
||||
{
|
||||
Debug.LogError("[CharacterSpawner] MaleExplorer prefab not found");
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (_instance != null)
|
||||
Destroy(_instance);
|
||||
|
||||
_instance = Instantiate(prefab);
|
||||
_instance.name = "MaleExplorer_Runtime";
|
||||
_instance.transform.position = new Vector3(0f, 0f, 2.5f);
|
||||
DontDestroyOnLoad(_instance);
|
||||
|
||||
// 简易朝向相机
|
||||
var billboard = _instance.GetComponentInChildren<MeshRenderer>();
|
||||
if (billboard != null && Camera.main != null)
|
||||
{
|
||||
var t = billboard.transform;
|
||||
var cam = Camera.main.transform;
|
||||
var dir = cam.position - t.position;
|
||||
dir.y = 0f;
|
||||
if (dir.sqrMagnitude > 0.001f)
|
||||
t.rotation = Quaternion.LookRotation(-dir.normalized);
|
||||
}
|
||||
|
||||
// 调整主相机看向角色(竖屏)
|
||||
if (Camera.main != null)
|
||||
{
|
||||
var cam = Camera.main;
|
||||
cam.transform.position = new Vector3(0f, 1.4f, -1.2f);
|
||||
cam.transform.rotation = Quaternion.Euler(8f, 0f, 0f);
|
||||
cam.fieldOfView = 50f;
|
||||
cam.backgroundColor = new Color(0.45f, 0.62f, 0.78f);
|
||||
}
|
||||
|
||||
Debug.Log($"[CharacterSpawner] spawned ok res={_ctx?.ResVersion}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cd65ba42ca5feb4b9912b12d3edb8c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -36,6 +36,11 @@ namespace HotUpdate
|
||||
Debug.Log($"[HotUpdate] Bootstrap ready. CDN={_ctx?.CdnRoot}");
|
||||
EnsureHud();
|
||||
|
||||
// M3:示例角色(与网络并行,不依赖 WS)
|
||||
var spawner = gameObject.AddComponent<CharacterSpawner>();
|
||||
spawner.Bind(_ctx);
|
||||
spawner.Spawn();
|
||||
|
||||
_net = gameObject.AddComponent<GameNet>();
|
||||
_net.Bind(_ctx);
|
||||
_net.OnStatus += s =>
|
||||
@@ -45,7 +50,7 @@ namespace HotUpdate
|
||||
_net.OnWsReady += () =>
|
||||
{
|
||||
if (_hud != null)
|
||||
_hud.text = $"WS OK pid={_net.Session?.Pid}";
|
||||
_hud.text = $"WS OK pid={_net.Session?.Pid} | MaleExplorer";
|
||||
Debug.Log($"[HotUpdate] M2 WS ready pid={_net.Session?.Pid}");
|
||||
};
|
||||
_net.StartGuestSession();
|
||||
|
||||
@@ -28,7 +28,12 @@ namespace HotUpdate.Net
|
||||
public void Bind(BootContext boot)
|
||||
{
|
||||
_boot = boot;
|
||||
if (_boot != null && !string.IsNullOrEmpty(_boot.WsUrlTemplate))
|
||||
if (_boot == null) return;
|
||||
|
||||
if (!string.IsNullOrEmpty(_boot.HttpBase))
|
||||
HttpBase = _boot.HttpBase;
|
||||
|
||||
if (!string.IsNullOrEmpty(_boot.WsUrlTemplate))
|
||||
{
|
||||
// 旧模板只有 pid 时补上 token
|
||||
var tpl = _boot.WsUrlTemplate;
|
||||
|
||||
@@ -275,7 +275,8 @@ MonoBehaviour:
|
||||
DefaultCdnRoot: https://www.xworld.ren/wechat/1.0.0/DefaultPackage
|
||||
PackageName: DefaultPackage
|
||||
HotUpdateDllLocation: HotUpdate.Runtime
|
||||
WsUrlTemplate: wss://game.xworld.ren/ws?pid={pid}
|
||||
HttpBase: http://127.0.0.1:8080
|
||||
WsUrlTemplate: ws://127.0.0.1:8080/ws?pid={pid}&token={token}
|
||||
PlayMode: 1
|
||||
EditorDirectHotUpdate: 1
|
||||
AllowStreamingVersionFallback: 1
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c052dd71adfbe4c43883cfe3890c27ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"appVersionMin": "1.0.0",
|
||||
"appVersionMax": "1.0.0",
|
||||
"resVersion": "20260921.151412",
|
||||
"resVersion": "20260921.162205",
|
||||
"cdnRoot": "http://127.0.0.1:8787/wechat/1.0.0/DefaultPackage",
|
||||
"packages": [ "DefaultPackage" ],
|
||||
"packages": [ "DefaultPackage", "Art" ],
|
||||
"forceUpdate": false,
|
||||
"notice": ""
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfd46eb5439d69f40a326819e7449a7d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c006fc95ab2e2a94ab932f4e780a471d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b08706117575b1448b97dad966618dd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1 @@
|
||||
20260921.162205
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a79c8ae414118b43a0c61bf97427726
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c07a3598c9b7a4b48bdbfaf207b102d5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1 @@
|
||||
27be2f3e
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c20c4c67eee17441a2340c261467bb6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37cda0a6146d51a40be3a2106a5ad9e0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"FileVersion": 1,
|
||||
"PackageName": "Art",
|
||||
"PackageVersion": "20260921.162205",
|
||||
"Entries": [
|
||||
{
|
||||
"BundleGuid": "42dd6fb16989293c17dee4df4385c69a",
|
||||
"FileName": "42dd6fb16989293c17dee4df4385c69a.bundle"
|
||||
},
|
||||
{
|
||||
"BundleGuid": "5df3e28299f252104333a42f18c79ede",
|
||||
"FileName": "5df3e28299f252104333a42f18c79ede.bundle"
|
||||
},
|
||||
{
|
||||
"BundleGuid": "ec4f2a79e05292f37c2a9ca0f699a992",
|
||||
"FileName": "ec4f2a79e05292f37c2a9ca0f699a992.bundle"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ff0ff5f5f23b20468908b333794042d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3b303465611475448173599de5dae1a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user