Jordan Bonser
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout

Development Blog

Model Loader ( Assimp )

17/2/2013

6 Comments

 
Picture
Okay so I've started the initial workings of the model loader and managed to import a simple cube model using Assimp. This is all put into Mesh and Submesh classes which is then used for the render code. You can see the cube in the image on the left.


There are still many mesh features that need implementing. Currently only the vertices and the face indices have been used to create this cube and the colour is set as a uniform variable in the shader. The next step is to gradually add more information from the mesh files such as: normals, textures, colour( ambient, diffuse and specular ) and eventually animation information. Hopefully it won't be long before I have something that I could potentially create a game with. I already have a simple Camera class and a window class for initialising the OpenGL and handling the render loop. 

The next thing I will be focusing on is adding the colours and normals from a mesh file so that it can be used for lighting calculations. I also need to wrap up how the mesh and submesh classes create and communicate with the OpenGL data, i.e. the VBO's EBO's and the VAO. This will take some great deal of thought.

Till next time :)


6 Comments
Paul
11/5/2013 03:42:49 am

A tutorial would be nice, because Assimp and every other tutorial I've seen so far don't explain fully how to even get that far

Reply
Jordan Bonser
11/5/2013 03:49:34 am

Yeah I know what you mean the tutorials out there aren't particularly in depth. One good one I found was at ogldev.atspace.co.uk . Tutorial 22 explains most of the assimp importer stuff. The only thing it doesn't show well, is how to take the imported data and apply it to your own classes and data types.

Reply
ockert link
3/7/2013 09:52:21 am

Do you know how to use that bool aiMesh::HasVertexColors (unsigned int pIndex) const [inline] chappy to get colours from thhe modeller into your buffer?

Reply
Jordan Bonser
4/7/2013 03:57:24 am

Hey this is the way I've implemented it:
for( unsigned int i = 0; i < theMesh->mNumVertices; i++ )
{

//Get all the vertex Colours.. Can be up to 8 ( not likely tho )
unsigned int NumColours = theMesh->GetNumColorChannels();

for( unsigned int j = 0; j < NumColours; j++ )
{
if( theMesh->HasVertexColors(j) )
{
float red = theMesh->mColors[j][i].r ;
float green = theMesh->mColors[j][i].b ;
float blue = theMesh->mColors[j][i].g ;
}
}
}

Reply
ockert link
2/12/2013 11:22:16 am

Cool thanks. In doing so I get weird values for the red green an blue channels, Running
.
.
.

printf("aiScene->mMeshes[%i]->mColors[%i][%i]: [%f, %f, %f, %f]\n",
i,
j,
k,
(float)aiSceneP->mMeshes[i]->mColors[j][k][0],
(float)aiSceneP->mMeshes[i]->mColors[j][k][1],
(float)aiSceneP->mMeshes[i]->mColors[j][k][2],,
(float)aiSceneP->mMeshes[i]->mColors[j][k][3]);//.a);
}
.
.
.

...I find values like

aiScene->mMeshes[0]->mColors[0][3]: [-1.000000, -109.000000, -5.000000, -1.000000]
aiScene->mMeshes[0]->mColors[0][4]: [-96.000000, 30.000000, -1.000000, -1.000000]
aiScene->mMeshes[0]->mColors[0][5]: [-4.000000, -5.000000, -1.000000, -1.000000]

I've looked everywhere, I'm importing Blender 2.62 files

Have you come across similar problems?

Reply
Jordan Bonser
9/12/2013 09:33:51 am

Hmm that does seem quite strange, I've never tried importing blender files. The only other thing I could suggest is maybe importing the file into blender and see if the values are the same.

I know blender does have a lot of options when exporting files so maybe there is some setting that was not applied when exporting the model.

Sorry I couldn't be more helpful

Reply



Leave a Reply.

    Archives

    May 2020
    April 2020
    January 2020
    November 2019
    October 2019
    September 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    August 2018
    July 2018
    June 2018
    March 2018
    January 2018
    June 2017
    February 2017
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    February 2016
    January 2016
    December 2015
    November 2015
    September 2015
    August 2015
    July 2015
    June 2015
    March 2015
    January 2015
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012

    Categories

    All
    2D
    3rd Year Project
    Agile
    Android
    Angular
    Animation
    API
    Apple
    Apps
    Arden
    Async
    Awesomium
    C#
    CI/CD
    Clean Code
    CMake
    Cocos2d-x
    Colour Match
    Compilers
    Cross Compiling
    Cross-Compiling
    Databases
    Design
    Development Tools
    Docker
    Electronics
    Examples
    Flask
    Flask-Login
    Fmod
    Game Development
    Godot
    GUI
    Hackathon
    Hacktoberfest
    Hardware
    Home Life
    IBM
    Inspired Gaming
    Instancing
    Ios
    Javascript
    Jbengine
    Kata
    Level Editor
    Linux
    Microsoft
    Mobile Development
    Monogame
    Moodster
    Motivation
    Networking
    Objective C
    Opengl
    Open Source
    Organisation
    Physics
    Physx
    Pi
    Planning
    Post Mortem
    PyGame
    Python
    Quart
    Quasar
    RakNet
    React
    Road To Eldoarado
    Scripting
    Scrum Master
    Sessions
    Session Timeout
    Social
    Sound
    Space Invaders
    Squash Game
    Squash Game
    Streaming
    TDD
    Team Leading
    Test
    Test Driven Development
    Travis
    Unity
    Unity Development
    VSCode
    Vulkan
    Web Applications
    Worklife
    WSL
    XML
    XNA / C#

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout