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.