Skip to content

Commit

Permalink
Added SBS image shader
Browse files Browse the repository at this point in the history
  • Loading branch information
makidoll committed Apr 14, 2019
1 parent 13bdb74 commit 2f48dd4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -50,7 +50,8 @@
- [Portal](https://hifi.maki.cat/shaders/portal.fs)
- [Portal Minimal](https://hifi.maki.cat/shaders/portalMinimal.fs)
- [Reflective Sphere](https://hifi.maki.cat/shaders/reflectiveSphere.fs)
- [Stereo Image](https://hifi.maki.cat/shaders/stereoImage.fs)
- [Reflective Sphere](https://hifi.maki.cat/shaders/reflectiveSphere.fs)
- [SBS Image](https://hifi.maki.cat/shaders/sbsImage.fs)
- [TV](https://hifi.maki.cat/shaders/tv.fs)
- [Water](https://hifi.maki.cat/shaders/water.fs)

Expand Down
41 changes: 41 additions & 0 deletions shaders/sbsImage.fs
@@ -0,0 +1,41 @@
/*
{
"ProceduralEntity": {
"shaderUrl": "https://hifi.maki.cat/shaders/SBSimage.fs",
"channels": ["https://cutelab.space/u/V1RdYM.jpg"],
"uniforms": {
"alphaClipping": 0.5,
"fullbright": 0,
},
"version": 3
}
}
*/

uniform float alphaClipping = 0.5;
uniform float fullbright = 0;
uniform float specular = 0;

float getProceduralFragment(inout ProceduralFragment frag) {
vec2 uv = _position.xy+0.5;
uv.y *= -1;
uv.x *= 0.5;
uv.x += cam_getStereoSide()*0.5; // right eye

vec4 image = texture(iChannel0, uv).rgba;
if (image.a < alphaClipping) discard;
vec3 color = image.rgb;

if (fullbright>0.5) {
frag.emissive = color;
frag.diffuse = vec3(0);
} else {
frag.diffuse = color;
}

frag.specular = vec3(0);
frag.occlusion = 0;
frag.roughness = 1;

return 0;
}
24 changes: 0 additions & 24 deletions shaders/stereoImage.fs

This file was deleted.

0 comments on commit 2f48dd4

Please sign in to comment.