Thread: U,V animation or not?

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    U,V animation or not?

    I'm still debating my animation algo as to whether or not I should change it.

    Originally I used 1 ID for 1 frame of animation or 1 texture. Ideally I would like to simply scroll u,v's but that presents another problem. In order to scroll u,v coords I must lock the vertex buffer and write the new u,v coords to the buffer and then unlock it. However using U,V animation techniques allows me to reduce the number of SetTexture() calls while increasing the number of vertex buffer locks and unlocks. Catch 22 it seems.

    Code:
    class CAnimFrame
    {
      protected:
       DWORD m_dwTextureID;
    
       float m_fUCoord;
       float m_fVCoord;
       float m_fUSize;
       float m_fVSize;
    
       ....
    };
    So now instead of just having an ID, I have 1 ID to indicate which texture to use and 4 floats to determine where in that image (maintained by the texture manager) the current animation sequence is.

    So I guess my question is which is faster?

    UV animation
    • Requires locking/unlocking vertex buffers
    • Reduces the number of SetTexture() calls
    • Reduces the memory footprint of textures since many animations can be stored in one large texture


    Single image animation
    • Increases the number of SetTexture() calls
    • Does not require locking/unlocking of vertex buffers
    • Increases the memory footprint of textures

  2. #2
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    I don't know for sure which is faster, but AFAIK setting texture states is relatively expensive, so UV animation might be faster.
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  3. #3
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    Haven't you been doing some sick nasty stuff with shaders? A shader that alter's uv's is cake.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Eh....I guess I could use a shader for animation. But then where's the proper fallback for earlier hardware? Course I reckon this space game won't run on anything that does not at least support shader model 1.0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Threads in MFC
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 12-28-2005, 06:03 PM
  2. Animation class not working
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 03-02-2005, 06:48 AM
  3. 3D animation (difficult?)
    By maes in forum Game Programming
    Replies: 3
    Last Post: 09-08-2003, 10:44 PM
  4. ascii animation
    By jstn in forum C Programming
    Replies: 3
    Last Post: 05-14-2002, 07:16 PM
  5. Trouble with animation using Sleep
    By QuestionC in forum Windows Programming
    Replies: 6
    Last Post: 02-06-2002, 11:08 AM