Skip to content
Permalink
Browse files

Added ground portal

  • Loading branch information...
makitsune committed Apr 18, 2019
1 parent eb9daf4 commit 99f97b15a6a74485d430c63fd7057a572dfbcd2a
Showing with 48 additions and 0 deletions.
  1. +1 −0 README.md
  2. +47 −0 shaders/groundPortal.fs
@@ -43,6 +43,7 @@

- [Candy Spiral](https://hifi.maki.cat/shaders/candySpiral.fs)
- [Greenscreen](https://hifi.maki.cat/shaders/greenscreen.fs)
- [Ground Portal](https://hifi.maki.cat/shaders/groundPortal.fs)
- [Invisible](https://hifi.maki.cat/shaders/invisible.fs)
- [Lava Lamp](https://hifi.maki.cat/shaders/lavaLamp.fs)
- [Lava Lamp Image](https://hifi.maki.cat/shaders/lavaLampImage.fs)
@@ -0,0 +1,47 @@
/*
on a cylinder sized 1, 2, 1
{
"ProceduralEntity": {
"shaderUrl": "file:///D:/Users/Maki/Desktop/groundPortal.fs",
"version": 3
}
}
*/

vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

float getProceduralFragment(inout ProceduralFragment frag) {

float y = _position.y+0.18;
y += snoise(vec3(_texCoord01.xy*vec2(1.5,1)*16, iGlobalTime*0.25))*0.1;

if (y>-0.2) discard;

// vec3 color = vec3(0,
// _position.y + 0.6 + sin(iGlobalTime*4)*0.05,
// 1);

vec3 color = hsv2rgb(vec3(
(_position.y+(y*0.2))*2 + iGlobalTime*0.1, 1, 1
));

if (_position.y<-0.4999) {
float n = snoise(vec3(_position.xz*4, iGlobalTime*0.25));
vec3 newColor = hsv2rgb(vec3(n*8, 1, 1));

float l = length(_position.xz)*2;
color = mix(color, newColor, 1-l);
}

frag.emissive = color;
frag.diffuse = vec3(0);
frag.specular = vec3(0);
frag.metallic = 0;
frag.roughness = 1;
return 0;
}

0 comments on commit 99f97b1

Please sign in to comment.
You can’t perform that action at this time.