Wednesday, March 24, 2010

First Screenshot using Ogre3D


Ok, you' ve seen this a lot of time, but there's an important difference: this screenshot was made using the Ogre3d engine to render the scene.
The source is very small, so small that i post it here!
And, if you examine the image you can see two important news:

- Shadows are in hi-res and very realistic.
- Anti-Aliasing is implemented

The source?


#include "ExampleApplication.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
TutorialApplication()
{
}

~TutorialApplication()
{
}
protected:
void chooseSceneManager(void)
{
mSceneMgr = mRoot->createSceneManager(ST_EXTERIOR_CLOSE);
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

}

virtual void createCamera(void)
{
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0,10,500));
mCamera->lookAt(Vector3(0,0,0));
mCamera->setNearClipDistance(5);
}

virtual void createViewports(void)
{
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));
mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}


void createScene(void)
{
Entity *ent;
Light *light;

mSceneMgr->setAmbientLight( ColourValue( 0.1, 0.1, 0.1 ) );
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );


mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox2");

ent = mSceneMgr->createEntity("Station", "Mesh.001.mesh");
ent->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);

light = mSceneMgr->createLight("Light1");
light->setType(Light::LT_POINT);
light->setPosition(Vector3(30, 150, -250));

light->setDiffuseColour(1.0, 1.0, 1.0);
light->setSpecularColour(1.0, 1.0, 1.0);



}
};

#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif
{
// Create application object
TutorialApplication app;

try {
app.go();
} catch(Exception& e) {
#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
fprintf(stderr, "An exception has occurred: %s\n",
e.getFullDescription().c_str());
#endif
}

return 0;
}



Nothing more.

---

Eccovi la prima immagine ottenuta usando il motore Ogre3D. Lo so, e' uguale a un sacco di altre che ho postato in precedenza, pero' la novita' fondamentale e' che e' stata ottenuta implementando il mio materiale dentro al nuovo engine.
E la cosa sorprendente e' che e' stato davvero facile! Il sorgente che potete leggere qui sopra e' tutto cio' che serve per ottenere una telecamera mobile, uno skybox, una mesh e delle ombre.
Tra l'altro le ombre sono molto piu' precise di quelle che ho ottenuto io con l'approccio "fai da te". E tra l'altro e' arrivato "gratis" anche l'antialiasing.

8 comments:

Marte said...

vai!! mi piace l'approccio ad esempi, c'è sempre da imparare :D

una domanda: quali sono i prox obbiettivi ?

PdG said...

I prossimi obiettivi miei personali sono intanto imparare ad usare meglio il motore.
Gestire tastiera, mouse ecc..
Poi voglio implementare il post-processing, per riottenere l'effetto "bloom" per l'illuminazione.

Fatto questo voglio dedicarmi totalmente (quando ho tempo ovviamente) al gameplay vero e proprio.. la parte grafica con ogre l'ho risolta, bisogna cominciare a scriverci il "gioco".

Uchooze said...

Hello Mr Ceti :oD

You write Space Game now, Yes?

I like Space Fighting, you be my friend yes?

Not too much proper slidey-flying though. Real space ships fly like Bi-planes we all know it yes?

Bang a bang - come shooty big chop Grr - Hurrah!

I think you very nice, is space ship?

-TTFN ;oJ

Uchooze said...

Ah, I didn't leave my Contact Details.

Your impending game looks Fantastic!

Maybe some members of our website would enjoy reading about your work.

Many Thanks, R.James - Uchooze.com
(Launching May 2010)

Mail: illumicon@hotmail.co.uk

Yombo said...

Hello! I follow your Tau Ceti blog for a while now, and I am glad that you continue it!

I'm also making a game inspired on Frontier from David Braven (and also developing it on free time), perhaps we could exchange ideas. This is my game blog, though it has only a few posts: http://antaresgame.blogspot.com/

My game is called Antares (it's the name of a star, like your game :)

You can follow me on twitter: @yombo

See ya!

Giupo said...

Fantastico, ammiro la perseveranza per realizzare quello che in anni ho sempre rimandato per incapacità tecniche (lavoro essenzialmente in Java) e artistiche (le mesh dimmi che le hai scaricate da qualche parte :D) ...

Complimenti, proprio ieri configurato OgreSDK su Mac, servisse un port...

Ciao,
Giuseppe

Uchooze said...

I translated what you said Mr Ceti (badly)

The next objectives my personal are while to learn to use the motor better. To manage keyboard, mouse etc. Then I want to implement the post-processing, for riottenere l' effect " bloom" for l' lighting system. Fact this I want to dedicate to me totally (when I obviously have time) to the gameplay real. the graphical part with ogre l' I have resolved, must begin to write the " to us; gioco".

You have done more work!

I am so happy I could twat a horse :OD

We love your game Mr Ceti!

Go Space Fighting :oD

Mr James - Uchooze.com

廖峻漢 said...

hi! i am making cross engine game develope platform, welcome my website.