.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.

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

Postby Kamac » Sun Jan 15, 2012 4:33 pm

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

Re: .x model lighting

Postby RdR » Sun Jan 15, 2012 6:02 pm

Whats the shininess of your model?

cpp Code: Select all
 
node->getMaterial(0).Shininess = 1.0f;
 
User avatar
RdR
Competition winner
 
Posts: 259
Joined: Tue Mar 29, 2011 2:58 pm

Re: .x model lighting

Postby Kamac » Sun Jan 15, 2012 6:13 pm

Actually, i fixed it!

I had to:
A) Increase ambient color.
B)
cpp 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:

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

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

Postby aaammmsterdddam » Sun Jan 15, 2012 11:11 pm

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)
(n^(n-n))-1
aaammmsterdddam
 
Posts: 520
Joined: Mon Oct 24, 2011 10:03 pm

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

Postby Kamac » Mon Jan 16, 2012 8:54 am

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

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

Postby aaammmsterdddam » Mon Jan 16, 2012 8:25 pm

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.
(n^(n-n))-1
aaammmsterdddam
 
Posts: 520
Joined: Mon Oct 24, 2011 10:03 pm


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 0 guests