Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27

Thread: M15 - reimplementation via GBuffers

  1. #11
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I need some help from Eros, but my early tests show good parsing performance of the early implementation - triceratops is already dancing on my screen, woman head will be more complex, as it combines triangles and quads


    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

  2. #12
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I updated the code with gBufferBuilder, which allows to define iteratively a gBuffer. By using this type it is already possible to produce some visible geometry.

    Next step is to analyse m15 buffer in order to resolve all submeshes which would be automatically converted to gBuffers of correct type (triangles/quads/polygons).


    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. #13
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    With a bit of work, the current version at GitHub allows to render geometry - from memory or from file.

    The performance of meshes with uniform type (just triangles/quads) matches the m15DrawModel, but in case of mixed types, it is still slower.
    The reason is in the way the gBuffer groups are created - every time a texture or type of polygon changes.

    This way it can happen that model such as woman head in this thread ends up having 500+ gBuffers, on which I need to iterate.

    So next step will be smarter polygon batching to gBuffers.

    If you are interested in first version for testing, please read the first post to learn about the use and where to get the 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

  4. #14
    Hi Petr
    i have downloaded your m15 package. and have saved the following m15 viewer code in the folder m15Model which have 9 files. but there is an error msg : Dim type not defined , Dim model As m15Model http://s9.postimg.org/id378qp0f/msg.png
    how to edit this viewer code so to work with your new package.
    thanks
    '#INCLUDE "m15Model.tbasicu"
    Uses "TBGL","math"
    Dim hWnd As DWord
    Global tot, num, flag, indx, wireframe As Long
    num = 1
    Global v, ro, y2, x2, z2, part As Single
    part = 0.99
    hWnd = TBGL_CreateWindowEx("press 'W' for wire/solid Frame .... press ESC to quit", 640, 600, 32, 0) 
    TBGL_ShowWindow
    'Dim model As m15Model
    TBGL_m15InitModelBuffers 1, 2000
    'TBGL_PolygonLook %GL_LINE 
    TBGL_m15LoadModel "womanhead.m15", "", 1, 0, %TBGL_NORMAL_SMOOTH
    
    TBGL_GetAsyncKeyState(-1) ' Resets status of all keys 
    Dim gFrameTime As Long
    TBGL_UseLighting 1
    TBGL_UseLightSource %GL_LIGHT0, 1 
    
    gFrameTime = GetTickCount
    
    While TBGL_IsWindow(hWnd)
    If TBGL_GetWindowKeyOnce( hWnd, %VK_W) Then
    If wireframe = 0 Then
    TBGL_PolygonLook %GL_LINE
    wireframe = 1
    Else
    TBGL_PolygonLook %GL_FILL
    wireframe = 0
    End If
    End If
    
    gFrameTime = GetTickCount
    TBGL_ClearFrame
    TBGL_Camera 0,7,16,0,2,0
    
    'waves()
    
    
    TBGL_m15RecalcNormals 1, %TBGL_NORMAL_SMOOTH 
    ro+1
    TBGL_Rotate ro-90 , 0, 1, 0
    
    TBGL_m15DrawModel 1
    'model.render 1
    
    TBGL_DrawFrame
    
    If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
    
    Wend
    
    TBGL_DestroyWindow
    

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

    good catch! The problem was that GitHub automatically converted the line endings to Unix.

    I fixed this issue, and made a new release. Grab it here:
    https://github.com/petrSchreiber/m15...ses/tag/v0.1.1

    Here is code which works fine with it:
    Uses "tbgl", "math"
    
    #INCLUDE "m15Model/m15Model.tbasicu" ' -- can be just m15Model.tbasicu, depends where your code is :]
    
    Long tot, flag, indx, wireframe
    Long num = 1
    Single v, ro, y2, x2, z2
    Single part = 0.99
    
    DWord hWnd = TBGL_CreateWindowEx("press 'W' for wire/solid Frame .... press ESC to quit", 640, 600, 32, 0) 
    TBGL_ShowWindow
    
    Dim model As m15Model
    model.fromFile(APP_SourcePath + "womanhead.m15")
     
    TBGL_ResetKeyState
    Long gFrameTime
    
    TBGL_UseLighting TRUE
    TBGL_UseLightSource %GL_LIGHT0, 1 
     
    gFrameTime = GetTickCount
     
    While TBGL_IsWindow(hWnd)
      If TBGL_GetWindowKeyOnce( hWnd, %VK_W) Then
        wireframe = Not wireframe
        TBGL_PolygonLook IIf(wireframe, %GL_LINE, %GL_FILL)    
      End If
       
      gFrameTime = GetTickCount
      TBGL_ClearFrame
        TBGL_Camera 0, 7, 16, 0, 2, 0
        
        ro+1
        TBGL_Rotate ro-90 , 0, 1, 0
         
        model.render
      TBGL_DrawFrame
       
      If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
       
    Wend
     
    TBGL_DestroyWindow
    
    Petr
    Last edited by Petr Schreiber; 27-03-2016 at 19:42.
    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

  6. #16
    Thank you Petr, yes it works now with v0.1.1 and also it works with
    String memoryBuffer = FILE_Load(APP_SourcePath + "womanhead.m15")
    model.FromMemory(memoryBuffer)
    even with a slightly more time in the later
    also the triceratops.M15 loaded okay

    there is an error msg when we load some m15 files such as the Cubes.m15 and aliens(1 to 3).m15 inside the thinbasic folder
    "fatal error has occurred program will be aborted
    the content is not valid m15 v1.0.0.7"

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

    thanks for testing. This message is correct at the time - I am currently supporting just 1.0.0.7, because it has normals present.
    I will eventually add support for 1.0.0.6, once I invent some fast way to calculate normals from tB. Probably using Oxygen, will see


    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

  8. #18
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    I am reaching the state when I can code again, so I optimized the m15Model geometry implementation.

    v0.1.1 provided performance approximately 5.5x worse than native tbgl_m15DrawModel
    v0.1.2 now provides performance which is on par with native m15 implementation, usually giving a few frames extra of performance

    * measurements performed with WomanHead.m15

    Previously, womanhead was done in 450+ draw calls, now it is done in single.
    How this is achieved? By normalizing the mesh to triangles.

    Grab the latest pre-release here:
    https://github.com/petrSchreiber/m15Model/releases


    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

  9. #19

    M15 Animation

    Hi all

    Is there a possibility that M15 format can manage animations like .x or .b3d ?

    It would be great

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

    thank you for your interest! I don't see this happening in near time frame, but what do you think about MD2 format? (quake 2)
    I did a module for thinBasic to load these and animate.


    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

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. How to combine GBuffers & Entities?
    By ReneMiner in forum TBGL General
    Replies: 9
    Last Post: 16-01-2018, 08:56
  2. glDrawArrays example + GBuffers example
    By primo in forum TBGL General
    Replies: 1
    Last Post: 21-11-2015, 23:47
  3. The silence inside the fractal - GBuffers (how many may be used ?)
    By RobbeK in forum TBGL Scripts and Projects
    Replies: 35
    Last Post: 24-01-2014, 12:18
  4. Preview: GBuffers for TBGL
    By Petr Schreiber in forum TBGL module by Petr Schreiber
    Replies: 11
    Last Post: 04-03-2010, 11:33

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
  •