Calculate normals after vertex displacement

edited October 2013 in GLSL / Shaders

Hi, I'm using a vertex displacement shader to generate the geometry from a plain mesh, as in Amnon's tutorial for CAN. In Processing 1 I use a geometry shader to determine per triangle normals, as I want a faceted look. I can calculate per pixel normals in the fragment shader using the displacement texture, but how can I do per vertex or per polygon in Processing 2 to get the faceted look?

Thanks!

Answers

  • Hello, you should be able to use your geometry shader in Processing 2.0. However, because the new shader API only supports vertex and fragment shaders (as it follows the GLES 2.0 specs), you would need to write some low-level handling code using JOGL calls. How do you draw your mesh geometry? With beginShape()/endShape() or directly with OpenGL?

  • Great. I use PShape, that's how I'm porting the GlModels I used in Processing 1. Thanks Andrés.

Sign In or Register to comment.