add ship, camera shake and 2nd fractal

This commit is contained in:
Cat Flynn 2021-01-07 05:44:42 +00:00
parent 470c1676ab
commit eb7826c7c7
19 changed files with 666 additions and 90 deletions

131
Assets/Materials/Ship.mat Normal file
View File

@ -0,0 +1,131 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ship
m_Shader: {fileID: 4800000, guid: 2a43d08d4163e8a49bb580da9d0e8574, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
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}
- _NoiseMap:
m_Texture: {fileID: 2800000, guid: 32d99a4d1161f0f4ca4fca2997778b37, type: 3}
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_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _FadeStrength: 0.9
- _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
- _Surface: 0
- _VertexScale: 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}
- _Color1: {r: 0.5411765, g: 1.8509804, b: 2, a: 1}
- _Color2: {r: 1.2078432, g: 0, b: 1.1058824, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &1642389398374086642
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: 4

View File

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

View File

@ -117,10 +117,11 @@ Material:
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _OverallPower: 1.2
- _OverallPower: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _ShakeStrength: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1

View File

@ -21,7 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: __TempUnlitPlayer
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0

8
Assets/Models.meta Normal file
View File

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

View File

@ -73,7 +73,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Path: Assets/FMOD/Desktop/Master.bank
Name: Master
lastModified: 637454808856759986
lastModified: 637455820886389038
LoadResult: 0
FileSizes: []
Exists: 1
@ -122,7 +122,7 @@ MonoBehaviour:
- {fileID: -4840949124066270359}
StringsBanks:
- {fileID: 2930724805879487167}
stringsBankWriteTime: 637454808856769971
stringsBankWriteTime: 637455820886398947
cacheVersion: 4
--- !u!114 &2930724805879487167
MonoBehaviour:
@ -138,7 +138,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
Path: Assets/FMOD/Desktop/Master.strings.bank
Name: Master.strings
lastModified: 637454808856769971
lastModified: 637455820886398947
LoadResult: 0
FileSizes:
- Name:

View File

@ -493,13 +493,53 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _ship
value:
objectReference: {fileID: 1639649353}
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _settings
value:
objectReference: {fileID: 11400000, guid: 65b0561f3154c9f438c3a1e1b443d03d, type: 2}
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _fractalAnimations.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _fractalAnimations.Array.data[0].name
value: _Fractality
objectReference: {fileID: 0}
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _fractalAnimations.Array.data[0].sample
value: 241
objectReference: {fileID: 0}
- target: {fileID: 2477419886909461543, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _fractalAnimations.Array.data[0].multiplier
value: 1000
objectReference: {fileID: 0}
- target: {fileID: 3397488660173986648, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: field of view
value: 60
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926092, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.x
value: 2268.2031
value: 2085.424
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.y
value: 1039.2305
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y
value: -8.773619
objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z
value: 846.83606
objectReference: {fileID: 0}
- target: {fileID: 3397488660859550700, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_Name
@ -549,6 +589,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3397488661354499723, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z
value: -100
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
--- !u!1 &1173812004
@ -560,8 +604,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1173812008}
- component: {fileID: 1173812007}
- component: {fileID: 1173812006}
- component: {fileID: 1173812005}
- component: {fileID: 1173812009}
- component: {fileID: 1173812010}
@ -588,55 +630,6 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1173812006
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1173812004}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
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: 91f85826a80e340dc930093507b30791, 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!33 &1173812007
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1173812004}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1173812008
Transform:
m_ObjectHideFlags: 0
@ -1009,7 +1002,7 @@ GameObject:
- component: {fileID: 1639649353}
- component: {fileID: 1639649352}
m_Layer: 6
m_Name: Cube
m_Name: Ship
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1022,13 +1015,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1639649350}
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
m_LocalPosition: {x: 0, y: 0, z: 0.45}
m_LocalScale: {x: 0.5, y: 1, z: 0.5}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.5, z: 0.6}
m_Children: []
m_Father: {fileID: 1173812008}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 45, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1639649352
BoxCollider:
m_ObjectHideFlags: 0
@ -1061,7 +1054,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 91f85826a80e340dc930093507b30791, type: 2}
- {fileID: 2100000, guid: 0cef45e7a8ed5434c82d2291106a3fff, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1090,7 +1083,7 @@ MeshFilter:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1639649350}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
m_Mesh: {fileID: -5495902117074765545, guid: c2fbec7900214e24ea3cad9629da11c2, type: 3}
--- !u!1 &1942400133
GameObject:
m_ObjectHideFlags: 0

View File

@ -11,17 +11,18 @@ using UnityEngine.Rendering.Universal;
public class AudioVisualizer : MonoBehaviour
{
[SerializeField] private Renderer _ship;
[SerializeField] private Renderer _fractal;
[SerializeField] private Renderer _tunnel;
[SerializeField] private AudioVisualizerSettings _settings;
// https://qa.fmod.com/t/getting-spectrum-of-master-channel-in-unity/12579/2
// private FMOD.Studio.EventInstance _event;
private FMOD.DSP _fft;
private float _initialPower;
private void Start()
{
// _event = RuntimeManager.CreateInstance("event:/Music");
@ -29,12 +30,12 @@ public class AudioVisualizer : MonoBehaviour
RuntimeManager.CoreSystem.createDSPByType(FMOD.DSP_TYPE.FFT, out _fft);
RuntimeManager.CoreSystem.getMasterChannelGroup(out var channelGroup);
channelGroup.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, _fft);
_settings.Initialise(_fractal.material, _tunnel.material);
_settings.Initialise(_fractal.material, _tunnel.material, _ship.material);
}
private void LateUpdate()
{
_settings.Update(_fft, _fractal, _tunnel);
_settings.Update(_fft, _fractal, _tunnel, _ship);
}
}
}

View File

@ -2,6 +2,7 @@ using System;
using System.Runtime.InteropServices;
using FMOD;
using UnityEngine;
using INITFLAGS = FMOD.Studio.INITFLAGS;
[CreateAssetMenu(menuName = "Audio Visualizer Settings")]
public class AudioVisualizerSettings : ScriptableObject
@ -21,25 +22,26 @@ public class AudioVisualizerSettings : ScriptableObject
[SerializeField] private ShaderPropertyAnimation[] _fractalAnimations;
[SerializeField] private ShaderPropertyAnimation[] _tunnelAnimations;
[SerializeField] private ShaderPropertyAnimation[] _shipAnimations;
public void Initialise(Material fractal, Material tunnel)
public void Initialise(Material fractal, Material tunnel, Material ship)
{
for (int i = 0; i < _fractalAnimations.Length; i++)
{
var anim = _fractalAnimations[i];
anim.Initial = fractal.GetFloat(anim.name);
_fractalAnimations[i] = anim;
}
InitialiseAnimations(_fractalAnimations, fractal);
InitialiseAnimations(_tunnelAnimations, tunnel);
InitialiseAnimations(_shipAnimations, ship);
}
for (int i = 0; i < _tunnelAnimations.Length; i++)
private void InitialiseAnimations(ShaderPropertyAnimation[] animations, Material material)
{
for (int i = 0; i < animations.Length; i++)
{
var anim = _tunnelAnimations[i];
anim.Initial = tunnel.GetFloat(anim.name);
_tunnelAnimations[i] = anim;
var anim = animations[i];
anim.Initial = material.GetFloat(anim.name);
animations[i] = anim;
}
}
public void Update(DSP fft, Renderer fractal, Renderer tunnel)
public void Update(DSP fft, Renderer fractal, Renderer tunnel, Renderer ship)
{
fft.getParameterData((int) FMOD.DSP_FFT.SPECTRUMDATA, out var unmanagedData, out var length);
var fftData = (FMOD.DSP_PARAMETER_FFT) Marshal.PtrToStructure(unmanagedData, typeof(FMOD.DSP_PARAMETER_FFT));
@ -63,5 +65,17 @@ public class AudioVisualizerSettings : ScriptableObject
tunnel.material.SetFloat(anim.name, anim.Initial + anim.multiplier * a);
}
UpdateAnimations(spectrum, _shipAnimations, ship);
}
private void UpdateAnimations(float[][] spectrum, ShaderPropertyAnimation[] animations, Renderer renderer)
{
for (int i = 0; i < animations.Length; i++)
{
var anim = animations[i];
var a = spectrum[anim.channel][anim.sample];
renderer.material.SetFloat(anim.name, anim.Initial + anim.multiplier * a);
}
}
}

View File

@ -26,3 +26,12 @@ MonoBehaviour:
multiplier: -1000
channel: 0
sample: 173
- name: _ShakeStrength
multiplier: 2
channel: 0
sample: 355
_shipAnimations:
- name: _VertexScale
multiplier: 3703.2
channel: 1
sample: 874

100
Assets/Shaders/ship.shader Normal file
View File

@ -0,0 +1,100 @@
// This shader draws a texture on the mesh.
Shader "custom/ship"
{
// The _BaseMap variable is visible in the Material's Inspector, as a field
// called Base Map.
Properties
{
[HDR] _Color1("Color 1", Color) = (1,1,1,1)
[HDR] _Color2("Color 2", Color) = (1,1,1,1)
_FadeStrength("Fade Strength", Float) = 0.1
_VertexScale("Vertex Scale", Float) = 0
_NoiseMap("Noise Map", 2D) = "black"
}
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalRenderPipeline" }
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
// The uv variable contains the UV coordinate on the texture for the
// given vertex.
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
// The uv variable contains the UV coordinate on the texture for the
// given vertex.
float2 uv : TEXCOORD0;
};
float4 _Color1;
float4 _Color2;
float _VertexScale;
float _FadeStrength;
// This macro declares _BaseMap as a Texture2D object.
TEXTURE2D(_BaseMap);
// This macro declares the sampler for the _BaseMap texture.
SAMPLER(sampler_BaseMap);
TEXTURE2D(_NoiseMap);
SAMPLER(sampler_NoiseMap);
CBUFFER_START(UnityPerMaterial)
// The following line declares the _BaseMap_ST variable, so that you
// can use the _BaseMap variable in the fragment shader. The _ST
// suffix is necessary for the tiling and offset function to work.
float4 _BaseMap_ST;
float4 _NoiseMap_ST;
CBUFFER_END
Varyings vert(Attributes IN)
{
Varyings OUT;
float3 vpos = IN.positionOS.xyz;
float3 wpos = TransformObjectToWorld(vpos);
float d = 1.0+length(wpos)*0.5;
float2 uv = wpos.yx;
// float noise = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, uv, 0) -0.5;
vpos += _VertexScale*float3(0,0,5)*d;
// noise *= d*d * 0.1;
// vpos *= lerp (0.9,1.1,noise);
OUT.positionHCS = TransformObjectToHClip(vpos);
// The TRANSFORM_TEX macro performs the tiling and offset
// transformation.
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
return OUT;
}
half4 frag(Varyings IN) : SV_Target
{
// calculate pixel
float2 res = _ScreenParams;
float2 p = -1.0+2.0*IN.positionHCS.xy/res.xy;
float t = length(p);
return lerp(_Color1,_Color2,t * _FadeStrength);
}
ENDHLSL
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2a43d08d4163e8a49bb580da9d0e8574
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,6 +13,8 @@ Shader "custom/tunnel"
_StarMap("Star Map", 2D) = "black"
_FractalMap("Fractal Map", 2D) = "black"
_ShakeStrength("Shake Strength", Float) = 0.01
_OverallPower("Overall Power", Float) = 1.0
}
@ -48,6 +50,8 @@ Shader "custom/tunnel"
float4 _NebulaColor2;
float4 _FractalColor;
float _ShakeStrength;
float _OverallPower;
TEXTURE2D(_NebulaMap);
@ -91,6 +95,13 @@ Shader "custom/tunnel"
float2 p = -1.0+2.0*IN.positionHCS.xy/res.xy;
p.x *= res.x/res.y;
float2 cameraShake;
float shake = _Time*50;
cameraShake.x = cos(shake*12.3341)+sin(shake*19.231057);
cameraShake.y = cos(shake*17.12311)+sin(shake*14.2315165);
cameraShake*=_ShakeStrength;
p += cameraShake;
// shared tunnel vars
float r = length(p);
float a = atan(p.y/p.x);
@ -137,26 +148,38 @@ Shader "custom/tunnel"
star *= r * r * 2.0;
// sample fractal
float fractalScale = 4.0;
float fractalScale = 6.0;
float fractalRotateSpeed = 20.0;
float fractalPower = 1.0;
float fractal_inner = 0.2;
// fractal uv
float2 fuv = p / fractalScale + float2(0.5,0.5);
fuv = rotateUV(fuv,_Time*fractalRotateSpeed);
half4 fractal = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv);
fractal *= _FractalColor;
fractal *= max(0, r-fractal_inner);
fractal *= fractalPower;
float2 fuv1 = p / fractalScale + float2(0.5,0.5);
fuv1 = rotateUV(fuv1,_Time*fractalRotateSpeed);
half4 fractal1 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv1);
fractal1 *= _FractalColor;
fractal1 *= max(0, r-fractal_inner);
fractal1 *= fractalPower*0.5;
// fractal 2
float2 fuv2 = rotateUV(fuv1,-_Time*fractalRotateSpeed*3.561);
fuv2.x=1.0-fuv2.x;
half4 fractal2 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv2);
fractal2 *= _FractalColor * sin(_Time*3);
fractal2 *= max(0, r-fractal_inner);
fractal2 *= fractalPower*0.5;
half4 fractal = max(fractal1,fractal2);
half4 color = half4(0,0,0,0);
color += nebula1;
color += nebula2;
color += fractal;
// color += fractal1;
// color += fractal2;
color += star;
saturate(color);
color = saturate(color);
color *= _OverallPower;
return color;

15
Assets/ShipGraphics.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Renderer))]
public class ShipGraphics : MonoBehaviour
{
private Renderer _renderer;
private void Awake()
{
_renderer = GetComponent<Renderer>();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f8df2e7d5a1ae6469f46ad810552f21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Textures/perlin.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,144 @@
fileFormatVersion: 2
guid: 32d99a4d1161f0f4ca4fca2997778b37
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
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
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ship.blend (Stored with Git LFS) Normal file

Binary file not shown.

102
Assets/ship.blend.meta Normal file
View File

@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: c2fbec7900214e24ea3cad9629da11c2
ModelImporter:
serializedVersion: 20200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 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: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
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
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant: