From 05870741495ed6063dc13c8e4b3991e399bdd4a8 Mon Sep 17 00:00:00 2001 From: Legonzaur Date: Fri, 6 Jan 2023 14:43:29 +0100 Subject: [PATCH] Test Hologram --- Assets/Materials/Hologram.mat | 80 +++++++++++++++++++++++++++ Assets/Materials/Hologram.mat.meta | 8 +++ Assets/Materials/Hologram.shader | 53 ++++++++++++++++++ Assets/Materials/Hologram.shader.meta | 10 ++++ Assets/Scenes/SampleScene.unity | 53 +++++++++++++++--- 5 files changed, 196 insertions(+), 8 deletions(-) create mode 100644 Assets/Materials/Hologram.mat create mode 100644 Assets/Materials/Hologram.mat.meta create mode 100644 Assets/Materials/Hologram.shader create mode 100644 Assets/Materials/Hologram.shader.meta diff --git a/Assets/Materials/Hologram.mat b/Assets/Materials/Hologram.mat new file mode 100644 index 0000000..e737665 --- /dev/null +++ b/Assets/Materials/Hologram.mat @@ -0,0 +1,80 @@ +%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: Hologram + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + 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 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/Hologram.mat.meta b/Assets/Materials/Hologram.mat.meta new file mode 100644 index 0000000..7fde33a --- /dev/null +++ b/Assets/Materials/Hologram.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d409ee3fc36caaa48af46d3417777a49 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Hologram.shader b/Assets/Materials/Hologram.shader new file mode 100644 index 0000000..4337c5c --- /dev/null +++ b/Assets/Materials/Hologram.shader @@ -0,0 +1,53 @@ +Shader "Cg shading in world space" { + SubShader { + Pass { + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + // uniform float4x4 unity_ObjectToWorld; + // automatic definition of a Unity-specific uniform parameter + + struct vertexInput { + float4 vertex : POSITION; + }; + struct vertexOutput { + float4 pos : SV_POSITION; + float4 position_in_world_space : TEXCOORD0; + }; + + vertexOutput vert(vertexInput input) + { + vertexOutput output; + + output.pos = UnityObjectToClipPos(input.vertex); + output.position_in_world_space = + mul(unity_ObjectToWorld, input.vertex); + // transformation of input.vertex from object + // coordinates to world coordinates; + return output; + } + + float4 frag(vertexOutput input) : COLOR + { + // computes the distance between the fragment position + // and the origin (the 4th coordinate should always be + // 1 for points). + return float4(fmod(input.position_in_world_space.x,1), input.position_in_world_space.y % 1, input.position_in_world_space.z % 1, 1.0); + /*if (input.position_in_world_space.x % 1 < .5) + { + return float4(0.0, 1.0, 0.0, 1.0); + // color near origin + } + else + { + return float4(0.1, 0.1, 0.1, 1.0); + // color far from origin + }*/ + } + + ENDCG + } + } +} \ No newline at end of file diff --git a/Assets/Materials/Hologram.shader.meta b/Assets/Materials/Hologram.shader.meta new file mode 100644 index 0000000..18c5a36 --- /dev/null +++ b/Assets/Materials/Hologram.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 545f09bbeef645047bfe01d94ee1d5e7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 92f04b2..57a8997 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -98,7 +98,7 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_LightingSettings: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 78c35acc26a1c294ba9f813355bb3133, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -890,21 +890,25 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 2048859290140646716, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} propertyPath: m_RootOrder value: 5 objectReference: {fileID: 0} - target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} propertyPath: m_LocalPosition.x - value: 14.37756 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} propertyPath: m_LocalPosition.y - value: 0.72900635 + value: 14.03 objectReference: {fileID: 0} - target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} propertyPath: m_LocalPosition.z - value: -11.051812 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} propertyPath: m_LocalRotation.w @@ -938,8 +942,41 @@ PrefabInstance: propertyPath: m_Name value: Simple table objectReference: {fileID: 0} + - target: {fileID: 4158574887593288270, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6146061087085142095, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} +--- !u!1 &802608892 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4158574887593288270, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3} + m_PrefabInstance: {fileID: 785354656} + m_PrefabAsset: {fileID: 0} +--- !u!95 &802608893 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802608892} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: cc1aaeac5f0c76e47baa675f0d00fd50, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 --- !u!1001 &807225988 PrefabInstance: m_ObjectHideFlags: 0 @@ -1394,7 +1431,7 @@ PrefabInstance: objectReference: {fileID: 511198038} - target: {fileID: 2066526415779655844, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_VersionIndex - value: 18 + value: 21 objectReference: {fileID: 0} - target: {fileID: 2066526415779655844, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_MeshFormatVersion @@ -1438,7 +1475,7 @@ PrefabInstance: objectReference: {fileID: 759230817} - target: {fileID: 2066526415937511098, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_VersionIndex - value: 18 + value: 21 objectReference: {fileID: 0} - target: {fileID: 2066526415937511098, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_MeshFormatVersion @@ -1662,7 +1699,7 @@ PrefabInstance: objectReference: {fileID: 333828849} - target: {fileID: 2066526416385322603, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_VersionIndex - value: 18 + value: 21 objectReference: {fileID: 0} - target: {fileID: 2066526416385322603, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_MeshFormatVersion @@ -1806,7 +1843,7 @@ PrefabInstance: objectReference: {fileID: 1934981378} - target: {fileID: 7224646667630721399, guid: 2765b8bb888e7a849a369ef050911813, type: 3} propertyPath: m_VersionIndex - value: 15 + value: 18 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2765b8bb888e7a849a369ef050911813, type: 3}