update materials

This commit is contained in:
DCFApixels 2025-03-03 15:56:20 +08:00
parent b6f9a5d25a
commit 3d61f68830
14 changed files with 333 additions and 17 deletions

View File

@ -202,7 +202,7 @@ namespace DCFApixels
public void Render(Camera camera, GizmosList<WidthLineGizmo> list, CommandBuffer cb)
{
if (camera == null) { return; }
default(UnlitMat).GetMaterial().SetPass(0);
default(UnlitOverwriteMat).GetMaterial().SetPass(0);
GL.Begin(GL.QUADS);
Vector3 cameraPosition = camera.transform.position;
foreach (ref readonly var item in list)
@ -256,7 +256,7 @@ namespace DCFApixels
public void Render(Camera camera, GizmosList<WidthOutLineGizmo> list, CommandBuffer cb)
{
if (camera == null) { return; }
default(GeometryUnlitMat).GetMaterial().SetPass(0);
default(UnlitOverwriteMat).GetMaterial().SetPass(0);
GL.Begin(GL.LINES);
var cameraPosition = camera.transform.position;
foreach (ref readonly var item in list)
@ -318,7 +318,7 @@ namespace DCFApixels
{
if (camera == null) { return; }
GL.PushMatrix();
default(GeometryUnlitMat).GetMaterial().SetPass(0);
default(UnlitOverwriteMat).GetMaterial().SetPass(0);
GL.Begin(GL.LINES);
var cameraPosition = camera.transform.position;
foreach (ref readonly var item in list)

View File

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

View File

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

View File

@ -28,7 +28,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 5, y: 0, z: 0}
m_LocalScale: {x: 0.4, y: 0.4, z: 0.4}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2844384060761577604}
@ -113,7 +113,7 @@ Transform:
m_GameObject: {fileID: 549390746132496352}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 12.5, y: 0, z: 0}
m_LocalPosition: {x: -5, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -375,12 +375,99 @@ Transform:
m_Children:
- {fileID: 7102811099700317182}
- {fileID: 3483107355985596037}
- {fileID: 5856182649114152335}
- {fileID: 2770005348449356163}
- {fileID: 5119875421667202613}
- {fileID: 1046323005297189095}
- {fileID: 7483746332942052062}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6318046265503597909
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5856182649114152335}
- component: {fileID: 3055054048754907788}
- component: {fileID: 7647598428113518526}
m_Layer: 0
m_Name: UnlitOverwrite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5856182649114152335
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6318046265503597909}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.5, y: -2.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2844384060761577604}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3055054048754907788
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6318046265503597909}
m_Mesh: {fileID: 4300000, guid: 873de0939b7f76947a258a8897199a8e, type: 2}
--- !u!23 &7647598428113518526
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6318046265503597909}
m_Enabled: 1
m_CastShadows: 1
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_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: e3db4ecf82b06ef4fa7fdb30e68362fa, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 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!1 &6563773915565914195
GameObject:
m_ObjectHideFlags: 0

View File

@ -6,10 +6,12 @@ Shader "DCFApixels/DebugX/Handles Buillboard"
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off Fog { Mode Off }
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest On

View File

@ -6,10 +6,12 @@ Shader "DCFApixels/DebugX/Handles Dot"
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off Fog { Mode Off }
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest On
@ -77,6 +79,7 @@ Shader "DCFApixels/DebugX/Handles Dot"
//o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color * UNITY_ACCESS_INSTANCED_PROP(Props, _Color) * _DebugX_GlobalColor;
return o;
}
ENDCG

View File

@ -6,10 +6,12 @@ Shader "DCFApixels/DebugX/Handles Lit"
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off Fog { Mode Off }
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest On

View File

@ -1,4 +1,4 @@
Shader "DCFApixels/DebugX/Handles"
Shader "DCFApixels/DebugX/Handles Unlit"
{
Properties
{
@ -6,10 +6,12 @@ Shader "DCFApixels/DebugX/Handles"
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off Fog { Mode Off }
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest On

View File

@ -0,0 +1,61 @@
Shader "DCFApixels/DebugX/Handles Unlit Overwrite"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
half4 color : COLOR;
};
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
UNITY_INSTANCING_BUFFER_END(Props)
float4 _DebugX_GlobalColor;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color * UNITY_ACCESS_INSTANCED_PROP(Props, _Color) * _DebugX_GlobalColor;
return o;
}
half4 frag (v2f i) : SV_Target
{
return i.color;
}
ENDCG
}
}
}

View File

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

View File

@ -6,11 +6,12 @@ Shader "DCFApixels/DebugX/Handles Wire"
}
SubShader
{
Tags { "ForceSupported" = "True" "Queue" = "Transparent" }
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off Cull Off Fog { Mode Off }
Offset -1, -1
ZWrite Off
Fog { Mode Off }
Lighting Off
Offset -1, -1
ZTest Off

View File

@ -44,6 +44,7 @@ namespace DCFApixels.DebugXCore
{
public readonly Material Lit;
public readonly Material Unlit;
public readonly Material UnlitOverwrite;
public readonly Material Billboard;
public readonly Material Dot;
public readonly Material Wire;

View File

@ -39,6 +39,11 @@ namespace DCFApixels.DebugXCore
public int GetExecuteOrder() => 1_000_000;
public Material GetMaterial() => DebugXAssets.Materials.Unlit;
}
public readonly struct UnlitOverwriteMat : IStaticMaterial
{
public int GetExecuteOrder() => 1_000_000;
public Material GetMaterial() => DebugXAssets.Materials.UnlitOverwrite;
}
public readonly struct WireMat : IStaticMaterial
{
public int GetExecuteOrder() => 1_000_000;