Blender to OGRE : Step by Step How To Tutorial

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Blender to OGRE : Step by Step How To Tutorial

Post by Rohit Chauhan »

This is a Small how to on how to export and ultimately see your Blender
"textured models" in OGRE . I am using OGRE 1.06 and Blender 2.41 on FedoraCore 4 Linux .
The Procedure will be same on any Operating System because everything
being used is cross-platform. May be It could be of some help for
Beginners . I am , in the meantime , having good typing practice .

1) In Blender scale up your cube. Make Wall , Fort or Anything. Then Press F.
2) Move your cursor to upper boundary till you see a 2 sided arrow.
Right click , SPLIT AREA (Left Click) , Left Click to decide the margins for
2 nd window .
3) Now in 2 nd window select UV/ImageEditor mode. Image->Open
and Load(MMB) any texture from your ogrenew/samples/media/material/
texture Directory.
4) Press Alt + Z and you would now see textured object .
5) Press U and Select Cube or anything that suits you. May be LSCM.
6) File->Export->OgreXML , Select "Game Engine Material ".
7) Export . Quit Blender . Just now you exported Cube.mesh.xml and
Scene.material. Cube.mesh.xml is the Mesh itself and Scene.material
contains the name of the texture applied and how it is applied.Where
textures are stored is stored in the resources.cfg file (/material/texture)
BTW models are stored in /models , .material scripts in /material/scripts.
8) Now open up Terminal . In Windows (DOS prompt ).
Type "OgreXMLConverter Cube.mesh.xml" . Press ENTER. Your xml
file has been converted to OGRE understandable .mesh format.
9) Now you have Cube.mesh (Which is the Mesh itself) ,
Scene.material(Which contains the name of the texture applied to Cube.mesh)
Where to find textures , is specified in the resources.cfg file.
10) Now copy Cube.mesh into /models folder (Somewhere under
your "ogrenew" folder.
Copy Scene.material to /material/scripts/ folder
*Copy "your texture" to /material/texture/ folder , if you applied some other texture other than those supplied with OGRE.
11) Open your working OGRE program and replace "robot.mesh"
with "Cube.mesh" in your createEntity() function.

***You just need to do this, "resources.cfg" knows where Cube.mesh is, Cube.mesh will automatically find Scene.material through "resources.cfg" (name of associated .material file is written inside Cube.mesh). Scene.material knows what texture to apply . Where to find the texture
is already known to "resources.cfg" .***
12) Press F8 to build and Shift+F9 to execute (KDevelop,LINUX).
Youll see Textured Object loaded.
Any Questions ???
Thanks
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I took the liberty of adding a link to this page:
http://www.ogre3d.org/wiki/index.php/DCC_Tutorials

If you could please log in to the Ogre Wiki and click on that red link to create the page!

Scroll down to Blender - Blender to Ogre.

Please! :)
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Post by Rohit Chauhan »

Yes , I copied the How-to to OGREwiki , but if you could edit it ,
I studied html at School and not good at it :P
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

There's almost no html in the Wiki, it is Wiki markup.
Take a look at this:
http://www.ogre3d.org/wiki/index.php/Help:Contents

The sandbox is useful - you can fool around here without messing up anything. :)

If you want to know how others edited something: hit the edit button on a page, and you will see the wiki markup.

If you are not up for it, I'm sure others will help you format it! :)

It is always nice to see new material in the Wiki! Thanks! :wink:
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Post by Rohit Chauhan »

I am just writing a How-to on how to set up whole OGRE libraries up
working and running on Linux (Fedora Core 4). Because i didnt find
any Linux set up tutorials or help. I am including even how to install Nvidia driver
, because that is the first step towards installing OGRE.
I ll be posting it in a hour or two .
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

There's Fedora there already:
http://www.ogre3d.org/wiki/index.php/Bu ... rce#Fedora

Feel free to add a link to a more detailed walktrough, if you feel like writing one.
Check out this:
http://www.ogre3d.org/wiki/index.php/He ... i_Handbook
:wink:
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Post by Rohit Chauhan »

I just finished and posted the whole tutorial from installing nvidia
drivers to seeing the first robot . I posted it in ogrewiki too under fedora install. I have requested , somebody is surely going to edit them to make
them look a bit nicer :D
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Post by Rohit Chauhan »

The wiki markup tutorial is so horrible ! :x
Instead if it had been html , I would have brushed up my html in
a single day. :P
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla
Contact:

Post by Rohit Chauhan »

This is a Full tutorial on How to Set up OGRE up and running on a LINUX machine , exactly Fedora Core 4 . If you are using any other Linux flavour , it should work definitely .If anything is different in other distributions please let me know.

I dont know , but may be some of it ( in logic) may apply to Windows.

I use OGRE 1.0.6 and later versions should compile without errors.
OGRE installation in LINUX will consist of 3 main steps . If you have nVIDIA card drivers installed , skip the first step . BTW “Fedora Core 5” is releasing on 15 th March.

3 Steps----

1) Installing nVIDIA driver.
2) Installing OGRE libraries(the game engine itself).
3) Setting up kDevelop to work with OGRE.


1) Installing nVIDIA driver---
Download the driver from nVIDIA site.
Open KDE , Open Terminal , su , rpm –q kernel-devel
CTRL + ALT + F1 , login:root “root password”
init 3
CTRL + ALT + F1 (if you don’t see anything)
sh NVIDIA<version> -a
Say “No” to downloads
modprobe nvidia
init 5
Login and run glxgears(./glxgears)

2) Installing OGRE---

Install Cg kit “rpm” version 1.4 from nVIDIA website .If you don’t know how to install rpm then you should be learning Linux , rather OGRE.

su , rpm –ivh programname.rpm


Install zziplib .13.45(./configure , make , su , make install , exit).

Install DevIL 1.67(./configure , make , su , make install , exit)

su

cp /usr/local/lib/pkgconfig/* /usr/lib/pkgconfig

exit
Extract OGRE , cd to ogrenew directory,

./configure --with-platform=GLX
make
su
make install
/sbin/ldconfig
exit

cd to ogrenew/Samples/Common/bin and run examples from command line
(E.g ./programname)

3) Working with OGRE in kDevelop---
su
cp /usr/local/lib/pkgconfig/* /usr/lib/pkgconfig
exit
exit

Now , Open kDevelop , Project > C++ -> SimpleHelloWorld Program
Wait for a while.
Delete all contents ( CTRL + A and “BACKSPACE”)
Now copy and paste the following code there.

#include "ExampleApplication.h"

class Game : public ExampleApplication
{
void createScene()
{
Entity *robo;
robo = mSceneMgr->createEntity( "Robot", "robot.mesh" );

SceneNode *node1;
node1= mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );

node1->attachObject( robo );
}
};
int main()
{
Game mygame;
mygame.go();
return 0;
}


Project->BuildConfiguration->default
Open configure.in (Click File Tree if you don’t see it)
Add following lines above the “AC_OUTPUT” statement.

PKG_CHECK_MODULES(OGRE, [OGRE >= 0.15.0])
AM_CXXFLAGS="$AM_CXXFLAGS $OGRE_CFLAGS"
AM_LDFLAGS="$AM_LDFLAGS $OGRE_LIBS"
AC_SUBST(AM_CXXFLAGS, "$AM_CXXFLAGS")
AC_SUBST(AM_LDFLAGS, "$AM_LDFLAGS")


Save file (CTRL+S)

Now Copy ExampleFrameListener.h and ExampleApplication.h from ogrenew/Samples/Common/include/ to your projects “src” folder ( /home/”username”/”projectname”/src/).

Copy “plugins.cfg” and “resources.cfg” from ogrenew/Samples/Common/bin to your projects “src” directory.
Open “resources.cfg” and change all relative paths with absolute paths ( For e.g. change ../../ stuff and write full path , /home/”username”/Samples/Media/material/texture or whatever.) Change all relative paths to Absolute Paths !

Press F8 to Build.
Press SHIFT+F9 to execute.
Select OpenGL (Keep pressing left Mouse Button and select)
Look with Mouse , Roam around with arrows , Strafe left and right with A and D.
Congrats !!!
Go on to make HalfLife3 !!!
Hope it could help out some people .
BTW I am RohitChauhan and just made this post in ogrewiki,
Please if somebody could edit this tutorial under "Fedora Building From Source" I dont know that wiki markup language !!!
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
Post Reply