Page 1 of 1

3D models without texture

Posted: Wed Dec 22, 2010 8:40 pm
by xiaOK
I created a simple red cube without texture in 3ds max, and exported to 3ds.
When I load it to my Irrlicht app, it looks very "2D" red shape. Is it possible to make it look like as it in 3ds max?

Re: 3D models without texture

Posted: Wed Dec 22, 2010 8:51 pm
by Radikalizm
xiaOK wrote:I created a simple red cube without texture in 3ds max, and exported to 3ds.
When I load it to my Irrlicht app, it looks very "2D" red shape. Is it possible to make it look like as it in 3ds max?
I think 3ds max has a directional light set up with gouraud shading applied as the default shading method and a pretty strong ambient light so the faces which aren't affected by the directional light don't get too dark

Re: 3D models without texture

Posted: Wed Dec 22, 2010 9:15 pm
by xiaOK
Radikalizm wrote:
xiaOK wrote:I created a simple red cube without texture in 3ds max, and exported to 3ds.
When I load it to my Irrlicht app, it looks very "2D" red shape. Is it possible to make it look like as it in 3ds max?
I think 3ds max has a directional light set up with gouraud shading applied as the default shading method and a pretty strong ambient light so the faces which aren't affected by the directional light don't get too dark
Thanks! But, how can set the shading method in Irrlicht? I can't find any tutorial.

Posted: Wed Dec 22, 2010 9:34 pm
by Radikalizm
you can enable gouraud shading in the node's SMaterial i believe

Posted: Thu Dec 23, 2010 12:12 am
by hybrid
Gouraud shading is enabled by default. You probably need a light node.

Posted: Thu Dec 23, 2010 12:45 am
by yaten
Hi Sir xiaOK, I prepared a small demo which loads a very basic 3ds file for your convenience. It is actually derived from the very first example (01.HelloWorld), I just trimmed it down and added lighting.

Source code with .3ds file and .max
source and assets

Code: Select all

#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
	IrrlichtDevice *device =
		createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
			false, false, false, 0);
	if (!device) return 1;
	device->setWindowCaption(L"Load 3ds");
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IAnimatedMesh* mesh = smgr->getMesh("Assets/native_box.3ds");
	if (!mesh)
	{
		device->drop();
		return 1;
	}
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
	ILightSceneNode* light0 = smgr->addLightSceneNode( 
		0,									// parent node
		core::vector3df(-10, 40, -20),		// position
		video::SColorf( 1.0f, 0.0f, 0.0f),	// color
		30.0f,								// radius
		1 );								// id

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,100,101,140));
		smgr->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
}
Screenshot:
Image

I hope that can help ^_^

Posted: Thu Dec 23, 2010 11:55 am
by xiaOK
Thanks yaten! That's really help!!