About
Cast : an object made by shaping molten metal or similar material in a mold. The general idea of the rendering, by measuring volume using distance function. instead of using 3d textures, 2d textures are used. like pouring molten metal into mold to get desired object. Source Released using MIT license.
status
this software are part of my experiment on rendering. this codes are barely working, there are culling issue, lighting & shadow issue. source code are not in a good shape, i'm still noob in the third dimension.
How to Use
first create an instance of CastRender
Code: Select all
using namespace cast;
using namespace volumetric_scene;
CCastRender* cast = new CCastRender(device, dimension2d<u32>(W,H));
cast->fogColor = SColor(0xff884422);
cast->ambientColor = SColorf(0xff884422);
cast->setCameraFoV(60.0f);
Code: Select all
dinamicLight* sun = new dinamicLight();
sun->position.X = 0.0f;
sun->position.Y = -20.0f;
sun->position.Z = 10.0f;
sun->color.setRed(255);
sun->color.setGreen(255);
sun->color.setBlue(255);
sun->radius = 5.0f;
sun->castShadows = true;
cast->addLamp(sun);
Code: Select all
BaseObject* ob;
ob = new BaseObject(cast );
ob->setHeightMap(driver->getTexture("./textures/tileheight.jpg"));
ob->setColorMap(driver->getTexture("./textures/tile.jpg"));
ob->setScale(vector3df(32.0f, 0.25f, 32.0f));
ob->uvMul = vector2df(16.0f,16.0f);
cast->addObject(ob);
Code: Select all
while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));
cast->update();
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
if you compile the source code as it is, you will find some lines in the main function to create demos. uncomment one to see other demo.
Code: Select all
// uncomment one
//demoCube(cast, driver);
//demoIndianTemple(cast, driver);
//demoTilingBricks(cast, driver);
//demoTransparentSurface(cast, driver);
//demoCiliderObject(cast, driver);
//demoSphereObject(cast, driver);
//demoComposit(cast,driver); // maximum object per composite
demoWarrior(cast,driver);
//demoHelloWorld(cast,driver);
https://github.com/kornwaretm/Cast-Render
if you are interested in this, please let me know, post a screenshoot, hardware spec, and FPS reply. or may be an idea, correction and critique also welcome.
have fun, korn