Results 1 to 5 of 5

Thread: spider animation (again)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    spider animation (again)

    in the example posted by Eros (August 25, 200 here:
    http://community.thinbasic.com/index.php?topic=1983.0
    there is a spider animation , and for just fun i want to draw 5 spiders (or more) so i have used the tbgl_translate and a loop from -4 to 0, i want to draw also a galaxy so as it is the home of the spiders.
    some notes:
    1- the galaxy picture appears as dim and not as vivid like the original picture.
    2- other criticism, reviews ?? appreciated.

    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: spider animation (again)

    Hi Zak,

    pretty scary render of invasion

    The reason you had galaxy dark was that you did not disabled lighting.

    If you change the Square procedure to following, you will see the galaxy will be as bright as it should:
    [code=thinbasic]
    Function square()

    ' -- Enable texturing, but just for the part of code
    TBGL_PushState %TBGL_TEXTURING

    ' -- Disable lighting, but just for part of code
    TBGL_PushStateProtect %TBGL_LIGHTING

    ' -- Bind texture #2
    TBGL_BindTexture 2
    TBGL_Color 255,255,255
    TBGL_Translate 2.5, 1, -1

    TBGL_BeginPoly %GL_QUADS ' Starts polygon definition based on 4 vertexes

    TBGL_TexCoord2D 0.0, 0.0 : TBGL_Vertex -2, -2, 0.0
    TBGL_TexCoord2D 1.0, 0.0 : TBGL_Vertex 2, -2, 0.0
    TBGL_TexCoord2D 1.0, 1.0 : TBGL_Vertex 2, 2, 0.0
    TBGL_TexCoord2D 0.0, 1.0 : TBGL_Vertex -2, 2, 0.0

    TBGL_EndPoly ' Ends polygon definition

    TBGL_PopStateProtect
    TBGL_PopState

    End Function
    [/code]


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: spider animation (again)

    One more thing,

    I have seen in your code stuff like:
    [code=thinbasic]
    TBGL_UseTexture 2 : TBGL_BindTexture 2
    [/code]

    That is not entirely correct. TBGL_UseTexture was made obsolete (as help file says) mainly due its confusing name which leads to situation people use it like you did.
    The replacement is TBGL_UseTexturing, which is slightly more clear.

    So the correct variation to your code would be:
    [code=thinbasic]
    TBGL_UseTexturing(%TRUE) ' -- Enables texturing generally
    TBGL_BindTexture(2) ' -- Binds texture #2 to be used
    [/code]
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4

    Re: spider animation (again)

    thanks Petr,
    now the galaxy appears bright as it should be.
    how much you estimate the pc will overloaded from many many spiders we may display ??
    thanks

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: spider animation (again)

    Hi Zak,

    it depends!

    From purely technological view, your spiders are rendered using the most straightforward approach - via the predefined primitives. They are currently handled using Vertex Arrays.
    If you render the same shape multiple times, you could take advantage of display lists - one for head, and one for each leg part.

    To maximize the performance, and reduce the FOR/NEXT overhead, you could consider recreating the scene using scene-entity system. That assures the bigger part runs at compiled speed.

    The whole overhead highly depends on how many spiders are in the view, and how often do you switch states (enabling/disabling texturing, changing textures). If we go into extreme, it would be advantageous to render just heads first, with once bound texture 1, and then all the legs, which have no texture. But fact is code gets complicated this way.

    The raw performance varies, depends on model "batch" size, and graphic card performance.
    For example my "record" with GeForce 9500GT was rendering of 8 000 000 polygons at smooth speed. But on the other side, Intel cards I could test have problems even with scenes under 100 000 polygons.*

    There is ellegant approach on modern cards, called "geometry instancing", which provides even better performance for multiple "stamps" of same object in the scene. But this technique is limited to modern models of GeForces and Radeons.


    Petr

    * Lighted, textured, colored
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. MD2 Animation
    By Petr Schreiber in forum TBGL General
    Replies: 8
    Last Post: 05-08-2008, 06:06

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •