Closed GoogleCodeExporter closed 9 years ago
Note to self: don't forget OSX has the build in shader preview.
Original comment by nin...@gmail.com
on 22 Nov 2011 at 8:08
One approach is to do pixel vector vs. view vector (and dot product them with a
comparison):
// Vertex Shader:
varying vec3 normal;
varying vec2 vTexCoord;
void main()
{
normal = gl_NormalMatrix * gl_Normal;
gl_Position = ftransform();
}
// Fragment shader:
varying vec3 normal;
varying vec2 vTexCoord;
void main()
{
float intensity;
vec4 color;
// Apply an edge detection (new to this..)
// Need world pos!!!
vec3 n = normalize(normal);
vec3 viewDirection = normalize(vec3(5, 0, 5));
if(dot(viewDirection, n) < 0.1)
gl_FragColor = vec4(0, 0, 0, 1); // black
}
Original comment by nin...@gmail.com
on 23 Nov 2011 at 12:08
Current approaches:
Use a sobel filter: http://www.blitzbasic.com/Community/posts.php?topic=85263
Minecraft-mod approach: http://pastebin.com/KmD72cx8
Original comment by nin...@gmail.com
on 23 Nov 2011 at 1:02
glsl contour lines is another approach
Original comment by nin...@gmail.com
on 23 Nov 2011 at 3:07
Creating shader class to wrap all future shaders
Original comment by nin...@gmail.com
on 23 Nov 2011 at 4:58
Done!
Original comment by nin...@gmail.com
on 24 Nov 2011 at 12:13
Original issue reported on code.google.com by
nin...@gmail.com
on 18 Nov 2011 at 5:22