[SOLVED] trees not lit

AlexDW

09-02-2010 10:07:28

Hi. I have a problem with using PagedGeometry.

I add the trees with TreeLoader3d and I render with OpenGL.

The trees rendered are all black (the impostor work fine) (they seem not to be lit - see image below). If i put the trees using scene nodes everything works fine.



I was using Caelum which generated all my lights in the scene, but i made id simpler and now I use only ambient light (0.8, 0.8, 1.0) but the trees are still black, although from my understanding, based on the material i use, they should be colored.

I know I am missing something or I don't understand something as I should.

I looked over some other topics
viewtopic.php?f=14&t=8153
but that did not help.

This is a very simple setup. I have looked over the code for example 8 but i couldn't find anything missing in my code.

I would appreciate any insight.

Thank you!

Fish

09-02-2010 15:23:12

In the BatchPage and WindBatchPage code there is a method called _updateShaders(). Near the top of that function there is a for-loop that checks if lighting should be enabled. Check if the "lightingEnabled" variable is being set to true when that for-loop terminates.

-Fish

AlexDW

10-02-2010 08:36:38

Yes. The variable lightingEnabled is set to true.

I have previously tried to modify the material file writing lighting on, but than i read that that value is used by default so i deleted it. I now use the original unmodified material files that came with pagedGeoemtry.

tod

10-02-2010 15:11:01

I have the same problem with the sample applications (all the samples except the last one with the forest and mushrooms, etc.). And weirder still in direct X the trees are white for the right half of the screen if I remember properly. Or vice-versa :D
I've browsed the forums and there was something about trying to use a light map when no light map is provided that sounded like could be the case, but haven't got the time to get into details. Of course I'm a noob so I could be way off.
Anyway, please post the solution if you find it.

Fish

10-02-2010 15:40:15

Try increasing the diffuse light parameter of your global directional light. I think that imposters are always full bright.

-Fish

AlexDW

11-02-2010 10:00:03

That did not help either :(

I have in my scene (which i set up in my createScene method) these following lights:

mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.4));
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);

Light *light;

light = mSceneMgr->createLight("Light3");
light->setType(Light::LT_DIRECTIONAL);
light->setDiffuseColour(ColourValue(.75, .0, 0));
light->setSpecularColour(ColourValue(.75, .0, 0));

light->setDirection(Vector3( 0, -1, 1 ));


If example 8 wouldn't be working i would thing that there was something wrong with my hardware, but i do not understand why example 8 is working, and mine not, i keep looking over the code but i cannot find anything different that would influence the lighting of the trees.

Thank you for your replies!

AlexDW

11-02-2010 10:05:16

P.S. Don't mind the value of the colors, i have tried with different combinations.

mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

light->setDiffuseColour(ColourValue(1, 1, 1));
light->setSpecularColour(ColourValue(1, 1, 1));

light->setDirection(Vector3( 0, -1, 1 ));


This were my original settings!
I have also tried with or without SpecularColour set.

AlexDW

23-03-2010 14:36:53

I have a future information which might help.

If I use the ExampleApplication everything seems to work fine.

However in my project I have used SampleFramework, and with this SampleFramework it does not work.

So I am guessing that it has something to do with some settings which are defined in ExampleApplication and are not present in SampleFramework, but I do not know which might be. I am still looking....

If you have any idea where I should start or on what I should concentrate it would be much appreciated.

Thank you!

AlexDW

30-03-2010 13:10:36

It seems that was a problem with the shadow type.

I was using
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);

and it seems there is a problem with this type of shadow, as the trees are not lit at all. Probably there are other settings which I did not set accordingly for this shadow type to work.

I have changed it to
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE);
and now it is working.

Any way thank you for your interest and replies :)

tdev

30-03-2010 22:59:06

thanks for letting us know what the problem was :)