.x model lighting (Now it's shadows performance)

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
Kamac
Posts: 6
Joined: Sat Jan 14, 2012 8:54 pm

.x model lighting (Now it's shadows performance)

Post by Kamac »

Hey.

I have a problem, because when i load my .x model with a texture, it's basically in black&white light only. I believe that the light's power is too big. The colors probably are 255,255,255 and only 0,0,0 when not in light. Basically, in light = RGB 255,255,255, not in light RGB = 0,0,0.

Well, here's a screen:

Image

The whole model should be red.

Any way to make the lighting proper?
Last edited by Kamac on Sun Jan 15, 2012 7:18 pm, edited 1 time in total.
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: .x model lighting

Post by RdR »

Whats the shininess of your model?

Code: Select all

 
node->getMaterial(0).Shininess = 1.0f;
 
Kamac
Posts: 6
Joined: Sat Jan 14, 2012 8:54 pm

Re: .x model lighting

Post by Kamac »

Actually, i fixed it!

I had to:
A) Increase ambient color.
B)

Code: Select all

anode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);

But now i have another problem. I want to cast about 20 shadows with addShadowVolumeSceneNode. But it lags so much when i do that! I am not sure why. Is it Irrlicht's performance? I will add that the objects aren't too primitive (basic human mesh) and that the shadow is being casted on the water and terrain, which was made with height&detail map. I [basically] get around 6 FPS and huge lags when i do that.

Have a look:

Code: Select all

for(int n = 0; n<20; n++) {
                node[n] = menage->addAnimatedMeshSceneNode( mesh );
                if(node[n]) {
                        ay += 10;
                        node[n]->setMaterialFlag(EMF_LIGHTING, true);
                        //node->setMaterialTexture(0, video->getTexture("sydney.bmp"));
                        //node[n]->setLoopMode(false);
                        //node[n]->setFrameLoop(0,1);
                        node[n]->setMaterialFlag(video::EMF_FOG_ENABLE, true);
                        node[n]->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
                        node[n]->addShadowVolumeSceneNode(mesh,-1,true,10.0f);
                        node[n]->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
                        if(ay > 100)
                        {
                                ax += 10;
                                ay = 0;
                        }
                        node[n]->setPosition(vector3df(ax,0.0f,ay));
                }
        }
It's creating 20 objects & their shadows.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: .x model lighting (Now it's shadows performance)

Post by Cube_ »

What is the poly count of the high detail things?
I am pretty sure this could be because of unoptimized models.

I'd ŕather do this:
Make a normal map from a high poly model,
reduce the poly count to the lowest possible amount where the model still keeps it's shape.
apply the normal map...
should increase preformance.

alternatively get a better computer (On that matter, what are the specs of your pc. It could just be horrifically bad hardware)
"this is not the bottleneck you are looking for"
Kamac
Posts: 6
Joined: Sat Jan 14, 2012 8:54 pm

Re: .x model lighting (Now it's shadows performance)

Post by Kamac »

I believe my computer isn't that bad. It runs Crysis 2, Mafia II and so on.

The models doesn't seem to be that high poly too. One model is about 1500 polys. Through, 20*1500 = 30.000 polys to cast shadows on.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: .x model lighting (Now it's shadows performance)

Post by Cube_ »

that isn't to bad. then it is most likley your code....
ah well... so much for my idea :/
I got semi-optimized stuff that is @ around 30'000 polys per file (Optimized for making the normal map)
ah well :)
Hope you find a solution.
"this is not the bottleneck you are looking for"
Post Reply