Portfolio Stuff Résumé Contact  
> fold



The papers folding up is not done by animating, it's an effect built in the vertex shader. Some requirements for this to work:

  • Export the models folded-up
  • The pivot should be in the center, where the mesh folds
  • Allways use the same orientation for your models
  • gAngle is a parameter indicating the amount of folding (in my case this is calculated by player proximity)
  • Apply this code in local space, before applying the World View Projection transformation
float3 foldByAngle;

foldByAngle.x = vIn.Pos.x;
foldByAngle.z = vIn.Pos.z + sin(gAngle) * vIn.Pos.y;
foldByAngle.y = cos(gAngle) * vIn.Pos.y;

vOut.Pos = float4(foldByAngle, 1.0f);

As you walk around the world forms itself around you by folding up when you get near.


DirectX and NVidia PhysX.
Written in C++