Is there a way to light a terrain generated from a heightmap? I tried to add a light scene node onto my terrain and moved it close to the surface of the terrain, but the light doesn't seem to...uhh...light the terrain.
Any ideas?
thanks in advance
Lighting a terrain generated from a heightmap
enable the lightning of the terrain and place a dynamic light high above the terrain with a big radius, then it should get the light (i do it the same way)
if you setup the lightning right you can get some pretty good looking results. i remember that one of my first irrlicht screenshots was this one here where i did the exact same thing:
http://mitglied.lycos.de/animespy2003/s ... hading.JPG
hope you like it bye and good night, i need some sleep
if you setup the lightning right you can get some pretty good looking results. i remember that one of my first irrlicht screenshots was this one here where i did the exact same thing:
http://mitglied.lycos.de/animespy2003/s ... hading.JPG
hope you like it bye and good night, i need some sleep
ok i have another problem. How do you change the light's settings at runtime? I made a little function that changes the radius of the light at runtime, BUT there's one problem, the light doesn't update in real time, i.e. it only updates when the dos-console is the active window.
I know that the radius changes works, since when i alt+tab and switch between the dos console and the main window i see that the light radius has changed.I may have placed the function in the wrong location. Currently i have the following:
enviroObj.runtimeEnvironment() is the function that updates the light's radius.
any help would be appreciated
[/code]
I know that the radius changes works, since when i alt+tab and switch between the dos console and the main window i see that the light radius has changed.I may have placed the function in the wrong location. Currently i have the following:
Code: Select all
while(device->run() && isRunning == true)
{
enviroObj.runtimeEnvironment(0,0,0);
if (device->isWindowActive())
{
driver->beginScene(true, true, 0 );
smgr->drawAll();
env->drawAll();
driver->endScene();
...etc
any help would be appreciated
[/code]
Code: Select all
while(device->run() && isRunning == true)
{
if (device->isWindowActive())
{
driver->beginScene(true, true, 0 );
smgr->drawAll();
env->drawAll();
driver->endScene();
enviroObj.runtimeEnvironment(0,0,0);
...etc
weird. i tried what you suggested and now the radius won't change at all. Maybe it's my function's code. this is what the function has:
i was browsing the API and there doesn't seem to be any function that updates the light, so i'm assuming that changing the light data values directly would automatically update the light.
Code: Select all
void classEnvironment::runtimeEnvironment(int a, int b, int c)
{
timerCounter++;
if (timerCounter >= 1000000)
{
timerCounter = 0;
// darken light
if (brightnessIsDescending == true)
{
lightData = &light->getLightData();
lightData->Radius--;
}
else if (brightnessIsDescending == false)
{
lightData = &light->getLightData();
lightData->Radius++;
}
if (lightData->Radius >= 10)
{
brightnessIsDescending = true;
}
else if (lightData->Radius <= 0)
{
brightnessIsDescending = false;
}
}
}
weird. i tried what you suggested and now the radius won't change at all. Maybe it's my function's code. this is what the function has:
i was browsing the API and there doesn't seem to be any function that updates the light, so i'm assuming that changing the light data values directly would automatically update the light.
Code: Select all
void classEnvironment::runtimeEnvironment(int a, int b, int c)
{
timerCounter++;
if (timerCounter >= 1000000)
{
timerCounter = 0;
// darken light
if (brightnessIsDescending == true)
{
lightData = &light->getLightData();
lightData->Radius--;
}
else if (brightnessIsDescending == false)
{
lightData = &light->getLightData();
lightData->Radius++;
}
if (lightData->Radius >= 10)
{
brightnessIsDescending = true;
}
else if (lightData->Radius <= 0)
{
brightnessIsDescending = false;
}
}
}