First Skybox Shader I’ve completed. This is for those folks that would like a simple blue sky, and a simple blue ocean beneath them.

```
float time = iGlobalTime;
vec3 getSkyboxColor() {
vec3 rayDir = normalize(_normal);
float specialSauce = 0.0;
float dotProd = dot(rayDir, vec3(0.0, 1.0, 0.0));
specialSauce = pow(.5 - abs(dotProd), 2.0) + step(0.0, rayDir.y)*.3 + ((sin(rayDir.y)+cos(rayDir.x))*.002);
vec3 colorTransform = vec3(.47,.37,.05);
vec3 finalAnswer = pow(vec3(specialSauce), colorTransform);
return finalAnswer;
}
```

This is a lot more fun than I expected it to be.

New marquee shader. Certainly nothing to write home about (as the expression goes) but I intend to continue practicing with ShaderToy and working this into HiFi. I would like to integrate different shaders into an easy to use Interface as mentioned to @chris during the last meetup.

[code]

float disk(vec2 r, vec2 center, float radius) {

return 1.0 - smoothstep( radius-0.005, radius+0.005, length(r-center));

}

void mainImage( out vec4 fragColor, in vec2 fragCoord )

{

vec2 p = vec2(fragCoord.xy / iResolution.xy);

vec2 r = 2.0*vec2(fragCoord.xy - 0.5*iResolution.xy)/iResolution.y;

float xMax = iResolution.x/iResolution.y;

```
vec3 col1 = vec3(0.216, 0.471, 0.698); // blue
vec3 col2 = vec3(1.00, 0.329, 0.298); // red
vec3 col3 = vec3(0.867, 0.910, 0.247); // yellow
// theSpaceBetween creates a gap, 3.0 will be every-other slot
float theSpaceBetween = 3.0;
vec3 ret;
vec2 q = r + vec2(xMax*4./5.,0.);
ret = vec3(0.2);
// y coordinate depends on time
float y = iGlobalTime;
// mod constraints y to be between 0.0 and 2.0,
// and y jumps from 2.0 to 0.0
// substracting -1.0 makes y jump from 1.0 to -1.0
y = mod(y, 2.0) - 1.0;
//speed modifier added for those that want control...
// speedControl
float speedControl = 4.0;
for(float i=-2.0; i<2.0; i+=0.1) {
ret = mix(ret, col3, disk(q, vec2((theSpaceBetween*i+i)+(y*1.3*speedControl), 0.5), 0.1) );
}
vec3 pixel = ret;
fragColor = vec4(pixel, 1.0);
```

} [/code]

This will create a set of simple yellow circles **moving** across the frame:

Again, nothing to get SUPER excited about, but I will continue to focus on this aspect as it is enjoyable for me. Do we currently have the ability to add shader to normal .fbx entity? In practice, I would likely create regular marquee “bulbs” and a single shader could be applied to them all. The shader would take care of operating illumination based on entity location.

There are MANY interesting things we can do with this level of shader support!

PlasmaShader from ShaderFrog + ParticleEmitter from HiFi = RayGun

I’ve just uploaded a new shader to http://metaversecafe.com/HighFidelity/QueenCity/shaders/eyeball_green.fs

https://youtu.be/Ah-gf0hNS14

This eyeball shader is a tutorial by IQ, I have learned a lot from this tutorial. Unfortunately, you cannot seem to use noise textures so I borrowed a hash function to achieve the desired effect. Here is the code annotated with comments from what I learned during the tutorial. Please note converting these shaders from pure GLSL into HiFi can be tricky.

```
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 = f*f*(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.2500*noise( p );
p*=m*2.03;
f += 0.1250*noise( p );
p*=m*2.01;
f+= 0.0625*noise( 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;
}
```

**Also desired is the opportunity to apply these shaders to custom .fbx and .obj entities!**