Results 1 to 2 of 2

Thread: ThinBASIC used as part of tooling for YouTube music video

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Brno - Czech Republic
    Rep Power

    Lightbulb ThinBASIC used as part of tooling for YouTube music video

    I used thinBASIC in order to help my dear wife with creation of part of animation for tribute video for Disco Elysium video game:

    (part from 6:51 to 6:55 - please beware, other parts of the video contain spoilers for the game!)

    The background and animated character was done by her of course, but on her request I added the custom animation of the "shade" revealing the animation slowly.
    The final composition of our inputs was then done in DaVinci Resolve.

    Thanks to this work I updated the already open sourced offScreenRenderer to v2.1:

    The script for the shade transition itself is the following:
    ' Code for shade transition in 6:51 to 6:55 in
    uses "tbgl", "math"
    #include "offscreenrenderer/offScreenRenderer8b.tbasicu" ' -- Get v2.1 from
    ' Quick setup for easy adjustment in IDE
    %TARGET_WIDTH  = 1920
    %TARGET_HEIGHT = 1080
    %ANIMATION_FPS          = 50
    %ANIMATION_DURATION_SEC = 4.7 as single
    function tbMain()
      double frameRate
      long   width, height
      ' -- Create and show window
      dWord hWnd = tbgl_createWindowEx("Shade overlay rendering - press ESC to quit", 640, 360, 32, %TBGL_WS_WINDOWED | %TBGL_WS_CLOSEBOX)
      tbgl_getWindowClient(hWnd, width, height)
      dim osr as offScreenRenderer8b
      osr.buildBuffer(%TARGET_WIDTH, %TARGET_HEIGHT)
      long   frameCounter = -1
      string frameFileName
      while tbgl_isWindow(hWnd) 
        incr frameCounter
        tbgl_setWindowTitle(hwnd, $("{frameCounter} / {%ANIMATION_TOTAL_FRAMES}"))
        ' -- Prepare the single frame of animation
          drawSlidingShadow(width, height, frameCounter, %ANIMATION_TOTAL_FRAMES)
        osr.drawFrame()     ' -- Show the rendered frame
        ' -- Save it to disk
        if frameCounter > 0 then
          frameFileName = "frame_"+format$(frameCounter, "0000")+".png"
        end if
        ' -- ESCAPE key to exit application
        if tbgl_getWindowKeyState(hWnd, %VK_ESCAPE) or frameCounter = %ANIMATION_TOTAL_FRAMES then exit while
    end function
    function enableOrderIndependentDrawing()
      tbgl_useDepthMask false
      tbgl_useDepthflag false
    end function
    function drawSlidingShadow(width as long, height as long, frameCounter as long, videoTotalFrames as long)
      single rightTransitionEdge, rightScreenEdge
      single rimSize = width/20
      tbgl_rendermatrix2D (1, height, width, 1)   ' Set the resolution and the coordinate system
      tbgl_clearFrame                             ' As we don't draw a full background, we need to clear the framebuffer
      rightScreenEdge     = width
      rightTransitionEdge = frameCounter / (videoTotalFrames) * (width + rimSize)
      tbgl_beginPoly %GL_QUADS
        tbgl_color 255, 255, 255                ' Left part
        tbgl_vertex 0, 0
        tbgl_vertex rightTransitionEdge, 0
        tbgl_vertex rightTransitionEdge, height
        tbgl_vertex 0, height
        tbgl_color 0, 0, 0                      ' Right part
        tbgl_vertex rightTransitionEdge, 0
        tbgl_vertex rightScreenEdge, 0
        tbgl_vertex rightScreenEdge, height
        tbgl_vertex rightTransitionEdge, height
        tbgl_color 255, 255, 255                 ' Transition
        tbgl_vertex rightTransitionEdge-rimSize-sin((frameCounter)/10)*rimSize*0.5, 0
        tbgl_color 0,0,0
        tbgl_vertex rightTransitionEdge, 0
        tbgl_vertex rightTransitionEdge, height
        tbgl_color 255, 255, 255
        tbgl_vertex rightTransitionEdge-rimSize-sin((frameCounter+15)/10)*rimSize*0.5, height
    end function
    (can be downloaded here:

    Last edited by Petr Schreiber; 17-12-2022 at 21:31.
    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

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Milan - Italy
    Rep Power
    I didn't know that game, I will have a look.
    But drawings are marvelous :O they capture the mind.
    Also music is very nice. | |
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Similar Threads

  1. start YouTube video from specific place
    By primo in forum Shout Box Area
    Replies: 1
    Last Post: 19-08-2019, 14:31
  2. TopDown with modified ship and YouTube video
    By ErosOlmi in forum Game general
    Replies: 229
    Last Post: 05-03-2007, 09:40
  3. thinBasic on YouTube: Robot duel
    By ErosOlmi in forum YouTube
    Replies: 1
    Last Post: 04-02-2007, 19:43
  4. thinBasic on YouTube
    By ErosOlmi in forum YouTube
    Replies: 4
    Last Post: 02-02-2007, 22:10
  5. thinBasic on YouTube: Labyrinth
    By ErosOlmi in forum YouTube
    Replies: 0
    Last Post: 02-02-2007, 18:31

Members who have read this thread: 11

Tags for this Thread

Posting Permissions

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