-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1058 from HifiExperiments/fallbacks
Custom shader fallbacks
- Loading branch information
Showing
8 changed files
with
81 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
vec3 getErrorColor() { | ||
vec3 positionWS = iWorldOrientation * (_positionMS.xyz * iWorldScale) + iWorldPosition; | ||
float checkSize = 0.1; | ||
vec3 edges = round(mod(positionWS, vec3(checkSize)) / checkSize); | ||
float checkerboard = mod(edges.x + edges.y + edges.z, 2.0); | ||
return mix(vec3(1, 0, 1), vec3(0.0), checkerboard); | ||
} | ||
|
||
// version 1 | ||
vec3 getProceduralColor() { | ||
return getErrorColor(); | ||
} | ||
|
||
// version 2 | ||
float getProceduralColors(inout vec3 diffuse, inout vec3 specular, inout float shininess) { | ||
diffuse = getErrorColor(); | ||
return 1.0; | ||
} | ||
|
||
// version 3 | ||
float getProceduralFragment(inout ProceduralFragment data) { | ||
data.emissive = getErrorColor(); | ||
return 1.0; | ||
} | ||
|
||
// version 4 | ||
float getProceduralFragmentWithPosition(inout ProceduralFragmentWithPosition data) { | ||
data.emissive = getErrorColor(); | ||
return 1.0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vec3 getSkyboxColor() { | ||
vec3 normal = normalize(_normal); | ||
float checkSize = 0.1; | ||
vec3 edges = round(mod(normal, vec3(checkSize)) / checkSize); | ||
float checkerboard = mod(edges.x + edges.y + edges.z, 2.0); | ||
return mix(vec3(1, 0, 1), vec3(0.0), checkerboard); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters