If I added commenting to the walk-through “ID” performed, would you find it helpful?

Try adding this shader to a regular Sphere Entity… the commenting should assist in helping diagnose what part of the maths does what.

For example, examine the shape of a Sine wave. It goes up and down up and down up and down forever. You as a programmer can leverage this. Arctangents can be used for radial effects… etc etc… too much information to put here, but what I can tell you is the “ocean” that I took from shadertoy and applied to HiFi, uses 3D Wave form functions.

Anyway, here is the code for a neat “eyeball” effect. Enjoy!

[code]

vec3 iResolution = vec3(iWorldScale.xz, 1.0);

vec3 col=vec3(1.0);

float hash( float n ) { return fract(sin(n)*753.5453123); }*

float noise( in vec2 x )

{

vec2 p = floor(x);

vec2 f = fract(x);

f = ff*(3.0-2.0*f);

```
float n = p.x + p.y*157.0;
return mix(
mix(
mix( hash(n+ 0.0), hash(n+ 1.0),f.x), mix( hash(n+157.0), hash(n+158.0),f.x), f.x
),
mix(
mix( hash(n+113.0), hash(n+114.0),f.x), mix( hash(n+270.0), hash(n+271.0),f.x), f.y
),
mix(
mix( hash(n+337.0), hash(n+339.0),f.y), mix( hash(n+559.0), hash(n+559.0),f.y), f.x
)
);
```

}

mat2 m = mat2( 0.8, 0.6, -0.6, 0.8);

float fbm( vec2 p )

{

float f = 0.0;

f += 0.5000*noise( p );*

p=m*2.02;*

f += 0.2500noise( p );

p*=m*2.03;*

f += 0.1250noise( p );

p*=m*2.01;*

f+= 0.0625noise( p );

p*=m*2.04;

f /= 0.9375;

return f;

}

void mainImage( out vec4 fragColor, in vec2 fragCoord )

{

vec2 q = fragCoord.xy / iResolution.xy;

vec2 p = -1.0 + 2.0*q;

//aspect ratio fix… divide the width by the height (landscape mode)

// p.x *= iResolution.x/iResolution.y;

```
//draw a circle with polar coordinates
float r = sqrt( dot(p,p)/2.6 );
float a = atan(p.y,p.x);
//animation
float ss = 0.5 + 0.5*sin(8.0*iGlobalTime);
float anim = 1.0 + 0.1*ss*clamp(1.0-r,0.0,1.0);
r *= anim;
if( r<0.9 )
{
//set the color of the eye
col = vec3( 0.2, 0.3, 0.4) ;
//add variation
float f = fbm( 1.173*p );
//mix the color into the variation
col = mix( col, vec3(0.2,0.5,0.4), f );
//add a new ring of color (this is a variation of the base color, so use f)
f = 1.0 - smoothstep(0.2, 0.5, r);
col = mix( col, vec3(0.9, 0.6, 0.2), f);
//apply some domain distortion (helps make things look organic and natural)
//adjust the amplitude and frequency to suit.
a += 0.1*fbm( 20.0 * p );
//add some white into it... (use polar coordinates so radiates from center)
//add some contrast by smoothstepping the fbm
f = smoothstep( 0.3, 1.0, fbm( vec2(5.0*r,20.0*a) ) );
col = mix(col, vec3(1.0), f);
//add different colors by copying the white addition...
//change the frequency of the fbm so they do not completely overlayp
f = smoothstep( 0.4, 0.9, fbm( vec2(10.0*r,15.0*a) ) );
//modulate the color by multiplying by f
col *= 1.0 - 0.5*f;
//add a volume effect to the eyeball
f = smoothstep( 0.5, 0.8, r);
col *= 1.0 - 0.5*f;
//add the pupil on top of the previously added iris
f = smoothstep ( 0.2, 0.23, r);
col *= f;
//anit-alias the edges
f = smoothstep( 0.75, 0.8, r);
col = mix( col, vec3(1.0), f );
}
fragColor = vec4(col,1.0);
```

}

vec4 getProceduralColor() {

vec2 position = _position.xz;

position += 0.5;

position.y = 1.0 - position.y;

vec4 result;

mainImage(result, position * iWorldScale.xz);

return result;

}[/code]