-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New XRay shader and minor fixes (#27)
- Loading branch information
1 parent
8afff59
commit f45919c
Showing
51 changed files
with
376 additions
and
6,501 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
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,45 @@ | ||
//pref | ||
Ambient|float|0|0.5|1 | ||
EdgeFallOff|float|0|1|4 | ||
Intensity|float|0|0.5|4 | ||
DimBackfaces|bool|false | ||
AOradius|float|0|0|16 | ||
XRay|set|1|1|1 | ||
Use with dark background color.|note | ||
//vert | ||
#version 330 | ||
layout(location = 0) in vec3 Vert; | ||
layout(location = 3) in vec3 Norm; | ||
layout(location = 6) in vec4 Clr; | ||
out vec3 vClr, vN, vV; | ||
out vec4 vP; | ||
uniform mat4 ModelViewProjectionMatrix; | ||
uniform mat4 ModelViewMatrix; | ||
uniform mat3 NormalMatrix; | ||
uniform vec3 LightPos = vec3(0.0, 20.0, 30.0); | ||
void main() { | ||
vN = normalize((NormalMatrix * Norm)); | ||
vP = vec4(Vert, 1.0); | ||
gl_Position = ModelViewProjectionMatrix * vec4(Vert, 1.0); | ||
vV = -vec3(ModelViewMatrix*vec4(Vert,1.0)); | ||
vClr = Clr.rgb; | ||
} | ||
//frag | ||
#version 330 | ||
in vec4 vP; | ||
in vec3 vClr, vN, vV; | ||
out vec4 color; | ||
uniform float Ambient = 0.5; | ||
uniform float EdgeFallOff = 1.0; | ||
uniform float Intensity = 60.0; | ||
uniform bool DimBackfaces; | ||
uniform vec4 ClipPlane = vec4(2.0, 0.0, 0.0, 0.0); | ||
void main() { | ||
if ((ClipPlane[0] < 1.5) && (dot( ClipPlane, vP) > 0.0)) discard; | ||
float opac = dot(normalize(-vN), normalize(-vV)); | ||
opac = abs(opac); | ||
opac = Ambient + Intensity*(1.0-pow(opac, EdgeFallOff)); | ||
float backface = 1.0 - step(0.0, vN.z); | ||
opac = mix(opac, 0.0, backface * float(DimBackfaces)); //reverse normal if backface AND two-sided lighting | ||
color = vec4(opac * vClr, opac); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//pref | ||
Ambient|float|0.0|0.5|1 | ||
EdgeFallOff|float|0|1|4 | ||
Intensity|float|0|0.5|4 | ||
DimBackfaces|bool|false | ||
AOradius|float|0|0|16 | ||
XRay|set|1|1|1 | ||
Use with dark background color.|note | ||
//frag | ||
#version 120 | ||
varying vec3 vN, vV; | ||
varying vec4 vP, vClr; | ||
uniform float Ambient = 0.5; | ||
uniform float EdgeFallOff = 1.0; | ||
uniform float Intensity = 60.0; | ||
uniform bool DimBackfaces; | ||
uniform vec4 ClipPlane = vec4(2.0, 0.0, 0.0, 0.0); | ||
void main() { | ||
if ((ClipPlane[0] < 1.5) && (dot( ClipPlane, vP) > 0.0)) discard; | ||
float opac = dot(normalize(-vN), normalize(-vV)); | ||
opac = abs(opac); | ||
opac = Ambient + Intensity*(1.0-pow(opac, EdgeFallOff)); | ||
float backface = 1.0 - step(0.0, vN.z); | ||
opac = mix(opac, 0.0, backface * float(DimBackfaces)); //reverse normal if backface AND two-sided lighting | ||
gl_FragColor = vec4(opac * vClr.rgb, opac); | ||
} |
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
Oops, something went wrong.