Page 1 of 2

### Some thoughts about light in general

Posted: Thu Jul 18, 2013 10:31 am
I would like to have the current lights to throw shadows when an item is in the way - because they are on the ground.

But shadows is an own theme (e. g. seeing the object-shadows wandering with the sun would be really cool).

And I would like to have the lamps-light behaving more like real lights. Real light-sources behave like 1/r^2 . This means, there is a very lighted point around the source and then the light very fast darkens and then there is a big, dark area around it.

I think in factorio they behave more like 1-r, which means, that the light is descending linearly around the source and at some radius the light disappears...

See the difference:
http://rechneronline.de/function-graphs/

At the bottom put in this 2 strings and press load graph:

Code: Select all

``````Linear :
a0=2&a1=5-x&a2=&a3=&a4=1&a5=4&a6=8&a7=1&a8=1&a9=1&b0=500&b1=500&b2=0&b3=5&b4=0&b5=5&b6=10&b7=10&b8=5&b9=5&c0=3&c1=0&c2=1&c3=1&c4=1&c5=1&c6=1&c7=0&c8=0&c9=0&d0=1&d1=20&d2=20&d3=0&d4=&d5=&d6=&d7=&d8=&d9=&e0=&e1=&e2=&e3=&e4=14&e5=14&e6=13&e7=12&e8=0&e9=0&f0=0&f1=1&f2=1&f3=0&f4=0&f5=&f6=&f7=&f8=&f9=&g0=&g1=1&g2=1&g3=0&g4=0&g5=0&g6=Y&g7=ffffff&g8=a0b0c0&g9=6080a0&h0=1&z

1/r^2 :
a0=2&a1=1/x^2&a2=&a3=&a4=1&a5=4&a6=8&a7=1&a8=1&a9=1&b0=500&b1=500&b2=0&b3=5&b4=0&b5=5&b6=10&b7=10&b8=5&b9=5&c0=3&c1=0&c2=1&c3=1&c4=1&c5=1&c6=1&c7=0&c8=0&c9=0&d0=1&d1=20&d2=20&d3=0&d4=&d5=&d6=&d7=&d8=&d9=&e0=&e1=&e2=&e3=&e4=14&e5=14&e6=13&e7=12&e8=0&e9=0&f0=0&f1=1&f2=1&f3=0&f4=0&f5=&f6=&f7=&f8=&f9=&g0=&g1=1&g2=1&g3=0&g4=0&g5=0&g6=Y&g7=ffffff&g8=a0b0c0&g9=6080a0&h0=1&z
``````
Also I would like to have a different light-color for the lamps - I think for orange-lights, like in big industry-complexes, or maybe also a very greenish light.

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 12:21 pm
Creating dynamic shadows with curent game engine would be verry dificult. Why?
Since all ingame objects are rendered with the use of sprites it is verry hard to make dynamic realistic shadows as you don't have the object shape information.

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 12:44 pm
For better imagination how lights in the game can or better should look (in my opinion):

http://www.holidaycheck.de/vollbild-Min ... 50125.html

You see: Lights in the night gives only a very small dot of light, they are a bit blurred, but then the light is very soon very dark, but shines over a wide area.
The current lights for example: They are like a mask which keeps the area around the light looking like at day. I think more of shining the contours of other stuff around a light, which should look much cooler than yet.

@SilverWarrior:
All objects have a shadow-image yet. It's just a matter of twisting and streching this shadow. I don't see any general problem with that....

In detail that you understand, that it is not so complicated:

Early morning: Only blue light, no shadow
Then: blue and red light (violet)
Morning is over: White light, no shadows
Day: Only white light, but shadows of items wander about 45 degrees - thats enough to see it, but don't need to compute complicated stuff, just stretching the shadow-image a bit.
Evening: Process in the other way as morning.

The most time, no shadow is needed and when the shadow is shown, you need to move it only for 45 degrees... just calculating the shadow for every building every minute should be enough...

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 2:09 pm
Hm, I want to add this to the above post:
To achive the result I would like to see, every item needs a number of extra bitmaps (layers) which shows it lighted from 8 different angles (maybe 4 are also enough). As long as the item is a 3D-Model, rendering it with different lightning should make no problems. As a result we have eight grey-bitmaps which shows the item lighted from different angles.

To render it we need to calculate how much light comes from the 8 different directions around it (and which color). All 8 bitmaps are then recalculated depending on the calculated amount of light. The result is then blended over the "rest of daylighted" (=the current) image.

This is not very simple and costs a lot of CPU, but I think the results should look absolutely cool. Maybe the game switches to simpler view, if it becomes too slow?

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 7:06 pm
This seems too complicated without much gain. I'd rather if developers aimed at content (and stuff) rather than eye-candy.

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 9:09 pm
ssilk wrote:You see: Lights in the night gives only a very small dot of light, they are a bit blurred, but then the light is very soon very dark, but shines over a wide area.
Not ture. That is only visible on digital cameras this way. To understand this more you should check terms overexposure and underexposure.
You can also check this out by yourself. How?
During night time try to take picture of the moon and you will see that on such picture you won't be able to see stars in the bacground while you can still see them with naked eyes.
This happens becouse your camera automatically darkens the whole image becouse there is lots of light comming from the mon.

ssilk wrote:All objects have a shadow-image yet. It's just a matter of twisting and streching this shadow. I don't see any general problem with that....
When you expose some object with light from different side it will create different shape od the shadow. Take your hand for example:
If you hold all your fingers straight and seperated and observe the shadow when you are rotating your hand you will se that your theory might apply.
But if you simply touch tips of your poiter finger and ring finger together and do the same you will see that your theory is no longer valid.
Why is that? While you have your fingers straight and seperated your hand forms 2D like shape but when you touch tips of your index finger and ring finger the overal shape of your hand becomes of more complex 3D shape which casts much complex shadows which laregly depends on your hand orientation.

As a game developer myself I did quite some trial and error on making nice dynamic shadows in 2D enviroment. And it is much more complicated that it seems at first.

Best option would be precreating multiple shadows for light exposure for each of ingame object. But for this you actually need to have 3D model of your object.
So if you already have 3D model for all of your ingame objects why not turn your whole game into 3D and then use modern aproaches for casting realistic shadows.

As it was already sad too much work for too litle gain.

### Re: Some thoughts about light in general

Posted: Thu Jul 18, 2013 9:34 pm
Dr.Eddy wrote:This seems too complicated without much gain. I'd rather if developers aimed at content (and stuff) rather than eye-candy.
+1

### Re: Some thoughts about light in general

Posted: Fri Jul 19, 2013 12:34 am
Indeed... Too much waste of time for too little benefit. It would also make modding much harder as people would need to make 3D models of everything new.

### Re: Some thoughts about light in general

Posted: Fri Jul 19, 2013 5:06 pm
SilverWarrior: I understand, that you currently think that this is too much work. Btw. I said that too. But I think you mean I'm a little bit stupid, when I want that. And think I haven't thought of all the stuff with different angels, shadows, rotating etc.

II thought to the rich details of the game-graphics. So much work!! Really fantastic work!, but in the night, it just looks .... hmmm. Nothing is left of it. It looks wired.

The current look and feel is, that the night is black filter of the day (and I think this was complicated enough). But my vision is, that it looks completly different.

I didn't say the pure blackness is bad, but when I have light I want to see something different, something, which is worth looking in detail and not something, which unsettles me a bit, because it's looking so unnatural.

To be more concrete, simple things can be done to achive that:
- using more saturated colors
- instead of black-filter the filter has some color
- the shadows doesn't make sense in the night
- making that the light fades out more natural in the distance
- some kind of filter which enhances the contours and "simulates" light from a direction, there are some games, which already do that.
- straight lined shadows just by the edges of a building (this is NOT extremly complicated to calculate!)
- and there are about a dozen of other things, that can be made without much afford.

That's just a punch of ideas. And it is no wasted, because the graphic is that, what the most players see at first!

And conclusion of this: A different look can of course be achieved in SOME ways, which are not so hard to achieve as my suggestions.

But I think - and I'm here not the same opinion then the others - that the look of the game - especially in the night - needs a lot more work, otherwise, the whole afford of the graphics is a bit wasted.

### Re: Some thoughts about light in general

Posted: Sat Jul 20, 2013 3:53 pm
ssilk wrote:But I think you mean I'm a little bit stupid, when I want that.
Not at all. I never thought of you being stupid.
To be honest I would also like to see your sugestion implemented but as a game developer myself I know that it is nowhere easy to implement.

As a gamer I have played lots and lots of games. Many (to many) of them had awsome graphics but crappy gameplay. So I would rather play game with crappy graphics and great gameplay than game with great graphics and crappy gameply becouse the later would always bee crappy game.
Also in my time I monitored many games under development and seen to many being ceased becouse developers spent to much time on graphics and finally lose interest for further development becouse after all that time they still didn't have game with decent playability.

So if you see me posting here and on some other forum about some other game you can be sure that I will rather support and idea which brings new feature to the game than the idea that simply makes game look a bit better.

### Re: Some thoughts about light in general

Posted: Sat Jul 20, 2013 10:15 pm
SilverWarior wrote: Many (to many) of them had awsome graphics but crappy gameplay. So I would rather play game with crappy graphics and great gameplay than game with great graphics and crappy gameply becouse the later would always bee crappy game.
... you can be sure that I will rather support and idea which brings new feature to the game than the idea that simply makes game look a bit better.
Too true.
To the developers: forgot about anything I suggested above, it's too early to think about it!

### Normal maps for cool lighting effects

Posted: Wed May 21, 2014 7:56 am
Since the sprites are created in a 3D package, it would be relatively simple to also have normal maps for them.

This would allow some really cool lighting effects (including changing time of day, although of course this messes up shadows!)

I understand that there are issues with the huge atlases at the moment, however, so perhaps this could be an option for people with more memory on their graphics cards.

### Normal maps for cool lighting effects

Posted: Wed May 21, 2014 7:57 am
Moved to this thread cause of initiator-request. -- ssilk
Another thread, also created by Tenebrous, with the same name is merged into this. --ssilk

-----------------------

Since the sprites are created in a 3D package, it would be relatively simple to also have normal maps for them.

This would allow some really cool lighting effects (including changing time of day, although of course this messes up shadows!)

I understand that there are issues with the huge atlases at the moment, however, so perhaps this could be an option for people with more memory on their graphics cards.

Example from a tool called 'Sprite Lamp'

Edit: By 'time of day', I meant changing the lighting direction based on time of day, as obviously the game already has night/day

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 8:27 am
Tenebrous wrote:Since the sprites are created in a 3D package, it would be relatively simple to also have normal maps for them.

This would allow some really cool lighting effects (including changing time of day, although of course this messes up shadows!)

I understand that there are issues with the huge atlases at the moment, however, so perhaps this could be an option for people with more memory on their graphics cards.

Example from a tool called 'Sprite Lamp'
Damn, its amazing.

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 8:58 am
Well, that isn't that easy. Technically there are some things standing against it.
- the sprites are rendered with light coming from upper left. If you change the direction it would look strange
- extra shadows need more RAM. It's already a big issue, that the sprites use too much video-ram.
- it would make it more unmovable. The graphics from mods has problems to be rendered.

We'll.I can think one thing: to make it graphically really cool, the game calculates the shadows itself. Every sprite becomes something like a form, some cubes, very simple. For that a transparent shadow is calculated, which is laid above the stuff. It might not be looking perfect, but it would look amazing. But the afford is really high.

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 9:57 am
ssilk wrote:- the sprites are rendered with light coming from upper left. If you change the direction it would look strange
No, the point is that you render the sprites with completely flat lighting, and let the normal map control all the lighting from then on.
ssilk wrote:- extra shadows need more RAM. It's already a big issue, that the sprites use too much video-ram.
Aye!
ssilk wrote:- it would make it more unmovable. The graphics from mods has problems to be rendered.
Not sure what you mean... all that would change is that each sprite would have it's graphics plus a separate one for the normal map.
ssilk wrote:We'll.I can think one thing: to make it graphically really cool, the game calculates the shadows itself. Every sprite becomes something like a form, some cubes, very simple. For that a transparent shadow is calculated, which is laid above the stuff. It might not be looking perfect, but it would look amazing. But the afford is really high.
I think that's a bit of overkill really The normal-mapped lighting would work even if you didn't have moving shadows - for things like explosions, and other lights on things.

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 9:59 am
Not sure why this thread appeared twice, anyway here's my edits to the other one:

Have a look at this example from a tool called 'Sprite Lamp'.

Also, by 'time of day', I meant changing the lighting direction based on time of day, as obviously the game already has night/day

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 12:14 pm
Actually when I was theorizing a hypothetical game I'd make I had something similar in mind. By something similar I mean nearly identical.

I'm actually surprised this is something new and kickstarter/Steam-worthy, seems to me like a general technique that is somehow never used.

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 2:16 pm
Well, this would be absolutely amazing. I would like to see that depth and the atmosphere in the night.

As always we've been discussing this earlier:
https://forums.factorio.com/forum/vie ... f=6&t=1089

But your aspect is completely new. The main problem is: For the night, most of the shadow-maps need to be stored in the video-RAM. I think this is just a hard technical limit. There are other thoughts: The map is a big hurdle to modders. If they do not add the shadow layer, the thing looks just odd.

An implementation to my point of view could look so, that every object has a sprite, but also a very simple 3D model. This avoids of having the additional bitmaps for the shadows, they are created from the model, the model can stay in normal memory.

But even then it is a big technical hurdle. I don't see much chances for that.

### Re: Normal maps for cool lighting effects

Posted: Wed May 21, 2014 3:32 pm
Tenebrous wrote:
ssilk wrote:- it would make it more unmovable. The graphics from mods has problems to be rendered.
Not sure what you mean... all that would change is that each sprite would have it's graphics plus a separate one for the normal map.
Replace unmoveable with unMODable. iPad is sometimes nasty...