Page 1 of 1

Different-Colored Light-Rays

PostPosted: Sun Mar 17, 2013 20:47
by Inocudom
Looking at the lighting given off by various sources in Minetest, I find it sad that the light-rays are all the same color, except for the outdoors ambient lighting at nighttime. I feel that if light-rays were able to be of different colors, the look of Minetest would improve considerably. The coloring could either be done by means of hexadecimal digits, or by using the three number fields that consist of red, green, and blue. Surely, this is not an impossible feat. Surely, this can be done.

PostPosted: Sun Mar 17, 2013 21:01
by PilzAdam
Currently the lighting is calculated by the CPU by storing an u8 for each corner of each node.
Adding extra variables for red, green and blue light would increase the CPU load a lot.

PostPosted: Sun Mar 17, 2013 21:20
by Calinou
PilzAdam wrote:Currently the lighting is calculated by the CPU by storing an u8 for each corner of each node.
Adding extra variables for red, green and blue light would increase the CPU load a lot.


Didn't kwolekr just make lighting updates "21 times faster"? If three colors would have to be computed, then lighting would still be 7 times faster than before the optimisation.

It'd be a great addition and this would be an additional feature over Minecraft (it now supports "HD" texture packs without a patcher, we need a new feature Minecraft doesn't have!).

edit: kwolekr optimized lighting, not PilzAdam.

PostPosted: Sun Mar 17, 2013 21:39
by PilzAdam
Calinou wrote:Didn't you just make lighting updates "21 times faster"?

No, it was hmmmm (aka kwolekr).

PostPosted: Sun Mar 17, 2013 22:37
by Inocudom
If a computer has a graphics card, shouldn't the card be the sole generator of graphics and not the CPU? Lighting is part of the graphics area, so a graphics card should boost that too (mine is a GeForce Gt 610 with 2GB of memory.)

PostPosted: Sun Mar 17, 2013 23:09
by rarkenin
Inocudom wrote:If a computer has a graphics card, shouldn't the card be the sole generator of graphics and not the CPU? Lighting is part of the graphics area, so a graphics card should boost that too (mine is a GeForce Gt 610 with 2GB of memory.)


No, since it is computed, stored, and transferred CPU-side.

PostPosted: Mon Mar 18, 2013 01:23
by prestidigitator
A little more background info: the GPU by itself does not compute shadows due to occlusion of light sources by other surfaces (or, at least, any GLSL you used to try to compute such shadows would be extremely slow or limited in effectiveness). The only intelligence a shader typically has as far as "shadows" are concerned is that it doesn't use a particular light to illuminate any surface pointing AWAY from the light, so the "back" of an object will be illuminated differently from its "front". So typically the CPU figures out exactly what light sources can affect any particular primitives it is going to draw, and the GPU just takes care of the curvature and shape of the primitive.

What we have in Minetest is a pretty complex situation in terms of lighting. Many games have relatively static areas where it is pretty well known what light sources will affect what objects in different regions. The dynamic nature of the maps in Minetest does away with that simplicity, but fortunately its use of regular and constantly shaped voxels still allows lighting the environment to be feasible without making things look terrible or dragging performance into the mud.

PostPosted: Mon Mar 18, 2013 01:30
by Inocudom
I wish to show you a video of how beautiful light-rays with different colors can be. I found this video on Youtube and it depicts a custom Half Life map.
http://www.youtube.com/watch?feature=player_detailpage&v=j-cfrXLLzeo

This could start out as a mod for the sake of testing, learning, and improvement. Such a mod was made for Minecraft, and that game is slower and uses Java. If it can be done in that game, it should be possible in Minetest too. Again, the creation of a test mod is the first step.

PostPosted: Mon Mar 18, 2013 02:09
by prestidigitator
PilzAdam wrote:Currently the lighting is calculated by the CPU by storing an u8 for each corner of each node.
Adding extra variables for red, green and blue light would increase the CPU load a lot.

Could we instead use a single extra u8 for the whole node, and just store an average or total hue and saturation, using 4 bits each? That could provide enough extra detail to dramatically improve quality, with little enough extra requirement for storage or computation to perhaps be a good tradeoff....

PostPosted: Mon Mar 18, 2013 09:09
by jin_xi
JacobF made this topic a long time ago: http://forum.minetest.net/viewtopic.php?id=1262

PostPosted: Mon Mar 18, 2013 14:46
by Inocudom
jin_xi wrote:JacobF made this topic a long time ago: http://forum.minetest.net/viewtopic.php?id=1262


I saw that topic and its video, and it proves with absolute certainty that Minetest can be capable of colored light-rays. The version the test mod was done in hails from the 0.3.1 days. With all of the lighting and engine improvements Minetest has had lately, there is no excuse now. Colored light-rays are no longer in the realm of fantasy and impossibility.

Why did JacobF discontinue the experimental mod and where is he now?

PostPosted: Fri Mar 22, 2013 16:50
by Inocudom
Has anyone attempted this as of late? Colored lighting is not a bad thing, but a good thing.