Init
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &8657994508396554482
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4517300031001485903}
|
||||
- component: {fileID: 599310164065243499}
|
||||
- component: {fileID: 291363790694747398}
|
||||
m_Layer: 0
|
||||
m_Name: MeshPrefab
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4517300031001485903
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8657994508396554482}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &599310164065243499
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8657994508396554482}
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!23 &291363790694747398
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8657994508396554482}
|
||||
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_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: e173931a61b20334c816019c984efc67, 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}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4f0c93a8d9784ffe9d5ea9b814e5751
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
%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: Wireframe-TransparentCulled
|
||||
m_Shader: {fileID: 4800000, guid: 4761bfc7de5950049b09d42773534fbf, type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _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}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _MaxTriSize: 25
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Thickness: 0.02
|
||||
- _UVSec: 0
|
||||
- _WireSmoothness: 3
|
||||
- _WireThickness: 430
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 0.0012459704, b: 0.32941177, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _FrontColor: {r: 1, g: 0.10325621, b: 0, a: 1}
|
||||
- _LineColor: {r: 0.13207549, g: 0.043194488, b: 0.047098953, a: 1}
|
||||
- _WireColor: {r: 0.8301887, g: 0.13053276, b: 0.13053276, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e298cff903f6d4edd9cb04da0c44d586
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
uniform float _WireThickness = 100;
|
||||
uniform float _WireSmoothness = 3;
|
||||
uniform float4 _WireColor = float4(0.0, 1.0, 0.0, 1.0);
|
||||
uniform float4 _BaseColor = float4(0.0, 0.0, 0.0, 0.0);
|
||||
uniform float _MaxTriSize = 25.0;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
float4 color : COLOR;
|
||||
|
||||
};
|
||||
|
||||
struct v2g
|
||||
{
|
||||
float4 projectionSpaceVertex : SV_POSITION;
|
||||
float4 worldSpacePosition : TEXCOORD1;
|
||||
float4 vertexColor : TEXCOORD2;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct g2f
|
||||
{
|
||||
float4 projectionSpaceVertex : SV_POSITION;
|
||||
float4 worldSpacePosition : TEXCOORD0;
|
||||
float4 dist : TEXCOORD1;
|
||||
float4 area : TEXCOORD2;
|
||||
float4 vertexColor : TEXCOORD3;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2g vert (appdata v)
|
||||
{
|
||||
v2g o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.projectionSpaceVertex = UnityObjectToClipPos(v.vertex);
|
||||
o.worldSpacePosition = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.vertexColor = v.color;
|
||||
return o;
|
||||
}
|
||||
|
||||
[maxvertexcount(3)]
|
||||
void geom(triangle v2g i[3], inout TriangleStream<g2f> triangleStream)
|
||||
{
|
||||
float2 p0 = i[0].projectionSpaceVertex.xy / i[0].projectionSpaceVertex.w;
|
||||
float2 p1 = i[1].projectionSpaceVertex.xy / i[1].projectionSpaceVertex.w;
|
||||
float2 p2 = i[2].projectionSpaceVertex.xy / i[2].projectionSpaceVertex.w;
|
||||
|
||||
float2 edge0 = p2 - p1;
|
||||
float2 edge1 = p2 - p0;
|
||||
float2 edge2 = p1 - p0;
|
||||
|
||||
float4 worldEdge0 = i[0].worldSpacePosition - i[1].worldSpacePosition;
|
||||
float4 worldEdge1 = i[1].worldSpacePosition - i[2].worldSpacePosition;
|
||||
float4 worldEdge2 = i[0].worldSpacePosition - i[2].worldSpacePosition;
|
||||
|
||||
// To find the distance to the opposite edge, we take the
|
||||
// formula for finding the area of a triangle Area = Base/2 * Height,
|
||||
// and solve for the Height = (Area * 2)/Base.
|
||||
// We can get the area of a triangle by taking its cross product
|
||||
// divided by 2. However we can avoid dividing our area/base by 2
|
||||
// since our cross product will already be double our area.
|
||||
float area = abs(edge1.x * edge2.y - edge1.y * edge2.x);
|
||||
float wireThickness = 800 - _WireThickness;
|
||||
|
||||
g2f o;
|
||||
|
||||
o.vertexColor = (i[0].vertexColor + i[1].vertexColor + i[2].vertexColor) / 3;
|
||||
o.area = float4(0, 0, 0, 0);
|
||||
o.area.x = max(length(worldEdge0), max(length(worldEdge1), length(worldEdge2)));
|
||||
|
||||
o.worldSpacePosition = i[0].worldSpacePosition;
|
||||
o.projectionSpaceVertex = i[0].projectionSpaceVertex;
|
||||
o.dist.xyz = float3( (area / length(edge0)), 0.0, 0.0) * o.projectionSpaceVertex.w * wireThickness;
|
||||
o.dist.w = 1.0 / o.projectionSpaceVertex.w;
|
||||
UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[0], o);
|
||||
triangleStream.Append(o);
|
||||
|
||||
o.worldSpacePosition = i[1].worldSpacePosition;
|
||||
o.projectionSpaceVertex = i[1].projectionSpaceVertex;
|
||||
o.dist.xyz = float3(0.0, (area / length(edge1)), 0.0) * o.projectionSpaceVertex.w * wireThickness;
|
||||
o.dist.w = 1.0 / o.projectionSpaceVertex.w;
|
||||
UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[1], o);
|
||||
triangleStream.Append(o);
|
||||
|
||||
o.worldSpacePosition = i[2].worldSpacePosition;
|
||||
o.projectionSpaceVertex = i[2].projectionSpaceVertex;
|
||||
o.dist.xyz = float3(0.0, 0.0, (area / length(edge2))) * o.projectionSpaceVertex.w * wireThickness;
|
||||
o.dist.w = 1.0 / o.projectionSpaceVertex.w;
|
||||
|
||||
UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[2], o);
|
||||
triangleStream.Append(o);
|
||||
}
|
||||
|
||||
fixed4 frag(g2f i) : SV_Target
|
||||
{
|
||||
float minDistanceToEdge = min(i.dist[0], min(i.dist[1], i.dist[2])) * i.dist[3];
|
||||
|
||||
// Early out if we know we are not on a line segment.
|
||||
if(minDistanceToEdge > 0.9 || i.area.x > _MaxTriSize)
|
||||
{
|
||||
return fixed4(_BaseColor.rgb,0);
|
||||
}
|
||||
|
||||
// Smooth our line out
|
||||
float t = exp2(_WireSmoothness * -1.0 * minDistanceToEdge * minDistanceToEdge);
|
||||
fixed4 finalColor = lerp(_BaseColor, i.vertexColor /* _WireColor */, t);
|
||||
|
||||
return finalColor;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6de3a5a2ac5ac54cbd0f26975069b8b
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
Shader "SuperSystems/Wireframe-Transparent-Culled"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_WireThickness ("Wire Thickness", RANGE(0, 800)) = 100
|
||||
_WireSmoothness ("Wire Smoothness", RANGE(0, 20)) = 3
|
||||
_WireColor ("Wire Color", Color) = (0.0, 1.0, 0.0, 1.0)
|
||||
_BaseColor ("Base Color", Color) = (0.0, 0.0, 0.0, 0.0)
|
||||
_MaxTriSize ("Max Tri Size", RANGE(0, 200)) = 25
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags {
|
||||
"IgnoreProjector"="True"
|
||||
//"Queue"="Transparent"
|
||||
"RenderType"="Transparent"
|
||||
}
|
||||
|
||||
//Pass
|
||||
//{
|
||||
// ZWrite On
|
||||
// ColorMask 0
|
||||
//}
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite On
|
||||
ZTest Less
|
||||
|
||||
// Wireframe shader based on the the following
|
||||
// http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma geometry geom
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "Wireframe.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa0ed226e9e93408592793185b5b38e9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user