Forums > Jitter

test font/back for planes

May 29, 2006 | 12:41 pm

I’m rendering planes (jit.gl.gridshape) in jitter using sketch, and I want
to know if I’m looking at the front or the back of a plane. Therefor I guess
I need the planes normal vector and the eye vector. Are these available some
way using sketch/js?

I’d like to texture back and front differently, without rendering 2 textures
and 2 planes all the time.

-thijs


May 29, 2006 | 4:41 pm

I believe you can do this with a shader and a multitextured plane. You
would do something like the following.

Vertex shader:

use gl_Normal to compare normal direction with the eye vector and
store in a varying variable

Fragment Shader:

use that varying variable to pick color either from Tex0 or Tex1 and
assign to the fragment color.

wes


May 29, 2006 | 6:43 pm

thanks wes. i’ll go for the shader.

best,
-thijs


Viewing 3 posts - 1 through 3 (of 3 total)