OGRE tools

Everything related to 3D programming
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

OGRE tools

Post by Fred »

Here is a quick list of useful tools when starting with 3D and PureBasic. The used engine is OGRE, so any tools related to it should work with PureBasic.

- OgreASSIMPConverter: commandline tool for Ogre 1.8, it will accept in input all formats supported by assimp (see here: http://assimp.sourceforge.net/main_feat ... rmats.html) and output a .mesh with .material and .sekeleton. http://www.purebasic.com/download/OgreA ... verter.zip (Windows only, requiers the VC++2010 runtime)

- Ogre Meshy: advanced mesh viewer, with bone and animation display - http://sourceforge.net/projects/ogremeshy

Don't hesitate to tell us which tools is interesting to work with PureBasic !
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: OGRE tools

Post by djes »

Last edited by djes on Fri Jan 25, 2013 5:01 pm, edited 1 time in total.
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: OGRE tools

Post by Comtois »

Deled (free): Editor 3D -> http://www.delgine.com/

and if you're interested there is a competition "DeleD Winter Compo 2012!" valid until January 31, see details at this address

http://www.delgine.com/forum/viewtopic. ... sc&start=0
The Rewards
- 50 euros (or 66 US dollars) for the winner, payable via Paypal. But if more than 15 contenders play along, price money goes up to 100 euros! Very Happy
- A Single Developer license of Smart Packer Pro kindly offered by Smart Packer Solutions.
- Having a fun time and sharing that with your fellow DeleD users. Smile
- Eternal fame and glory!
Please correct my english
http://purebasic.developpez.com/
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: OGRE tools

Post by J. Baker »

Also, if you enjoy good old CharacterFX like me. Then grab your copy of CharacterFiX (made in PureBasic) to convert your files to the OGRE formats. Both tools are free!

Currently supports single texture models and animation. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: OGRE tools

Post by applePi »

OgreMax Viewers http://www.ogremax.com/downloads
i have tried OgreMaxWinViewer, it loades the meshes saved from points list without errors while OgreMeshy fails , such meshes described here: http://www.purebasic.fr/english/viewtop ... 36&t=53159
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: OGRE tools

Post by Samuel »

I recently stumbled across Yaose (Yet Another Ogre Script Editor). It's a nice free editor for OGRE's script syntax.
The 3.0 version is also open source so if need be you can do some editing to it.
veniogames.com wrote: Yaose is a pro­gram for edit­ing Ogre script files. Yaose doesn't only have syn­tax highlighting, but also in­tel­lisense and code com­ple­tion, which makes writ­ing e.g. ma­te­rial scripts a lot easier.

I wrote Yaose, be­cause some­thing like this didn't ex­ist be­fore—at least­—not a good one.
Other ed­i­tors didn't work prop­erly or weren't fin­ished, and all they could do was edit­ing ma­te­rial scripts.
Note­pad wasn't re­ally do­ing the job ei­ther, so I wrote Yaose.

Yaose cur­rently sup­ports edit­ing of ma­te­rial scripts, over­lay scripts, par­ti­cle scripts, com­pos­i­tor scripts and font­def scripts.
Yaose makes work­ing with colours easier with a colour picker. It suggests pos­si­ble val­ues for pa­ram­e­ters while typ­ing, and it even re­mem­bers vari­ables.
http://veniogames.com/downloads/yaose
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: OGRE tools

Post by Danilo »

Fred wrote:http://www.purebasic.com/download/OgreAssimpConverter.zip (Windows only, requiers the VC++2010 runtime)
Any chance you provide OgreAssimpConverter for Linux and Mac OS X, too?

Assimp says: "Written in portable, ISO-compliant C++"
Why not include it into PB? It is required to work with PB/OGRE because
we need to convert all 3D object files to OGRE format.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: OGRE tools

Post by applePi »

GLXtractor is a GUI tool which can be used to capture the Geometry from PureBasic Ogre 3D running programs and rendered with opengl subsystem . it captured the vertex positions, faces, normals, UV and direct these data to wavefront OBJ file , it captures also the texture used whether it is standalone image file or generated from code.
it can also capture geometry from PB opengl programs
download it from
https://web.archive.org/web/20151126041 ... t/~alexan/
or http://glxtractor.software.informer.com/
its latest version is 0.9.9.1 , in the second link they say "Version 1.0 is not available yet"
How to use:
1- compile the following code (with opengl subsystem) to sphere.exe and save it to purebasic\compilers
2- run the GLXtractor program and accept the defaults. click on "Choose App" and choose the sphere.exe you have saved before.
3- click on Ogle Plugin Tab and choose capture texture ... capture. this is to capture the UV and normals data
4- click Start Application
5- when the purebasic program launched use either the mouse or ALT-TAB to focus on the GLXtractor window , and press ctrl-shift-f . you will notice the rendering stop for a second or more (may be 10 seconds for very big meshes.)
6- exit the purebasic program
7- look at My Documents - Xtracted folder (or whatever you choose before running PB example exe)
you will find sphere.obj and a texture . note it will work for meshes have submeshes such as "AKM.mesh" in the folder Models inside purebasic example data. but will not work with animated meshes such as robot.mesh ...

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

Global CameraSpeed.f = 0.07
Define.f KeyX, KeyY
Quit.b = #False

OpenWindow(0, 0, 0, 800, 600, "simple scene ... ,  move the camera with arrow keys ... , Space: stop/start rotation ... W: wire/solid", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts",#PB_3DArchive_FileSystem)
Parse3DScripts()


CreateMaterial(0, LoadTexture(0, "MRAMOR6X6.jpg"))
MaterialCullingMode(0, #PB_Material_NoCulling)

CreateSphere(0, 1, 32,32)
;LoadMesh(0, "AKM.mesh")
;LoadMesh(0,"tudorhouse.mesh")

SetMeshMaterial(0, MaterialID(0))

CreateEntity(0, MeshID(0), #PB_Material_None, 0, 0, 0)

MeshRad.f = MeshRadius(0)
ScaleEntity(0, 1.244/MeshRad, 1.24/MeshRad, 1.24/MeshRad) 

CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 2, 5, #PB_Absolute)
CameraLookAt(0, 0,0,0)
    
CreateLight(0, RGB(200,150,100), 10, 2000, 300)
AmbientColor(RGB(90, 90, 60))

rot = 1
Repeat

  Repeat
      Select WindowEvent()
         Case #PB_Event_None
            Break
         Case #PB_Event_CloseWindow
            Break 2
      EndSelect
   ForEver
  
  If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -CameraSpeed
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = CameraSpeed
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -CameraSpeed
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = CameraSpeed
        Else
          KeyY = 0
        EndIf
        
        If KeyboardReleased(#PB_Key_W)
          wire ! 1
          If wire
            MaterialShadingMode(0, #PB_Material_Wireframe)
          Else
            MaterialShadingMode(0, #PB_Material_Solid) 
          EndIf  
        EndIf
                      
        If KeyboardReleased(#PB_Key_Space)
          rot ! 1
        EndIf
               
          
      EndIf
      
  MoveCamera  (0, KeyX, 0, KeyY)
      
  RotateEntity(0, 0,rot/2,0, #PB_Relative)
  
  RenderWorld()
  FlipBuffers()
  
  ExamineKeyboard()
  
Until KeyboardPushed(#PB_Key_Escape)
try GLXtractor with the following PB opengl code, try to capture its graphics

Code: Select all

Structure Point3D
  x.f
  y.f
  z.f
  tu.f
  tv.f
  r.f
  g.f
  b.f
EndStructure

UseJPEGImageDecoder()
UseJPEGImageEncoder()
UsePNGImageDecoder()

Declare FillArray()
Global.f txu, txv

Define event, quit

#ImagePath = #PB_Compiler_Home + "examples/3d/Data/Textures/"

 LoadImage(1, #ImagePath+"axes.png")
        
 *Buffer = EncodeImage(1) ; default is: #PB_ImagePlugin_BMP : encode the image in BMP 
Define TexID

ExamineDesktops()
OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), "... Up/Down: zoom in/out... 'W': wire frame... 'A'/'Z': change Camera view")
SetWindowColor(0, RGB(200,220,200))
OpenGLGadget(0, 10, 10, WindowWidth(0) , WindowHeight(0) , #PB_OpenGL_Keyboard)

;- Generate texture
glGenTextures_(1, @TexID)
glBindTexture_(#GL_TEXTURE_2D, TexID)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_LINEAR)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_LINEAR)
glTexImage2D_(#GL_TEXTURE_2D, 0, 3, ImageWidth(1), ImageHeight(1), 0, #GL_BGR_EXT, #GL_UNSIGNED_BYTE, *Buffer+57)

FreeMemory(*Buffer)

glEnable_(#GL_TEXTURE_2D)   ; Enable texture mapping 
glBindTexture_(#GL_TEXTURE_2D, TexID)

glLoadIdentity_();
gluPerspective_(45.0, DesktopWidth(0)/DesktopHeight(0), 1.0, 60.0)
glTranslatef_(0, 0, -5)
glEnable_(#GL_DEPTH_TEST)

Global NbX = 100
Global NbZ = 100

Global Dim Point3D.Point3D(0)
Global Dim MeshDataInd.PB_MeshFace(0)
Global indexsize ;= ArraySize(MeshDataInd()) + 1
;Debug indexsize

FillArray()
  ;Debug VertexIndex  
 ;=================================================================================
rot.f = 1
;glPointSize_( 3 )  
;glTranslatef_(0.0, 0.0, -30)
SetActiveGadget(0) ; make the openGLgadget active

glPushMatrix_(); to store the current state
glMatrixMode_(#GL_PROJECTION)
glLoadIdentity_();
gluPerspective_(45.0, WindowWidth(0)/WindowHeight(0), 1.0, 800.0)
glMatrixMode_(#GL_MODELVIEW)
glTranslatef_(0, 0, -1)
glShadeModel_(#GL_SMOOTH) 
glEnable_(#GL_DEPTH_TEST)
glViewport_(0, 0, WindowWidth(0), WindowHeight(0))

gluLookAt_( 0, 1, 1, ; the camera looking from position 0,0.3,0.5  to 0,0,0 from above
            0,  0, 0,
            0,  1,  0 ) 

glPolygonMode_(#GL_FRONT_AND_BACK, #GL_LINE )
glPopMatrix_()
glPushMatrix_()
t=1: zz=30
;Debug indexsize
Repeat
  
  Event = WindowEvent()
  
  glViewport_(0, 0, WindowWidth(0), WindowHeight(0))
  glClearColor_(0.9, 0.9, 0.9, 1)
  ;glClearColor_(0.3, 0.3, 0.3, 1)
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
    
  glEnableClientState_(#GL_VERTEX_ARRAY )
  glEnableClientState_(#GL_COLOR_ARRAY)
  glEnableClientState_(#GL_TEXTURE_COORD_ARRAY)
  glRotatef_(rot/5, 0, 1, 0);
 
  glVertexPointer_(3, #GL_FLOAT,SizeOf(Point3D),@Point3D(0)\x)
  glColorPointer_(3, #GL_FLOAT, SizeOf(Point3D), @Point3D(0)\r)
  glTexCoordPointer_(2, #GL_FLOAT, SizeOf(Point3D), @Point3D(0)\tu)
  
  ;glDrawElements_(#GL_LINES,indexsize,#GL_UNSIGNED_INT, @MeshDataInd(0)\Index)
  ;glDrawElements_(#GL_POINTS,indexsize,#GL_UNSIGNED_INT, @MeshDataInd(0)\Index)
  ;glDrawElements_(#GL_TRIANGLES,indexsize,#GL_UNSIGNED_INT, @MeshDataInd(0)\Index)
  glDrawElements_(#GL_QUADS,indexsize,#GL_UNSIGNED_INT, @MeshDataInd(0)\Index)
  
  glDisableClientState_(#GL_TEXTURE_COORD_ARRAY)
  glDisableClientState_(#GL_COLOR_ARRAY)
  glDisableClientState_(#GL_VERTEX_ARRAY);
  
  If Event = #PB_Event_Gadget And EventGadget() = 0 
    If EventType() = #PB_EventType_KeyDown  ; like KeyboardReleased
            key = GetGadgetAttribute(0,#PB_OpenGL_Key )
            If key = #PB_Shortcut_Escape ;  Esc key to exit
               quit = 1
            
               ElseIf Key = #PB_Shortcut_W; display wire Frame or solid frame
               If fill
                glPolygonMode_(#GL_FRONT_AND_BACK, #GL_LINE)
                fill ! 1
               Else
                glPolygonMode_(#GL_FRONT_AND_BACK, #GL_FILL )
                fill ! 1
              EndIf
              ElseIf Key = #PB_Shortcut_Up
                glScalef_(1.05,1.05,1.05)
              ElseIf Key = #PB_Shortcut_Down
                glScalef_(0.95,0.95,0.95)
              ElseIf Key = #PB_Shortcut_A
                glMatrixMode_(#GL_MODELVIEW);
                glLoadIdentity_()           ;
                gluLookAt_(0, 3, 1,  0,0,0,  0,1,0 ) 
              ElseIf Key = #PB_Shortcut_Z
               glMatrixMode_(#GL_MODELVIEW);
                glLoadIdentity_();
                gluLookAt_(0, 1, 2,  0,0,0,  0,1,0 )  
                                
            EndIf
               
    EndIf
   EndIf
   
   SetGadgetAttribute(0, #PB_OpenGL_FlipBuffers, #True)
   Delay(5)
Until Event = #PB_Event_CloseWindow Or quit = 1

glDeleteTextures_(1, @TexID)

Macro Vertex(u, v, txu, txv)
  ;this produce very beautiful shape
  x.f = 0.5 * (1 - Cos(u)) * Sin(u) * Cos(v)
  y.f = 0.5 * (1 - Cos(u)) * Sin(u) * Sin(v)
  z.f = Cos(u)
  ;this produce a sphere shape
  ;x.f = 0.5 * Cos(u)* Sin(v)
  ;y.f = 0.5 * Sin(u)* Sin(v)
  ;z.f = 0.5 * Cos(v)
  
  ReDim Point3D.Point3D(a)
  Point3D(a)\x = x*1
  Point3D(a)\y = y*1
  Point3D(a)\z = z*1
  
  Point3D(a)\tu = txu
  Point3D(a)\tv = txv
  
  Point3D(a)\r = 1.0 :Point3D(a)\g = 1.0 :Point3D(a)\b = 1
  
  a+1
      
  
EndMacro

Procedure FillArray()
  
  Protected.f u, v, Delta = 4*#PI/NbX ; change 4 to 2 to get more quads
  Protected.f x, y, z
  txu.f : txv.f
  ;Debug delta  
  u = 0
  v = 0
  While v <= 2 * #PI
    
    While u <= 1 * #PI ; change 2 to 1 and will get half of the object
  
      Vertex(u, v, txu, txv)
      Vertex(u + Delta, v, txu+u/NbX*#PI, txv)
      Vertex(u + Delta, v + Delta, txu+u/NbX*#PI, txv+v/NbX*#PI)
      Vertex(u, v + Delta, txu, txv+v/NbX*#PI)
      txu = txu + u/NbX*#PI ; for texturing
      
      ReDim MeshDataInd.PB_MeshFace(VertexIndex+4)
      MeshDataInd(VertexIndex)\Index = VertexIndex   + 0
      MeshDataInd(VertexIndex+1)\Index = VertexIndex + 1
      MeshDataInd(VertexIndex+2)\Index = VertexIndex + 2
      MeshDataInd(VertexIndex+3)\Index = VertexIndex + 3

      VertexIndex + 4
            
      u + Delta
      
    Wend
    txu = 0
    txv = txv + v/NbX*1*#PI ; for texturing
    u = 0
    v + Delta
  Wend
  
  indexsize = ArraySize(MeshDataInd())
  ;Debug indexsize
    
  ;Debug VertexIndex
EndProcedure
    
  
Notes:
if our approach in constructing a manual mesh is like this:
CreateMesh(0, #PB_Mesh_TriangleList, #PB_Mesh_Static)
MeshVertexPosition(-1, 0, -1) ; vertex number 0
MeshVertexPosition(-1, 0, 1) ; vertex number 1
MeshVertexPosition( 1, 0, 1) ; vertex number 2
MeshVertexPosition( 1, 0, -1) ; vertex number 3

MeshFace(0,1,2)
MeshFace(2,3,0)
FinishMesh(#True)
note here in MeshFace(2,3,0) we have referred to vertex 2 and vertex 0 which are used before
but in GLXtractor capturing it is considered as a new points, and inside OBJ file we see:
#TRIANGLES
g 1
v -1.000000 0.000000 -1.000000
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
f 1 2 3
v 1.000000 0.000000 1.000000
v 1.000000 0.000000 -1.000000
v -1.000000 0.000000 -1.000000
f 4 5 6

these data if the camera in 0,0,0 and the entity in 0,0,0. the rendered data is different for other camera or entity positions or if the entity is rotated the data will be different but the shape stay as the original one.

so there are more vertices using the GLXtractor, and if we add the normals and the UV the OBJ will grow to gigantic sizes for big meshes. your only choice is to use the great MeshLab tool to reduce the number of vertices again, in the above OBJ file the vertices will be again 4. using the MeshLab Filters -> Cleaning and Repairing -> Merge Close Vertices

GLXtractor is a GUI for the OGLE the OpenGLExtractor tool, download Ogle bin and src from the Links provided here:
https://vrwiki.wikispaces.com/OGLE
Ogle is using glintercept tool: GLIntercept is a OpenGL function call interceptor for Windows that will intercept and log all OpenGL calls:
https://github.com/dtrebilco/glintercept

===========================================================
How to capture DX
3D Ripper 0.1 beta :
http://denull.ucoz.ru/load/1-1-0-40
i have tested it and it works, with PB Ogre 3D compiled as DirectX 9 subsytem (the default)

http://www.deep-shadows.com/hax/3DRipperDX.htm
i was not able to save as OBJ, but at least it produce a material file *.mtl which the other tools does not provide

your notes and experience is very welcome
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: OGRE tools

Post by DK_PETER »

Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: OGRE tools

Post by oreopa »

Trying out ArtifexTerra3D just now. Looks good. Just what I was looking for to further my 3D "game". Thanks for that one!

Knew about SpaceScape, but it is also really good. Got some excellent looking skyboxes out of it.
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: OGRE tools

Post by skinkairewalker »

all animated models animations are broken when converting with OgreAssimp.
pfaber11
Enthusiast
Enthusiast
Posts: 145
Joined: Sat Apr 13, 2019 12:17 pm

Re: OGRE tools

Post by pfaber11 »

There is an app to set the serialization to 1.1 1.41 and 1.8
I would try 1.41 first as I have success with this .
OGRE_TOOLS is the kit to do this with and it works with entity animation by downgrading the serialization number.
https://disk.yandex.com/d/rcyZhyqM3W6ajn
Hope this helps.
I was using 1.8 and had no animation but then tried 1.41 and It works ( use OGRE_TOOLS to do this.) with animation.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: OGRE tools

Post by skinkairewalker »

i was trying to convert .b3d, .x, .dae animated but ogre_assimp dont convert animations, only mesh
User avatar
CDXbow
User
User
Posts: 24
Joined: Mon Aug 12, 2019 5:32 am
Location: Oz

Re: OGRE tools

Post by CDXbow »

skinkairewalker wrote: Sat Jan 14, 2023 11:38 pm i was trying to convert .b3d, .x, .dae animated but ogre_assimp dont convert animations, only mesh
Yes, the pain, the pain. After failing miserably to export or convert Ogre models, I remembered I had Milkshape3D and it had an Ogre exporter. It worked. I have converted the gold meka on the left (see image https://github.com/CD-Xbow/Ogre-models/ ... g?raw=true) to a static mesh and loaded it successfully into the entity.pb demo. I think it's 1.3 or 1.4 mesh format.

It was too much to hope for that the animations would export successfully, the exporter crapped out. I will work on it and see if I can finally defeat the Ogre. I'll upload models to https://github.com/CD-Xbow/Ogre-models/ if I can export more.
miso
User
User
Posts: 36
Joined: Sat Oct 21, 2023 4:06 pm

Re: OGRE tools

Post by miso »

Try this. It's old, only for windows, but converts to ogre mesh with skeleton and animation. (works well for me in latest pb version (6.03))

http://www.fragmosoft.com/fragMOTION/index.php

It's kinda free as long as you don't mind to type a prayer after every seven days.
(but if you like the software, you can purchase it to avoid that.) I only use it for conversions to different formats.
I hope it solves your problem with the exports.
Last edited by miso on Fri Nov 24, 2023 9:01 am, edited 2 times in total.
Post Reply