Basic outdoor lighting
Basic outdoor lighting
Hi
Im doing a aircraft game. So far i have no lighting at all which of course looks like crap:
http://postimg.org/image/7z95e1vv3/
So what could be a good and simple solution for me? Im new to this, but i would like something like a global "sun" light that hopefully gives a little more life to the objects. The units can move around obviously so how would this work with shadows etc?
Completely unlit everything looks pretty bad. The alternative is to tone down the lightness of all textures but im hoping i can manage something a little more sophisticated:)
Thanks for your help
Erik
Im doing a aircraft game. So far i have no lighting at all which of course looks like crap:
http://postimg.org/image/7z95e1vv3/
So what could be a good and simple solution for me? Im new to this, but i would like something like a global "sun" light that hopefully gives a little more life to the objects. The units can move around obviously so how would this work with shadows etc?
Completely unlit everything looks pretty bad. The alternative is to tone down the lightness of all textures but im hoping i can manage something a little more sophisticated:)
Thanks for your help
Erik
Re: Basic outdoor lighting
well the most simple solution is to use as sun a directional yellow light and as ambient color a light blue (atmosphere color).. You could improve a lot by replacing the ambient light with a lightened version of the skybox but that requires some shader knowledge. it is worth learning shaders by the way. Remember also to use brighter textures if they look bad or dark after light application (use a white cube as reference, so you know how bright will be the brightest color)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: Basic outdoor lighting
1. I do this for the sun:
But changing the color changes nothing. The lit side of the nodes are just white. How do i control intensity? And about radius (i just set it very high now as seen above). Is the source still just a point and radius just how far the light is projected? (this is what it seems like to me)
2. I set up each node as this:
But the unlit side (away from the sun) is still just black. Any idea?
Thanks a lot!
Erik
Code: Select all
ISceneNode * light= gfx.smgr->addLightSceneNode(0, vect3d(2100,500,1900),SColor(100,180,180,255),8000000.0f);
2. I set up each node as this:
Code: Select all
o->node->setMaterialFlag(video::EMF_LIGHTING,true);
o->node->setMaterialFlag(EMF_FOG_ENABLE, true);
int matCount=o->node->getMaterialCount();
for(int i=0;i<matCount;i++)
o->node->getMaterial(i).AmbientColor.set(255,255,0,0);
Thanks a lot!
Erik
Re: Basic outdoor lighting
Did not set the scene's ambient light value perhaps? smgr->setAmbientLight
Re: Basic outdoor lighting
Cool now i get some effect!
But the ambientcolor of the nodes, doesnt it matter? Or is it blended with the color from the "global" scene ambient color?
But the ambientcolor of the nodes, doesnt it matter? Or is it blended with the color from the "global" scene ambient color?
Re: Basic outdoor lighting
It's multiplied with the ambient light.
Re: Basic outdoor lighting
Cool.
Is it correct that SColor is ARGB but SColorf is RGBA?
So the order is different? Isnt this a bit confusing?
Also, the "sun" intensity seems to be the same no matter what i set:
SColor(255,0,0,35)
and
SColor(255,0,0,255)
makes the nodes the exact blue color. And alpha seems to not matter either...
Is it correct that SColor is ARGB but SColorf is RGBA?
So the order is different? Isnt this a bit confusing?
Also, the "sun" intensity seems to be the same no matter what i set:
SColor(255,0,0,35)
and
SColor(255,0,0,255)
makes the nodes the exact blue color. And alpha seems to not matter either...
Re: Basic outdoor lighting
I agree the mixed color ordering is bad. Lighting colors all ignore alpha.
If you need more control than the fixed function pipeline gives, you need to write shaders.
If you need more control than the fixed function pipeline gives, you need to write shaders.
Re: Basic outdoor lighting
Ok i understand shaders offers more flexibility but light intensity doesnt exist at all in the base engine? Seems strange. So only light or no light? (no way to scale HOW much light there is?)
When i set the ambient light
smgr->setAmbientLight(SColorf(0.3,0.3,0.3,1));
there is a different if i use smaller or bigger numbers (if i keep them balanced such as above its still neutral/white light but i can scale the intensity of the ambient light).
But this doesnt seem to apply to the ligth node (sun) that i place. Should it be like this? Ambient has intensity but light sources has not? I dont want full light (extremely light) for all objects.
When i set the ambient light
smgr->setAmbientLight(SColorf(0.3,0.3,0.3,1));
there is a different if i use smaller or bigger numbers (if i keep them balanced such as above its still neutral/white light but i can scale the intensity of the ambient light).
But this doesnt seem to apply to the ligth node (sun) that i place. Should it be like this? Ambient has intensity but light sources has not? I dont want full light (extremely light) for all objects.
Re: Basic outdoor lighting
No, the fixed function pipeline has a specific light intensity curve based on distance.
Re: Basic outdoor lighting
Keep in mind also that to get the correct lighting you need to normalize the normals (if they aren't already )
To get a good outdoors lighting i would create a directional light, but the directional lights have also a falloff, which comes from the center of the light (its position) and fades with the distance, so you could also attach a directional light to your camera so the visible objects are always lit, and rotate the light to get the proper direction.
To get a good outdoors lighting i would create a directional light, but the directional lights have also a falloff, which comes from the center of the light (its position) and fades with the distance, so you could also attach a directional light to your camera so the visible objects are always lit, and rotate the light to get the proper direction.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt