My3d and dynamic lighting...

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

My3d and dynamic lighting...

Post by disanti »

Hello,

Ran into a little problem with the My3d lightmapping... It cannot be effected by dynamic lights at all...

I tried setting the material type to EMT_LIGHTMAP_LIGHTING, and setting EMF_LIGHTING to true. No luck!

After a forum search, I found a patch that apparently gets BSP dynamic lighting to work, however, it didn't work with My3d.

Any ideas? Thanks
________
Suzuki Tl1000S
Last edited by disanti on Sun Feb 27, 2011 11:12 pm, edited 1 time in total.
Guest

Post by Guest »

I'm pretty sure I had that working in the past..

try a simple cube with a light map and then stick some brigh red lights animating around it

also make your cube with lots of vertices to see the effect better (as it is per vertex lighting) then tell us your results.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Zdimitor's sample project has some rotating dynamic lights affecting My3d meshes.

It was part of latest version full download on his site but I just checked it and it seems to be down. Let me compress it and I'll upload it for you after I get home. :wink:

Edit: site's up but it's a relatively big DL (16 mb):
http://my3dproject.nm.ru/

dl link:
http://my3dproject.nm.ru/downloading/My ... 6.full.zip

but the zipped app is only 3mb. Let me know if you need it and I'll upload it.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Wow, thats bigger than Irrlicht! I'll take a look.

Edit: Absolutely NO luck after looking through examples... what was the point of that? :roll:
Last edited by disanti on Sun Feb 27, 2011 11:12 pm, edited 1 time in total.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Zdimitor's sample project has some rotating dynamic lights affecting My3d meshes.
the point was to see how he used dynamic lights in his app and compare the code with yours.
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

the point was to see how he used dynamic lights in his app and compare the code with yours.
The problem is that there is absolutely no special code to get the dynamic lighting to work. In fact, the my3d object that did have dynamic lighting didn't have a lightmap. :P
Very big help:

Code: Select all

//---------------------------------------------------
	// adds test scene (exported from 3dsmax5)
	//---------------------------------------------------

	mesh = smgr->getMesh("max5_test_dynamic_lighting/test_max5_text.my3d");	
  
	scene::IAnimatedMeshSceneNode* max5_text = smgr->addAnimatedMeshSceneNode(mesh);	

	max5_text->setDebugDataVisible(true);
________
MOTORCYCLE TIRES
Last edited by disanti on Sun Feb 27, 2011 11:12 pm, edited 1 time in total.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

you're absolutely right! :shock: :shock:

I thought there was a
node->setMaterialFlag(video::EMF_LIGHTING, true);
somewhere but there wasn't !!!!

really weird. So I thought it was something to do in the material editor in the max 5 model (max5_test_dynamic_lighting folder) but the materials have got nothing in particular (besides the reflection layer in some of them).

I'll check it more calmly this afternoon. Now the curiosity bug bit me :wink:
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

I just added:

Code: Select all

mesh = smgr->getMesh("max5_test_dynamic_lighting/test_max5_text.my3d");	
  
	scene::IAnimatedMeshSceneNode* max5_text = smgr->addAnimatedMeshSceneNode(mesh);	

	max5_text->setDebugDataVisible(true);
	max5_text->setMaterialFlag(video::EMF_LIGHTING, true);
And if I set the flag to "false" dynamic lights are turned off (duh! :wink: ), which only means dynamic lights are set on by default unless you set them to false.

mmmmmmmhhh... so far that... I'll keep on scratching my head :D
mikeee
Posts: 9
Joined: Tue Feb 14, 2006 3:15 pm
Location: Germany

Post by mikeee »

Im new to Irrlicht and it's my first post here, so HALLO guys :)

I had same problem with Lightmapped My3d and dynamic lights
You should use EMT_LIGHTMAP_LIGHTING type instead of EMT_LIGHTMAP

node->setMaterialType(video::EMT_LIGHTMAP_LIGHTING );

Its like EMT_LIGHTMAP but also supports dynamic lighting.

:)
Guest

Post by Guest »

He said he tried that in his first post! I have used that flag and it does work but make sure you have set up a decent light/set of lights as it can be really subtle depending on the size of the mesh and the position of the lights etc.

An easy way to tell is just import an my3d mesh with a lightmap on some surfaces but not on others then add a light and use LIGHTMAP_LIGHTING -- you should see some shading on the parts without a lightmap (technically the mesh is all lightmapped it's just easier to see the effect on a non mapped part).
mikeee
Posts: 9
Joined: Tue Feb 14, 2006 3:15 pm
Location: Germany

Post by mikeee »

yes,I know, I wanna only said, that's working pretty good without any extra code - for me it was ok at first time - It seems, I had luck ;)
But that's right, sometimes it is nesessery to play a bit with light's radius/ distance/ etc..

EDIT: Lightmapping on My3d's is pretty important for me, so im tried couple of scenes and that's what im noticed :
Sometimes when EMT_LIGHTMAP_LIGHTING is added to the mesh, its getting very dark in Irrlicht.
You can resolve this problem by incrasing faces / polys of your mesh.
In 3DStudio, you can do it by applying modifiers like "Tessellate" or "Mesh Smooth" to the mesh.
needforhint
Posts: 322
Joined: Tue Aug 30, 2005 10:34 am
Location: slovakia

Post by needforhint »

I actualy did running dynamic lights on lightmaped my3d meshes, but it changed the light map very strangely (darkened it upand so on), I just used the flags like you disanti but only with the multyplyer of M4 I think, it was one of the very first things I did in irrlicht .... simply the results vere strange... I dodn't like the idea of lightmapped textures taking dynamic lights on them, it simply can't be done the way you want it :roll:
what is this thing...
Post Reply