hashbrown

05-13-2017, 10:38 PM

Is there a way I can draw lines from the center of every face of a mesh in the fragment shader? I'm trying to visualize the mesh's normals, but not sure how to.

I've got a normalMatrix uniform and vertexNormal vec3 varying I sent from the vertex shader. I've calculated a normal vector in the fragment shader:

vec3 norm = normalize(vec3(u_nrmMatrix * vec4(v_normals, 0.0)));

Is there a way I can draw a line along that norm vector from the fragment shader? I'm not sure how to accomplish this, any advise is greatly appreciated! Oh and I'm using WebGL, that's using GLSL 1.0 I believe.

I've got a normalMatrix uniform and vertexNormal vec3 varying I sent from the vertex shader. I've calculated a normal vector in the fragment shader:

vec3 norm = normalize(vec3(u_nrmMatrix * vec4(v_normals, 0.0)));

Is there a way I can draw a line along that norm vector from the fragment shader? I'm not sure how to accomplish this, any advise is greatly appreciated! Oh and I'm using WebGL, that's using GLSL 1.0 I believe.