add distorted julia fractal
This commit is contained in:
parent
7b674c3209
commit
9216a22a79
7 changed files with 358 additions and 3 deletions
85
Assets/julia/JuliaFractal Distorted.mat
Normal file
85
Assets/julia/JuliaFractal Distorted.mat
Normal file
|
@ -0,0 +1,85 @@
|
|||
%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: JuliaFractal Distorted
|
||||
m_Shader: {fileID: 4800000, guid: 284dd8a7ee30dc2c2b1a02cf67bea87f, type: 3}
|
||||
m_ShaderKeywords:
|
||||
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_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _Emission: 0.4
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _MaxIter: 100
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _RadiusX: 0.5
|
||||
- _RadiusY: 0.7
|
||||
- _RotSpeed: 0.02
|
||||
- _ShowPos: 0.01
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _TimeOffset: 0
|
||||
- _TimeScale: 0.49
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
8
Assets/julia/JuliaFractal Distorted.mat.meta
Normal file
8
Assets/julia/JuliaFractal Distorted.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: adae450a3eab1810ea0a781fbb2d522f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -7,7 +7,7 @@ Material:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: JuliaFractalSurface
|
||||
m_Name: JuliaFractal
|
||||
m_Shader: {fileID: 4800000, guid: ae70931944742e950b6f8634871f0b12, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
|
|
|
@ -121,6 +121,185 @@ NavMeshSettings:
|
|||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &936926409
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 936926414}
|
||||
- component: {fileID: 936926413}
|
||||
- component: {fileID: 936926412}
|
||||
- component: {fileID: 936926411}
|
||||
- component: {fileID: 936926410}
|
||||
m_Layer: 0
|
||||
m_Name: JuliaFractal (Distorted)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!65 &936926410
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 936926409}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 2, y: 2, z: 0.02}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &936926411
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 936926409}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gripType: 1
|
||||
gripOrigin: {fileID: 0}
|
||||
disallowTheft: 0
|
||||
maximumGrabDistance: 0
|
||||
snappingReferences: []
|
||||
autoHold: 0
|
||||
ikReference: {fileID: 0}
|
||||
--- !u!114 &936926412
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 936926409}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
type: 3
|
||||
objectId: ac4f08f0-b708-4b45-9146-9d5a7a936fdd
|
||||
--- !u!114 &936926413
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 936926409}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
spawnHeight: 1
|
||||
useAdditionalValues: 0
|
||||
syncValues: []
|
||||
propPrivacy: 1
|
||||
subSyncs: []
|
||||
spawnableType: 0
|
||||
preGeneratedInstanceId:
|
||||
--- !u!4 &936926414
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 936926409}
|
||||
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1165066220}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
||||
--- !u!1 &1165066219
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1165066220}
|
||||
- component: {fileID: 1165066222}
|
||||
- component: {fileID: 1165066221}
|
||||
m_Layer: 0
|
||||
m_Name: Quad
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1165066220
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1165066219}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 936926414}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1165066221
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1165066219}
|
||||
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_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: adae450a3eab1810ea0a781fbb2d522f, 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
|
||||
--- !u!33 &1165066222
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1165066219}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &1241163025
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -182,7 +361,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1241163025}
|
||||
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalPosition: {x: 3, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1308836998}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Shader "CrispyPin/JuliaFractalSurface"
|
||||
Shader "CrispyPin/JuliaFractal"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
|
74
Assets/julia/julia_fractal_distorted.shader
Normal file
74
Assets/julia/julia_fractal_distorted.shader
Normal file
|
@ -0,0 +1,74 @@
|
|||
Shader "CrispyPin/JuliaFractalDistorted"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[HideInInspector]
|
||||
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
||||
_MaxIter ("Max iterations", int) = 100
|
||||
_RotSpeed ("Rotation speed", float) = 0.2
|
||||
_RadiusX ("Rotation radius X", Range(0, 2)) = 1
|
||||
_RadiusY ("Rotation radius Y", Range(0, 2)) = 1
|
||||
_Emission ("Emission", Range(0, 1)) = 0.2
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Cull off
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
float3 worldPos;
|
||||
};
|
||||
|
||||
half _RadiusX;
|
||||
half _RadiusY;
|
||||
half _Emission;
|
||||
float _RotSpeed;
|
||||
int _MaxIter;
|
||||
|
||||
// // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
|
||||
// // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
|
||||
// // #pragma instancing_options assumeuniformscaling
|
||||
// UNITY_INSTANCING_BUFFER_START(Props)
|
||||
// // put more per-instance properties here
|
||||
// UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
float2 pos = IN.uv_MainTex * 4 - 2;
|
||||
float angle = _Time.y * _RotSpeed + IN.worldPos.x * IN.worldPos.y;
|
||||
float2 offset = float2(sin(angle) * _RadiusX, cos(angle) * _RadiusY);
|
||||
|
||||
int i = 0;
|
||||
while (pos.x * pos.x + pos.y * pos.y < 4 && i < _MaxIter)
|
||||
{
|
||||
float temp_x = pos.x * pos.x - pos.y * pos.y;
|
||||
pos.y = 2 * pos.x * pos.y + offset.y;
|
||||
pos.x = temp_x + offset.x;
|
||||
i++;
|
||||
}
|
||||
|
||||
fixed3 col =
|
||||
min(
|
||||
pow(
|
||||
fixed3(5, 2, 11) * i / (float)_MaxIter
|
||||
, 2)
|
||||
, 1);
|
||||
o.Albedo = col;
|
||||
o.Emission = col * _Emission;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
9
Assets/julia/julia_fractal_distorted.shader.meta
Normal file
9
Assets/julia/julia_fractal_distorted.shader.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 284dd8a7ee30dc2c2b1a02cf67bea87f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue