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
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    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:
    https://github.com/petrSchreiber/off...eases/tag/v2.1


    The script for the shade transition itself is the following:
    ' Code for shade transition in 6:51 to 6:55 in https://www.youtube.com/watch?v=U1Q-IgHnuWs
    
    uses "tbgl", "math"
    
    #include "offscreenrenderer/offScreenRenderer8b.tbasicu" ' -- Get v2.1 from https://github.com/petrSchreiber/offScreenRenderer/releases/tag/v2.1
    
    ' Quick setup for easy adjustment in IDE
    %TARGET_WIDTH  = 1920
    %TARGET_HEIGHT = 1080
    
    %ANIMATION_FPS          = 50
    %ANIMATION_DURATION_SEC = 4.7 as single
    %ANIMATION_TOTAL_FRAMES = %ANIMATION_FPS * %ANIMATION_DURATION_SEC
    
    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_showWindow
      
      tbgl_getWindowClient(hWnd, width, height)
        
      dim osr as offScreenRenderer8b
      osr.buildBuffer(%TARGET_WIDTH, %TARGET_HEIGHT)
    
      enableOrderIndependentDrawing()
      
      long   frameCounter = -1
      string frameFileName
      
      while tbgl_isWindow(hWnd) 
        
        incr frameCounter
        tbgl_setWindowTitle(hwnd, $("{frameCounter} / {%ANIMATION_TOTAL_FRAMES}"))
        
        ' -- Prepare the single frame of animation
        osr.beginRender()
          drawSlidingShadow(width, height, frameCounter, %ANIMATION_TOTAL_FRAMES)
        osr.endRender()
        
        osr.drawFrame()     ' -- Show the rendered frame
        
        ' -- Save it to disk
        if frameCounter > 0 then
          frameFileName = "frame_"+format$(frameCounter, "0000")+".png"
          osr.saveImage(frameFileName)
        end if
       
        ' -- ESCAPE key to exit application
        if tbgl_getWindowKeyState(hWnd, %VK_ESCAPE) or frameCounter = %ANIMATION_TOTAL_FRAMES then exit while
    
      wend 
      
      osr.releaseBuffer
      tbgl_destroyWindow
    end function
    
    function enableOrderIndependentDrawing()
      tbgl_depthFunc(%TBGL_ALWAYS)
      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
      tbgl_endPoly
    
    end function
    
    (can be downloaded here: https://github.com/petrSchreiber/BAS...on_TBGL.tbasic)


    Petr
    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
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    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.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

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: 1

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
  •