Monday 15 August 2011

glsl - How do I create a proper bevel effect fragment shader in Open GL ES 2.0? -


I am new to writing piece shader for OpenGL ES2.0 in GLSL and I'm trying to create a piece shader I make a bevel effect for the given graphic is that I am able to do this so far (ignore the lower wall and other texting, only look at the top portion, where the bevel effect applies):

current output

here should be the desired result Should:

desired output

The difference in shading on the diagonals Looking, they are lightly shaded with horizontal edges. Notice the horizontal or vertical transition from the diagonal edges. See also the thickness of bevel I would like to get as close to this desired result as possible.

The piece shader I'm using right now is quite simple, here is the code:

  # Ifdef GL_AS precise moderate float; #endif different vec2 v_texCoord; Uniform Sampler 2D S_text; Uniform float u_time; Zero main () {vec2 one pixel = VC2 (0, 1.0 / 640.0); Vec2 texCoord = v_texCoord; Vec4 color; Color.rgb = vec3 (0.5); Color + = texture 2d (s_text, texcord - one pixel) * 5.0; Color - = texture2d (s_text, takecode + one pixel) * 5.0; Color.rgb = vec3 ((color.r + color.g. Color.b) / 3.0); Gl_FragColor = vec4 (color.rgb, 1); }   

What do I need to do to create the desired effect?

I think the example shown by you is not completely done with piece shader code Was there. This could possibly be done by biological, which could be done by a geometry shader, except that it is not present in ES, so I use an authoring tool like Blender to beveling in my model or maybe a texture To make use of a percussion mapping technique.

No comments:

Post a Comment