Hello.
I'm trying to create a Solar System with Irrlicht and (of course ) I have a problem. So, I have a sun object (IAnimatedSceneNode*) in the origin of the coordinates system, which I've textured. The problem is:
I'm using node->setMaterialFlag(EMF_LIGHTING, false) for each planet, but I want to set the light for them in centre of the Solar System( in my sun ). Is it possible to make it?. when I comment the line: node->setMaterialFlag(EMF_LIGHTING, false) and add ILightSceneNode* within my sun, I see nothing because of my sun object overcasts the light.
Thanks a lot for your answers.
Creating a sun
It will not light the sun itself though. If a light is 'inside' a mesh, that light will not contribute to the lighting calculations for the mesh. If you want the light that is inside the sun to light the sun itself, you have to flip the normals of the sun mesh. Of course that would break all lights that are outside the sun, but if you're looking at the sun you probably won't notice that I'm shining a flashlight at it.even if the light is completely inside your sun it will still light the objects.
Travis
Two-sided lighting would do the trick, though I don't think Irrlicht directly supports this OpenGL feature. Then again, I'm sure this could be done as easily in a custom shader.vitek wrote:It will not light the sun itself though. If a light is 'inside' a mesh, that light will not contribute to the lighting calculations for the mesh.even if the light is completely inside your sun it will still light the objects.
i will drop my 2-cents in if i understand this correctly, you want the planets
to receive light so you should set EMF_LIGHTING, true
and since the sun has no external light to light it up ( as it should be ) but
you want to see it obviously, you can set its material's emissive colors with
node->getMaterial(0).EmissiveColor.set(255,255,255,255)
well.. not 255,255,255.. that would be a bit annoying, but something not
as bright.
at least i think that should work.. im still new to c++ and irrlicht.
to receive light so you should set EMF_LIGHTING, true
and since the sun has no external light to light it up ( as it should be ) but
you want to see it obviously, you can set its material's emissive colors with
node->getMaterial(0).EmissiveColor.set(255,255,255,255)
well.. not 255,255,255.. that would be a bit annoying, but something not
as bright.
at least i think that should work.. im still new to c++ and irrlicht.
or you could implement in irrlicht something like the 3d studio max feature - object self-lighting
but then again... you could use a billboard of some kind that would be the sun and attach a light to it...
you can see how this is made in the tutorial for the Per Pixel Lighting...
Basically you use a sprite that looks like the sun and add a light.
But that is not really efficient if you want it to look realistic when you change the camera possition...
so you could just create your custom light sorrounding the sun (spherical)
and make it light inside and outside... i don't know if that's possible , but it's worth a shot...
but then again... you could use a billboard of some kind that would be the sun and attach a light to it...
you can see how this is made in the tutorial for the Per Pixel Lighting...
Basically you use a sprite that looks like the sun and add a light.
But that is not really efficient if you want it to look realistic when you change the camera possition...
so you could just create your custom light sorrounding the sun (spherical)
and make it light inside and outside... i don't know if that's possible , but it's worth a shot...