Page 1 of 1

[Solved] Plastic cube

Posted: Mon Oct 12, 2009 7:44 pm
by Grz-
Hello,

i want to try to acheive this kind of plastic rendering in my game for cubes&characters but i don't know where to start:

http://www.iikgames.com/bouncyqubes/images/image07.jpg

I tried a toon shader and also many different light settings but that doesn't look like the same, i also tried flat shading but for some reason i can't get this smooth plastic/marshmallow feeling, this look simple but i can't get the same rendering, any hint on how that was done please?

Posted: Mon Oct 12, 2009 8:41 pm
by vitek
The 'marshmallow' look happens because the cubes aren't actually cubes. They bulge at the sides a bit, which makes them seem squished a little. Instead of using cubes, use a modelled mesh object with the correct shape.

Travis

Posted: Mon Oct 12, 2009 8:54 pm
by Grz-
Thank. Do the blob use this 'technic' too? So it's just some high poly models with lighting?

Posted: Mon Oct 12, 2009 9:17 pm
by Beroc
none of those models look particularly "high" poly. I would say anywhere between 100 and 500 polygons per model at the highest and you could achieve the same result. look for a toon shader tutorial to get the look you are going for.

Posted: Mon Oct 12, 2009 9:18 pm
by vitek
It looks to me like all of this could easily be done with 2d sprites, possibly rendered from 3d objects. Even if they are 3d, I don't think the models have to be exceptionally high quality to get what you see in that image.

Travis

Posted: Mon Oct 12, 2009 10:22 pm
by jpoag
Is that dEvil Dice?

Looks like the old playstation game minus the numbers. If that's the case then the cubes rotate about their corners (and need to be 3d models).

Posted: Mon Oct 12, 2009 10:49 pm
by Grz-
Nop, it's a remake of Q*Bert without the pyramid level style: http://www.iikgames.com/bouncyqubes/

Well i know that theses was not particularly high poly but by looking at the blob shape/ligthing, it seem to be pretty smooth, anyway i will try to make the same kind of mesh and render it with a toon shader, thank.

PS: Looking at the system requirement, it seem this game don't use any shaders, it would be better if i can avoid using shaders too... i don't think toon shader is necessary...

Posted: Tue Oct 13, 2009 2:30 am
by DavidJE13
looks like ~80 triangles per block (10 per corner) would be easily enough to match this game (you can see it's fairly low poly). Even less if you don't include the cube bases & other faces you never see.
You don't need to use any special toon stuff - this thing's just using textures with 1 light square and the rest slightly darker. There's not even any lighting.

Posted: Tue Oct 13, 2009 7:25 am
by Grz-
I tried to make a cube mesh that have round edge and exported it to .obj but now edge are shown by blacks line in irrlicht:

Image

it look like that in Blender:

Image

I used only material color with shadeless option.

Here is the code i use to add the mesh:

Code: Select all

            node = smgr->addMeshSceneNode(qbe);
            node->setScale(core::vector3df(5.0f,5.0f,5.0f));
            node->setPosition(core::vector3df(xOffset,yOffset,zOffset));
            node->setRotation(core::vector3df(0.0f,45.0f,0.0f));
            node->setMaterialFlag(video::EMF_WIREFRAME,false);
            node->setMaterialFlag(video::EMF_LIGHTING,false);
The mesh can be downloaded here:

.obj
.mtl

Posted: Tue Oct 13, 2009 4:16 pm
by vitek
Looks like you had a problem exporting your mesh to me. You could use the 09.MeshViewer example to look at it, or you could use the following code...

Code: Select all

#include <irrlicht.h>
using namespace irr;

#ifdef _IRR_WINDOWS_
#  pragma comment(lib, "Irrlicht.lib")
#endif

int main()
{
  IrrlichtDevice *device = createDevice(video::EDT_OPENGL);
  if (!device)
    return 1;

  video::IVideoDriver* driver = device->getVideoDriver();
  scene::ISceneManager* smgr = device->getSceneManager();

  // get a camera
  scene::ISceneNode* camera = smgr->addCameraSceneNodeFPS();

  const core::vector3df pos(1020.f, 0.f, 1020.f);
  camera->setPosition(pos);

  // get some background
	smgr->addSkyBoxSceneNode(
    driver->getTexture("../../media/irrlicht2_up.jpg"),
	  driver->getTexture("../../media/irrlicht2_dn.jpg"),
	  driver->getTexture("../../media/irrlicht2_lf.jpg"),
	  driver->getTexture("../../media/irrlicht2_rt.jpg"),
	  driver->getTexture("../../media/irrlicht2_ft.jpg"),
	  driver->getTexture("../../media/irrlicht2_bk.jpg"));

  scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/qbe.obj");

  scene::ISceneNode* node = smgr->addMeshSceneNode(mesh->getMesh(0));
  node->setMaterialFlag(video::EMF_LIGHTING, false);
  node->setMaterialFlag(video::EMF_WIREFRAME, true);
  //node->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);

  const core::vector3df scl (1000.f, 1000.f, 1000.f);
  node->setScale(scl);

  while(device->run()) 
  { 
    if (driver->beginScene(true, true, video::SColor(0,200,200,200))) 
    { 
      smgr->drawAll(); 

      driver->endScene(); 
    } 
  } 

  device->drop();

  return 0;
}
As you can see, some of the faces along the edges are flipped. If you leave backface culling on, they will not be rendered. If you fix your mesh, or disable backface culling, then the cube will appear as intended.

Travis

Posted: Wed Oct 14, 2009 12:16 pm
by Grz-
Great, i fixed the mesh and added some nice materials/lights settings and it's close that i wanted, thank you all. :)

Image

Posted: Wed Oct 14, 2009 1:19 pm
by Virion
hey that's looking great 8) good luck

Posted: Wed Oct 14, 2009 3:04 pm
by Eigen
Q*Bert remake? :D