Creating the Sun, emit light, use light source?

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.
Post Reply
Elof Valantor
Posts: 5
Joined: Thu Feb 03, 2011 3:51 pm

Creating the Sun, emit light, use light source?

Post by Elof Valantor »

I'm trying to create a model of the Solar System and am currently working on the Sun. I've got this problem of finding a way to make the Sun provide the light for the rest of the scene and be visible itself.

My current approach is to have a light source at (0,0,0) and put my Sun at (0,0,0) as well. This lights up the planets floating around in the distance, but it does not light up the Sun. I'm assuming this is because the light in being reflected internally. Even if it isn't, it still won't light up the Sun because the light never doubles back...

So I've tried emitting light from the Sun to make it visible, but I don't really know how to do it, and have thus far been unsuccessful. Googling for how to emit light hasn't thrown up much help either.

I've had a thought that perhaps there is a way to invert that internally reflected light to have it reflect outwards instead of inwards, but again, I have no idea how to do that in Irrlicht.

I need someone to tell me how to either A) emit light from an object or B) how I actually should be approaching creating a functioning Sun.

Help is much appreciated!
whisp
Posts: 17
Joined: Sat Jan 09, 2010 1:58 pm

Post by whisp »

I'm not the Irrlicht Pro, so i'm sure others can give you better answers. Personally i would make the sun a very light color, almost white, and i would make it unaffected by lights and ensure it to be unshaded. Could be even a billboard with a circle. So no matter how dark your scene is, your sun would always look bright and unshaded. Then i would add some effects that change, the straighter the camera looks towards the sun, like glare and lenseflare.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

You may not be a pro whisp, but that's probably the best answer :lol: . If you look at a picture of the sun, there is no shading on it, it's just a giant ball of fire. Just turn off lighting on it, and voila. Picture of sun:
Image
Anthony
Posts: 121
Joined: Sun Jan 09, 2011 12:03 pm

Post by Anthony »

If you want to 'fly' around the solarsystem - thus near the sun - just to watch/show how it would be it's maybe best to create a directional light wich always points towards the camera.

This way you can model the sun and create some nice solarflames as Lonesome Ducky shows and the other planets will be lit too.

Hmmm, maybe not updating to the camera but maybe towards the camera its target or where you are viewing -> cast a ray from your eye (midpoint of the screen) straight into the screen until you hit something, that would be the point to aim the directional light to. Same cave-eats can come along I am afraid.

Ain't that impressive a big ball of fire (image above). It's just that unbelievable, And then the time of it that it already burns :shock:
No :shock: I am no noob, just checking if your not one too :roll:

Thanks to Niko and all others that made Irrlicht possible.
Elof Valantor
Posts: 5
Joined: Thu Feb 03, 2011 3:51 pm

Post by Elof Valantor »

Turning off lighting on the Sun has given me what I want for now. The Sun sits there clear as day, and all the planets are still shrouded in sunlight.

Took me a while to get it working... I was using my Planet class for the Sun (lazy). But of course, the planets are using tangent meshes and what-not. I made a new class just for the Sun and took all that out and it works now.

A billboard won't really work for what I want. Eventually my program will have ships flying around and all sorts. It will need a physical Sun to be crash-into-able...
Anthony
Posts: 121
Joined: Sun Jan 09, 2011 12:03 pm

Post by Anthony »

for crashing into the sun, can't you better do a boundingsphere check and start burning the plane? as it would still be well quite a distance to the sun after you've burned.

this will only take one radius and one distance to check against
No :shock: I am no noob, just checking if your not one too :roll:

Thanks to Niko and all others that made Irrlicht possible.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

You could also use a billboard to make the nice glow around the sun.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Lonesome Ducky wrote:You could also use a billboard to make the nice glow around the sun.
I'd actually recommend a glow shader over a billboard to achieve this
Post Reply