I'm learning about OpenGL, specifically OpenGL-ES 2.0 on Android. The question I've posed to myself this evening is: how can I deform a mesh? I think I have some answers. So my questions for SE are: do I understand this correctly, and have I overlooked anything important?
First, some terminology. I understand transformation to mean translating, rotating, or scaling a mesh. I'm interested in deformation, which means independently changing the properties of individual vertices.
The first rule of deformation seems to be don't do it. Whenever possible, construct the scene in sections that can be transformed instead of deformed.
If you must deform the mesh, the most efficient approach is to deform it in ways that can be described parametrically, using parameters passed to the vertex shader. The parameters may be primitive values, or they may be something more complex like a texture used as a height map. The things I've called "transformations" are actually just common and well-understood examples of this approach. The only real distinction is that the deformations might be tailored to the application.
Finally, if arbitrary deformations are required, you can use buffer object streaming as a last resort.
Is there anything else I should know about this subject?
Aucun commentaire:
Enregistrer un commentaire