3D models without texture

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
xiaOK
Posts: 6
Joined: Wed Dec 22, 2010 8:34 pm

3D models without texture

Post 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?
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: 3D models without texture

Post 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
xiaOK
Posts: 6
Joined: Wed Dec 22, 2010 8:34 pm

Re: 3D models without texture

Post 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.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

you can enable gouraud shading in the node's SMaterial i believe
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Gouraud shading is enabled by default. You probably need a light node.
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

Post 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 ^_^
xiaOK
Posts: 6
Joined: Wed Dec 22, 2010 8:34 pm

Post by xiaOK »

Thanks yaten! That's really help!!
Post Reply