Light, big surfaces

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
Hirte
Posts: 73
Joined: Sat Apr 01, 2006 1:32 pm

Light, big surfaces

Post by Hirte »

Hello,

I have found some threads, but no one has helped me...

I have a mesh

mesh = smgr->getMesh("./data/models/street_1_1.ms3d");
node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("./data/images/street_1.jpg"));
node->getMaterial(0).EmissiveColor.set(0,0,0,0);
node->setMaterialType(video::EMT_SOLID);
node->setPosition(loc);
node->setRotation(rot);
mesh->drop();

and a dynamic light

scene::ILightSceneNode* light1 = smgr->addLightSceneNode(0,camvec,video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 100.0f);
scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator (camvec,800.0f,0.003f);
light1->addAnimator(anim);
anim->drop();

scene::ISceneNode* bill = smgr->addBillboardSceneNode(light1, core::dimension2d<f32>(60,60));

bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bill->setMaterialTexture(0, driver->getTexture("./data/images/particlered.bmp"));



But when I open the app, there are some problems. The Mesh (just a Box...) seems to have only 4 places to be lighted, the space between stay dark)

Screenshot:
http://www.mn-solutions.net/screen.jpg

Add faces to the box work, but at least 64 faces for one side of the box are unnecessary, hm?

The curbstone seems to be lighted as it should.

Are there any solutions?
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

Code: Select all

Add faces to the box work
afraid that is the only option. afaik the light is 'made' at the vertex. if the 'spacing between the vertexes is huge the light cant 'reach'
perhaps u can tweak it a litle with the light intensity /visiability params, but smooth lighting is only good if the vertex count is increaced ..or a lighmaped level is used
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Hirte
Posts: 73
Joined: Sat Apr 01, 2006 1:32 pm

Post by Hirte »

But the curbstone has the same count of vertexes and work, too?

There is no other way to get this light? Cause the player usually cast shadows, and they aren't visible when they are smaller than half of the street...
YukiKaze
Posts: 7
Joined: Thu Apr 20, 2006 3:34 am

Post by YukiKaze »

You could always post a screenshot of your mesh(wireframe would be ideal, as that gives an idea of the vertex spacing). He's right, though. In realtime polygonal drawing, a face is lit based on how the light is hitting the vertexes. If the vertexes of your mesh are too far away from the light, your entire mesh will be lit as if it's too far away. I'm guessing your curbs are a bit closer to the light sources and higher-resolution than the basic roadway(not modeling it like that would be wasteful).

Increasing your roadway's polygon count is the quickest, most reliable solution. An alternate solution would be to enable per-pixel lighting, which, while it still calculates primarily based on the vertexes, also makes some intermediary calculations based on the bump map of the object. You could try that if you don't want to rebuild your mesh.
Hirte
Posts: 73
Joined: Sat Apr 01, 2006 1:32 pm

Post by Hirte »

Sorry, my PC got broken, wireframe-screenshot is not possible at the moment...

Vertextcount of curbstone and Street are the same, was the same model, scaled in Milkshape and rounded corner;)

3x3x3 vertices.

I've tried to enable per-pixel-lightning with parallax-mapping and normal-mapping (both of the per-pixel-lightning-tutorial), same result.

Increasing the polycount of the mesh is sure possible, but I thought about a maximum count of visible polygons in the scene... or does irrlicht haven't a maximum?

At the moment I have 880 of this roadway-meshes in the whole level, but I will decrease the camera-farValue or make tiles later. A whole level was easier to create;)
YukiKaze
Posts: 7
Joined: Thu Apr 20, 2006 3:34 am

Post by YukiKaze »

Irrlicht doesn't have a fixed maximum polygon density, just whatever your hardware will support.(as it should be.)

If your curb is smaller and closer to the light, then it will be lit better than your roadway. The best suggestion I have is get in and custom-build your meshes to have vertexes every few world-feet(1-foot or 1-yard should be sufficient). A post-beginner-level computer graphics artist using a halfway-decent modeling program can do this. I reccomend Wings.

I'm a little fuzzy on per-pixel lighting, still. .Werkkzeug's tutorials claim that it provides smoother lighting, but the actual results are still heavily polygon-resolution based.
Hirte
Posts: 73
Joined: Sat Apr 01, 2006 1:32 pm

Post by Hirte »

Okay, thanks for your advice. I will increase polycount.
Post Reply