Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: M15 - reimplementation via GBuffers

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694

    M15 - reimplementation via GBuffers

    Hi guys,

    I was thinking about the M15 from memory a lot last days, and I got a crazy idea (my default kind of ideas).
    What about re-implementing the M15 as ThinBASIC TWF (TYPE with FUNCTIONs), using TBGL GBuffers as backend?

    Advantage:
    - much faster rendering than current M15 backend
    - dynamic allocation, no longer needed to specify number of models and their dimensions ahead
    - thinBasic code layer, adjustable by anyone

    Where is the code?
    https://github.com/petrSchreiber/m15Model

    How can I use it?
    Please note the current implementation is in pre-release phase, targetted at testing.
    You can grab the files from releases page.

    How difficult it is to use?
    Not much After you download the includes, it can be as simple as:
    #include "m15Model.tbasicu"
    
    ...
    
    dim model as m15Model
    
    model.FromFile("C:\myModel.m15")
    ' -- or
    String memoryBuffer = file_load("C:\myModel.m15")
    model.FromMemory(memoryBuffer)
    
    ...
    
    model.render
    
    Feedback welcome!
    Looking forward to your feedback. And if it is the way to go for you, please attach your M15 models, so I can use them as test data!


    Petr
    Last edited by Petr Schreiber; 27-03-2016 at 09:52.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  2. #2
    Hi Petr
    i suggest a model such as the obj model here https://github.com/vispy/demo-data/b...eratops.obj.gz
    i have converted it to triceratops.M15 its size 1.5MB so it is complex and big enough and can be viewed okay with thinedge
    attached the triceratops.M15.rar

    could be made into GitHub project
    yes this is a good choice
    can't comment on the technical sides.

    this is a great detailed meshes with textures
    http://graphics.williams.edu/data/meshes.xml
    look at this HairBall created by NVIDIA Research 250 MB obj file, can't convert it to M15. i can't even load it in my 3d viewer to view it as obj file. it needs a powerful computer.
    Cornil Box seems interesting with textures, but it is several files
    Attached Files Attached Files
    Last edited by primo; 12-03-2016 at 12:39.

  3. #3
    Member
    Join Date
    Nov 2012
    Location
    Missouri, USA
    Posts
    113
    Rep Power
    23
    Petr,

    You have mention M15 in several posts lately. What is it, and where can it be downloaded?

    Bill

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694
    Hi Bilbo,

    m15 is a 3D model format, which can be loaded and displayed in thinBASIC using TBGL module.

    You can convert industry standard OBJ models to M15 using batch convertor.

    If interested, checkout examples in thinBasic\SampleScripts\TBGL\m15Models\


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  5. #5
    i have converted the sibenik cathedral model from http://graphics.williams.edu/data/meshes.xml to m15 model, i have used example TBGL_UserDataStorage.tbasic from the thinbasic examples, wait a few seconds and you will see what is like a space station with a ufo above. but i can't get it textured. here is what i see in my computer :
    Click image for larger version. 

Name:	sibenik.PNG 
Views:	43 
Size:	74.4 KB 
ID:	9585
    i think it is suitable for Petr to test since it a heavy model with textures.

    change the load models code in the example TBGL_UserDataStorage.tbasic like this
    ' -- Load models
    tbgl_m15InitModelBuffers 1, 2500
    tbgl_m15LoadModel APP_SOURCEPATH+"Models\alien1.m15", "Textures\", 1, 1, %TBGL_NORMAL_SMOOTH
    tbgl_m15ClearModel 1
    TBGL_m15LoadModel APP_SourcePath+"Models\sibenik.M15", "Textures\", 1, 2, %TBGL_NORMAL_SMOOTH
    tbgl_m15ClearModel 1
    tbgl_m15LoadModel APP_SOURCEPATH+"Models\alien3.m15", "Textures\", 1, 3, %TBGL_NORMAL_SMOOTH


    here is the model with textures save it to C:\thinBasic\SampleScripts\TBGL\EntityBased\Models
    http://wikisend.com/download/968692/sibenik.M15.rar
    Last edited by primo; 12-03-2016 at 16:31.

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694
    Thank you Primo,

    this will help me to see what is the performance about
    Textures did not load, because PNG is not supported (now, I have it on list).


    Petr
    Last edited by Petr Schreiber; 12-03-2016 at 16:40.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  7. #7
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Leverkusen, Germany
    Age
    51
    Posts
    3,281
    Blog Entries
    2
    Rep Power
    340
    That sounds actually like a very good idea!

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694
    Thanks Mike!

    Moving from paper stage to implementation. You can track the progress here:
    https://github.com/petrSchreiber/m15Model

    I started with auxiliary routines (logger, validator).


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  9. #9
    Hi Petr, i have found that there is too much interests with Quad meshes, i was not aware before. many graphics engines does not support quad mesh and they convert it first to triangles mostly erroneously. but most new versions of the modelers have a tris to quad tool or (quadify mesh) like in the Blender in the mesh sub menu. it is good your graphics engine support the quad mesh. i have tested it with an obj file made from quads and converted successfully by the obj2m15 tool to m15 file

    i have found several quad meshes (quad_meshes.zip) in the site : http://vcg.isti.cnr.it/quadSemplif/ you may be interested in checking the quad mesh aware feature of your engine . the site have also a video demo.
    attached a deforming of the head made from quads mostly: (needs "womanhead.m15" file attached below)
    Click image for larger version. 

Name:	woman.PNG 
Views:	34 
Size:	56.8 KB 
ID:	9593
      ' 
      ' TBGL Waves 
      ' 
      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 
      
      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 
      'tot = TBGL_m15GetModelVertexcount(1)
      'MsgBox 0, tot
    
      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()
          
          If tot = 0 Then
          num = 1
          part = 0.99
          ElseIf tot =100 Then  
          num =  -1
          part = 1.01
          End If
          tot = tot + num 
                
          TBGL_m15RecalcNormals 1, %TBGL_NORMAL_SMOOTH 
          ro+1
          TBGL_Rotate ro-90 , 0, 1, 0
    
          TBGL_m15DrawModel 1
    
        TBGL_DrawFrame 
        
        If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While 
    
      Wend 
    
      TBGL_DestroyWindow 
      
      Sub waves()
        Long i, vertex
        Local x,y,z, YY, XX, ZZ  As Single
        vertex = TBGL_m15GetModelVertexcount(1)
        YY = y     
        For i = 1 To vertex
          TBGL_m15GetVertexXYZ(1, i, x, y, z)
          
          XX = x*part 
          ZZ = z*part
          YY = y*part
          If yy < 2 Then 
          yy = y
          ElseIf yy > 6 Then
          yy = y
          
          End If
           
          
          TBGL_m15SetVertexXYZ(1, i, XX,YY,Z)
          TBGL_m15SetVertexRGB( 1, i, 100,160,100)
    
        Next  
       
      End Sub
    
    Attached Files Attached Files

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,800
    Blog Entries
    3
    Rep Power
    694
    You are very kind,

    I was just looking for some material to test my parser on. Perfect!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

Page 1 of 3 123 LastLast

Similar Threads

  1. glDrawArrays example + GBuffers example
    By primo in forum TBGL General
    Replies: 1
    Last Post: 21-11-2015, 23:47
  2. How to combine GBuffers & Entities?
    By ReneMiner in forum TBGL General
    Replies: 7
    Last Post: 12-11-2014, 22:05
  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

Posting Permissions

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