show some love to hyper
This commit is contained in:
1 parent
6da13bac1c
commit
15c8fce77c
52 files changed
+4091
-2008
No files matched your search
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
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: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: Global Volume Profile
|
||||
m_EditorClassIdentifier:
|
||||
components: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40548eb39c839cf408f1d70849380a53
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GradientExplorer : MonoBehaviour {
|
||||
|
||||
[SerializeField] private Material mat;
|
||||
[SerializeField] private Vector2 pos;
|
||||
[SerializeField] private float scale;
|
||||
[SerializeField] private float angle;
|
||||
|
||||
private Vector2 smoothPos;
|
||||
private float smoothScale;
|
||||
private float smoothAngle;
|
||||
|
||||
void FixedUpdate() {
|
||||
HandleUserInput();
|
||||
UpdateShader();
|
||||
}
|
||||
|
||||
private void HandleUserInput() {
|
||||
float scroll = Input.GetAxis("Mouse ScrollWheel");
|
||||
|
||||
if (scroll > 0f) {
|
||||
scale = Mathf.Max(scale *= 0.9f, 0.0002f);
|
||||
} else if (scroll < 0f) {
|
||||
scale *= 1.1f;
|
||||
scale = Mathf.Min(scale *= 1.1f, 10.0f);
|
||||
}
|
||||
|
||||
if (Input.GetKey(KeyCode.Q)) {
|
||||
angle -= 0.01f;
|
||||
} else if (Input.GetKey(KeyCode.E)) {
|
||||
angle += 0.01f;
|
||||
}
|
||||
|
||||
Vector2 dir = new Vector2(0.01f * scale, 0);
|
||||
float s = Mathf.Sin(angle);
|
||||
float c = Mathf.Cos(angle);
|
||||
dir = new Vector2(dir.x * c, dir.x * s);
|
||||
if (Input.GetKey(KeyCode.A)) {
|
||||
pos -= dir;
|
||||
|
||||
} else if (Input.GetKey(KeyCode.D)) {
|
||||
pos += dir;
|
||||
}
|
||||
|
||||
dir = new Vector2(-dir.y, dir.x);
|
||||
if (Input.GetKey(KeyCode.W)) {
|
||||
pos += dir;
|
||||
} else if (Input.GetKey(KeyCode.S)) {
|
||||
pos -= dir;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateShader() {
|
||||
smoothPos = Vector2.Lerp(smoothPos, pos, 0.03f);
|
||||
smoothScale = Mathf.Lerp(smoothScale, scale, 0.03f);
|
||||
smoothAngle = Mathf.Lerp(smoothAngle, angle, 0.03f);
|
||||
float aspect = (float) Screen.width / Screen.height;
|
||||
float scaleX = smoothScale;
|
||||
float scaleY = smoothScale;
|
||||
|
||||
if (aspect > 1f) {
|
||||
scaleY /= aspect;
|
||||
} else {
|
||||
scaleX *= aspect;
|
||||
}
|
||||
mat.SetVector("_Area", new Vector4(smoothPos.x, smoothPos.y, scaleX, scaleY));
|
||||
mat.SetFloat("_Angle", smoothAngle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52c0dfe22724326418ca290bf64ea1b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,282 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-5396277793910816254
|
||||
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 12
|
||||
hdPluginSubTargetMaterialVersions:
|
||||
m_Keys: []
|
||||
m_Values:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Julia
|
||||
m_Shader: {fileID: 4800000, guid: 78081ff9d4e002f459e8f2f4f31a48fd, type: 3}
|
||||
m_ShaderKeywords: _DISABLE_SSR_TRANSPARENT _NORMALMAP_TANGENT_SPACE
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- TransparentDepthPrepass
|
||||
- TransparentDepthPostpass
|
||||
- TransparentBackface
|
||||
- RayTracingPrepass
|
||||
- MOTIONVECTORS
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
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}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpectrumTexture:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThemeTexture:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
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:
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _AlphaToMask: 0
|
||||
- _AlphaToMaskInspectorValue: 0
|
||||
- _Angle: 0
|
||||
- _Anisotropy: 0
|
||||
- _Aspect: 1
|
||||
- _BlendMode: 0
|
||||
- _CoatMask: 0
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedGIMode: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _EscapeRadius: 2000
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1.5
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _Iterations: 229
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 1
|
||||
- _MaxIter: 555
|
||||
- _Metallic: 0
|
||||
- _MetallicRemapMax: 1
|
||||
- _MetallicRemapMin: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _OpaqueCullMode: 2
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _RayTracing: 0
|
||||
- _ReceivesSSR: 1
|
||||
- _ReceivesSSRTransparent: 0
|
||||
- _RefractionModel: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SpectrumSize: 4
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SpecularOcclusionMode: 1
|
||||
- _SrcBlend: 1
|
||||
- _StencilRef: 0
|
||||
- _StencilRefDepth: 8
|
||||
- _StencilRefGBuffer: 10
|
||||
- _StencilRefMV: 40
|
||||
- _StencilWriteMask: 6
|
||||
- _StencilWriteMaskDepth: 8
|
||||
- _StencilWriteMaskGBuffer: 14
|
||||
- _StencilWriteMaskMV: 40
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _TransparentZWrite: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _ZTestDepthEqualForOpaque: 3
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
- _Zoom: 4
|
||||
m_Colors:
|
||||
- _Area: {r: -0.124991395, g: 0.20505798, b: 4.982627, a: 2.6350431}
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Colors: {r: 4, g: 5, b: 6, a: 0}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _JuliaSeed: {r: 0.39, g: -0.2, b: 0, a: 0}
|
||||
- _Pan: {r: 0.75, g: 0, b: 0, a: 0}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e72888f9a1be07242a433eaf527e7772
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,99 @@
|
||||
Shader "Kaiju/Julia"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_Iterations("Iterations", range(0, 555)) = 255
|
||||
_Pan("Pan", vector) = (0.5, 0.0, 0.0, 0.0)
|
||||
_Zoom("Zoom", range(0, 4)) = 3
|
||||
_Aspect("Aspect", range(0, 4)) = 1
|
||||
_JuliaSeed("JuliaSeed", vector) = (0.39, -0.2, 0.0, 0.0)
|
||||
_Colors("Colors", vector) = (3.0, 4.0, 5.0, 0.0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// No culling or depth
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
// #pragma enable_d3d11_debug_symbols
|
||||
#pragma target 3.0
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
float _Iterations;
|
||||
float2 _Pan;
|
||||
float _Zoom;
|
||||
float _Aspect;
|
||||
float2 _JuliaSeed;
|
||||
float3 _Colors;
|
||||
|
||||
float ComputeValue(float2 v, float2 offset) {
|
||||
float vxsquare = 0;
|
||||
float vysquare = 0;
|
||||
|
||||
float iteration = 0;
|
||||
float lastIteration = _Iterations;
|
||||
|
||||
do {
|
||||
vxsquare = v.x * v.x;
|
||||
vysquare = v.y * v.y;
|
||||
|
||||
v = float2(vxsquare - vysquare, v.x * v.y * 2) + offset;
|
||||
|
||||
iteration++;
|
||||
|
||||
if ((lastIteration == _Iterations) && (vxsquare + vysquare) > 4.0) {
|
||||
lastIteration = iteration + 1;
|
||||
}
|
||||
} while (iteration < lastIteration);
|
||||
|
||||
return (float(iteration) - (log(log(sqrt(vxsquare + vysquare))) / log(2.0))) / float(_Iterations);
|
||||
}
|
||||
|
||||
float4 Mandelbrot_PixelShader(float2 texCoord : TEXCOORD0) : COLOR0 {
|
||||
float2 v = (texCoord - 0.5) * _Zoom * float2(1, _Aspect) - _Pan;
|
||||
float val = ComputeValue(v, v);
|
||||
return float4(sin(val * _Colors.x), sin(val * _Colors.y), sin(val * _Colors.z), 1);
|
||||
}
|
||||
|
||||
float4 Julia_PixelShader(float2 texCoord : TEXCOORD0) : COLOR0 {
|
||||
_JuliaSeed = float2(sin(_Time.y), cos(_Time.y));
|
||||
float2 v = (texCoord - 0.5) * _Zoom * float2(1, _Aspect) - _Pan;
|
||||
float val = ComputeValue(v, _JuliaSeed);
|
||||
return float4(sin(val * _Colors.x), sin(val * _Colors.y), sin(val * _Colors.z), 1);
|
||||
}
|
||||
|
||||
float4 frag (v2f i) : SV_Target {
|
||||
// return Julia_PixelShader(i.uv);
|
||||
return Mandelbrot_PixelShader(i.uv);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee8d9969094915f43867d728cbd4ff93
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,141 @@
|
||||
Shader "Kaiju/NtrJulia"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
// first two numbers are center of area, second two - size of area
|
||||
_Area("Area", vector) = (0, 0, 4 ,4)
|
||||
_Angle("Angle", range(-3.1415, 3.1415)) = 0
|
||||
_MaxIter("Max Iterations", range(0, 555)) = 255
|
||||
// _Speed("Speed", range(0, 1)) = 0.1
|
||||
_Colors("Colors", vector) = (0.5, 0.5, 0.5, 0.0)
|
||||
_EscapeRadius("EscapeRadius", range(2, 2000)) = 255
|
||||
|
||||
_SpectrumTexture("SpectrumTexture", 2D) = "white" {}
|
||||
_ThemeTexture("ThemeTexture", 2D) = "white" {}
|
||||
_SpectrumSize("SpectrumSize", float) = 16
|
||||
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
// No culling or depth
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 _Area;
|
||||
float _Angle;
|
||||
float _Speed;
|
||||
float _Symmetry;
|
||||
float _EscapeRadius;
|
||||
int _MaxIter;
|
||||
sampler2D _MainTex;
|
||||
sampler2D _SpectrumTexture;
|
||||
sampler2D _ThemeTexture;
|
||||
int _SpectrumSize;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target {
|
||||
// float2 uv = i.uv - 0.5;
|
||||
// float2 offset = _Area.xy + uv * _Area.zw;
|
||||
// float r = _EscapeRadius;
|
||||
// float r2 = r*r;
|
||||
|
||||
// float2 c = _Area.xy + uv * _Area.zw;
|
||||
|
||||
float2 uv = i.uv - 0.5;
|
||||
uv = abs(uv);
|
||||
uv = lerp(i.uv - 0.5, uv, _Symmetry);
|
||||
float2 c = _Area.xy + uv * _Area.zw;
|
||||
|
||||
// cool modulation
|
||||
float time = _Time.y;
|
||||
float sub = tex2D(_SpectrumTexture, 0.0);
|
||||
float bass = tex2D(_SpectrumTexture, 0.25);
|
||||
float mids = tex2D(_SpectrumTexture, 0.50);
|
||||
float highs = tex2D(_SpectrumTexture, 0.75);
|
||||
|
||||
// float r = lerp(2.0, 200, bass);
|
||||
float maxIterations = lerp(5.0, 200, bass);
|
||||
// float speed = sub * -scale;
|
||||
|
||||
// float maxIterations = _MaxIter;
|
||||
float r = _EscapeRadius;
|
||||
float speed = _Speed;
|
||||
|
||||
float2 z = 0;
|
||||
float2 zNext;
|
||||
int iter;
|
||||
for (iter = 0; iter < maxIterations; iter ++)
|
||||
{
|
||||
// f(z) = z^2 + c
|
||||
zNext.x = z.x * z.x - z.y * z.y + c.x;
|
||||
zNext.y = 2 * z.x * z.y + c.y;
|
||||
z = zNext;
|
||||
|
||||
// escaping?
|
||||
if (distance(z, float2(0,0)) > r)
|
||||
break;
|
||||
}
|
||||
|
||||
if (iter >= maxIterations) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
float val = iter / float(maxIterations);
|
||||
float band = (float(iter) % _SpectrumSize) / _SpectrumSize;
|
||||
|
||||
float smooth = (float(iter) - (log(log(sqrt(z.x * z.x + z.y * z.y))) / log(2.0))) / float(maxIterations);
|
||||
|
||||
// // distance
|
||||
// float dist = length(z); // distance from origin
|
||||
// // d(c) = |Z|·log|Z|/|Z'|
|
||||
// float d = 0.5*sqrt(dot(z,z)/dot(zNext,zNext))*log(dot(z,z));
|
||||
// return d;
|
||||
|
||||
float4 col = tex2D(_ThemeTexture, smooth * highs);
|
||||
return col;
|
||||
// return float4(sin(val), sin(val), sin(val), 1);
|
||||
|
||||
// float dist = length(z); // distance from origin
|
||||
// float fracIter = (dist - r) / (r2 - r); // linear interpolation
|
||||
// fracIter = log2(log(dist) / log(r) ); // double exponential interpolation
|
||||
// iter -= fracIter;
|
||||
// float m = sqrt(iter / _MaxIter);
|
||||
// float4 col = sin(float4(.3, .45, .65, 1) * m * 20)*.5 + .5; // procedural colors
|
||||
// col = tex2D(_MainTex, float2(m * _Repeat + _Time.y*_Speed, _Color));
|
||||
// col *= smoothstep(3, 0, fracIter);
|
||||
// float angle = atan2(z.x, z.y);
|
||||
// col *= 1 + sin(angle*2 + _Time.y*4)*.2;
|
||||
// return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78081ff9d4e002f459e8f2f4f31a48fd
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user