Previously wrote a Mandelbrot set of code here
This time the main write Julia set
Each point in the Mandelbrot set corresponds to a connected Julia set, and the points outside the Mandelbrot set correspond to the disconnected Julia set
The Julia Collection can be iteratively iterated by the following: F (z) = z^2 + C
This article (www.matrix67.com/blog/archives/4570) speaks in great detail
The number of iterations, the C value can be adjusted, first to see the effect:
Code here:
Shader "Custom/julia1x" {Properties {_maintex ("Noise", 2D) = "White" {}_maxiters ("Max iters", Range (0,85)) = 1//Iteration number _CR (" CR ", Range ( -1,1)) = -0.7//y of C_ci (" CI ", Range ( -1,1)) = -0.7//x of C_ts (" TS ", Range (0,15)) = 1//x scaling _cs (" CS ", Range (0,15)) = 1// Y scale _s0 ("S0", Range ( -3,3)) = 0.5//x offset _t0 ("T0", Range ( -3,3)) = 0.5//y offset _limits ("Ilimits", Range (0,19)) = 5_concolor (" Concolor ", color) = (1,1,1,1) _divcolor1 (" Diverge Color1 ", color) = (1,1,1,1) _divcolor2 (" Diverge Color2 ", color) = ( 1,1,1,1)}subshader {pass{tags{"lightmode" = "forwardbase"}cull offcgprogram#pragma vertex vert#pragma fragment frag# Include "Unitycg.cginc" Float4 _lightcolor0;int _maxiters;float _ts;float _cs;float _s0;float _t0;float _Limits;float _ Cr;float _ci;float4 _concolor;float4 _divcolor1;float4 _divcolor2;float4 _maintex_st;struct v2f {float4 pos:SV_ Position;float2 uv_maintex:texcoord0;}; v2f Vert (Appdata_full v) {v2f o;o.pos=mul (unity_matrix_mvp,v.vertex); O.uv_maintex = Transform_tex (v.texcoord,_ Maintex); return o;} FLOAT4 Frag (v2f i): COLOr{float real = i.uv_maintex.x * _ts + _s0;//xfloat imag = i.uv_maintex.y * _cs + _t0;//yfloat newr;int NUMITERS;FLOAT4 Co Lor = 0;for (numiters = 0;numiters < _maxiters;numiters++) {float newreal = real * Real;float newimag = imag * imag;new r = newreal + newimag;if (newr >= _limits) Break;imag = Real * imag * 2;real = newreal-newimag;real + = _cr;imag + = _CI; }if (newr<_limits) color = _concolor;if (newr>_limits) color = Lerp (_divcolor1,_divcolor2, Frac (Numiters/_cs)); return color;} endcg}//}}
-----------------------by wolf96 http://blog.csdn.net/wolf96
Unity3d Shader's Julia set and Mandelbrot set drawing beautiful pattern (ii)