Looks freakin AWESOME! I can then add more ambiend lighting efects to my room or even build party room with color lightings!Looks freakin AWESOME! I can then add more ambiend lighting efects to my room or even build party room with color lightings!
Even if I could, there are some other projects I'd enjoy working on more. I don't know how to make it more efficient, I only have an idea how to make one that supports color. It's probably a bit too resource-heavy to include in Vanilla, but it would make a nice mod. I'll post it behind a spoiler, just in case anyone finds it useful.
The following is an idea of how to add colored blocklight to Minecraft as a mod. There's a chance it won't work, but it looks good on paper.
Storage
We're not going to use RGB colors internally, but xyY. The 'Y' (capital Y) here is luminance, and this corresponds nicely to the system Minecraft already has. We'll have to extend the light map with the remaining x and y, or chromaticity. I'm not sure if the usual 4 bits per ordinate will provide enough resolution to blend lights nicely, but using 8 bits sounds wasteful. Let's play it safe and go with 4 bits. So this costs 1 byte per block. It could be stored in a map file as a new NBT field, but this is optional. It would also be nice if this could be sent over the network, but I'm not sure if this can be done without sending a Vanilla client into a tailspin.
The color of a lamp is not specified in RGB, but in chromaticity as well. (This means you can't make a brown lamp, but you can make a dim red one and get almost the same results. It's actually pretty close to how light works in real life.)
Generating
Light physics work a bit strange in Minecraft; two lamps don't shine brighter than one. And we'd like to keep it that way, so Y stays the way Vanilla works. To calculate (x,y) we'll take some kind of weighed average of all contributing lamps. Cool trick: we can do a simple weighed linear interpolation on the chroma, and end up with a good approximation of what it would look like if we actually had several lights with different intensities shining on the same surface.
"Some kind of weighed average" is a bit vague on purpose. There's some of room for experimentation here to find out what looks nicest and doesn't grind the game to a halt. As per usual, we use the current minichunk (16x16x16) and its Moore neighbours to do all calculations in. The naive approach would be to pathfind back to all lamps we've found in the previous step, and blend them weighed according to their distance. Slow as molasses, doesn't use any extra memory, and accurate.
Another approach would be to keep the current "wavefront" way of spreading light, but to store some additional info in the wavefront about the contributing lights. Fast, small memory footprint, but not accurate. It could leave hard edges where the lamps should have been blended.
Yet another one would be to keep temporary maps for each lamp, generate them the Vanilla way, and then average all chromas using the light level as the weight. (The end result Y would be the maximum of all Y's.) Fast, uses gobs of memory, accurate.
Rendering
Everyone who has ever tried to make a colored light mod fondly remembers 1.7 beta, where you could simply set the vertex colors and be done with it. So one way to make this work is to revert back to this system. Players however prefer the increased FPS and smoother transitions of 1.8.
It would be nice if we could use shaders, but Minecraft runs on a wide variety of hardware because it uses OpenGL's fixed pipeline. So instead we'll do it the old-fashioned way through multitexturing. We need:
1. An 1x16 sunlight texture, mapping intensity to color. This one gets updated all the time for dusk and dawn.
2. A 16x256 texture for translating xyY back to RGB. This one gets updated for torchlight flicker.
Translating xyY to RGB is a good candidate for a lookup table. If we use 4 bits for x and y, and the usual 4 bits for Y, we can conveniently map it to a 16x256 texture. The combiner is then set up as follows:
The only reason this works is because the output of stage 2 gets clamped. This is how sunlight "overpowers" block light. 1.8 did this clamping in code, when the light texture was generated. We do the same, but now in hardware.
Modding & compatibility
This mod could exist as a client mod, a server mod, or both. As a pure client-side mod, it would be for decorative purposes only. As a server-side mod, it could be used to make color-specific light sensors. (A vanilla client wouldn't see the colored light, but the sensors would still work as advertised.)
Galactic_Muffin, i have a question for you. From one suggester, nay, Minecraft dreamer to another, how do you feel about having your idea noticed by Mojang? And what do you think of what they did with colored glass in the april fool's day thing?
My supporters and i are still in the process of getting Mojang to notice us. My hope is that someday we will reach the same level as your suggestion topic. You've pretty much reached the end game here... The only thing left is for them to actually ADD colored glass, which i seriously hope they do!!!! =D
This is an amazing idea! It is very thought out and churches could look so much better! There is going to be so many things added to minecraft at one point we will all know them all and noobs will be over whelmed. Take that terreria!
I support, with no hesitations. Although if this was implemented, I might start yearning for a colored light source block. Never mind, I think I already am.
I support, with no hesitations. Although if this was implemented, I might start yearning for a colored light source block. Never mind, I think I already am.
colored src block with redstone power and inversely powered and then colored torches, and then....
whatever, its still x 100000
I support, with no hesitations. Although if this was implemented, I might start yearning for a colored light source block. Never mind, I think I already am.
It might be a great idea, but would someone do this at any time? I can't java this to script a mod!! Someone thought about to do this as a mod? If yes, then develope this...
Though I encourage people to try and make this into a mod because it would prove much criticism of the topic being impossible to implement, invalid. This suggestion is not meant to be for a mod. It's for Mojang.
This is the best idea ever!
This would be good if it was actually added in minecraft!
Support!
Rollback Post to RevisionRollBack
Leafeon used Magical Leaf!
There is a theory which states that if ever anyone discovers what the Universe is for, it will be replaced by something even more bizarre and inexplicable.
Support
Link Removed and click continue.
My supporters and i are still in the process of getting Mojang to notice us. My hope is that someday we will reach the same level as your suggestion topic. You've pretty much reached the end game here... The only thing left is for them to actually ADD colored glass, which i seriously hope they do!!!! =D
colored src block with redstone power and inversely powered and then colored torches, and then....
whatever, its still x 100000
-_^
Though I encourage people to try and make this into a mod because it would prove much criticism of the topic being impossible to implement, invalid. This suggestion is not meant to be for a mod. It's for Mojang.
~Epic Space Milk Muffin
This would be good if it was actually added in minecraft!
Support!