Please do not report mod-rendering issues to other
Mod Developers. Thank you!
What is this?
Colored light has been well sought after, highly debated, and a seemingly complex addition to Minecraft.
Lot's of people have claimed it's impossible, hard to do, or won't run well.
I hereby provide a counter example:
*My apologies to anyone who hates rainbows
I've been working for quite some time, and there are progress posts littered about the forums.
This post will serve as a center point to refer to. If you want to see my progress, stick around and I'll be sure to keep you up to date on my progress.
What is this trying to accomplish?
I am trying to add three separate channels of colored lighting within blocks, so that they appear to spread around and mix Red, Green, and Blue channels!
Obviously the mod needs to operate at a high level of efficiency, otherwise it won't run well. We're paying close attention to our state of efficiency, and love hearing feedback on your experience here!
All blocks that produce light will still behave the same! Torches will still have a light value of 14, but they may be colored differently. Same with redstone torches. Same lightvalue, but their color may look a little different after you install this mod!
Worlds that use colored light will remain backwards compatible with vanilla Minecraft. (except for the missing Block ID's from the now absent colored lights) We aren't trying to ruin your save, or anything like that. (Please make backups though. If you accidentally lose your save because of a mistake we made, we can't do much to fix it, so make backups just to be sure)
Now, I must immediately say that while this mod relies on base Minecraft edits, We've been writing this in the Forge Environment. Forge has allowed us to test the lighting methods, while also giving us easier access to the Decompiled Minecraft source. The mod will likely stay as a Forge Mod for the rest of it's existence
After having several conversations, this will most likely stand as a separate, stand-alone API, much like the CodeChickenCore. I might be able to get some help with a couple of method hooks in Forge, but they aren't necessary. The API can be used relatively easily.
How does this work?
We added three 4-bit color components for each block (bit crammed in a block's the lightvalue field) These three channels represent a blocks Red, Green, and Blue light.
With this simple change came a great number of problems with things that weren't expecting extra bits of information in the lightvalue, so we went through, and edited all of the methods that weren't happy. This coremod is a collection of edits to two primary systems:
The Vanilla Lighting Engine - To now support color, and the spreading of color
The Rendering Engine - To render the color on top of your favorite blocks!
Why choose RGB over Y'CbCr?
RGB tinting is already implemented. I simply used what Minecraft was expecting. While it uses more RAM and packet chatter, it was the easiest way to start thinking about the whole project. I am not opposed to moving to a more compact data system that uses the already existing vanilla brightness, but It's not a high priority on the list at the moment.
edit: When it's all said and done, OpenGL speaks RGB. I think I'm going to keep it, over Y'CbCr, simply because it works already ^.^
If you happen to know how to rewrite computeLightByType and updateLightByType using Y'CbCr while keeping all of the functionality, go right ahead! I'm very open to this idea, and a pull request accomplishing this task would be a welcome addition. All credit will be given where it's due.
What about performance?
Well, we know that performance is of top concern, however you can't go about a project like this without impeding some performance somewhere. Currently, the two large areas that were modified have become slightly more complex.
The Lighting Engine takes a bit longer to spread light values around - I've written a brand new one from scratch to stay as efficient as possible!
The Rendering Engine now implements a custom Vertex and Fragment Shader to place color over other vertexes. This was an easy way for us to write it "one time" and have it apply to a lot of places all at once. This is a cause for some mod conflicts, as the shader core and other "shader themed" mods may conflict directly, and there are also rendering mishaps when you load this mod with other custom blocks, such as the chisel mod.
That's right... OpenGL 2.1 is used heavily. This means that while we share the same OpenGL requirement that Minecraft has... we may stop on a graphics adaptor here or there (looking at YOU intel) because we simply use a couple more things in the OpenGL 2.1 toolkit that Minecraft doesn't use itself.
Overall, if you have some sort of GPU, then the core won't be a huge hit to performance, but if it is, try running fast lighting and see if it improves. Feel free to post in the forums about your change in performance. I'm interested in what you have to say!
If you have a lot of trouble, I'm trying to make sure that I stay compatible with Optifine and Fastcraft, (and I honestly recommend that you run those mods anyway). You'll be able to reclaim some of the frams you lose here, while maintaining the rainbow!
So why isn't it out of Beta yet?
There is a ton of work to do. I have several bugs that I have to hunt still, and a lot more functionality I'd like to add! Again, it's still a work in progress. Feel free to hang around, and discuss what you see. What you like and what you don't like, and I'll be sure to hang around myself and answer what I can!
Current TODO list:
There are still a couple Lighting Engine bugs lying around - I know of a few, and if you can repeat a couple steps that break how lights show up in your world, I want to hear about it!
A significant amount of mod and rendering conflicts - A couple of which break the GLstate... so I need to clean up my end before a formal release.
Rave Lights - nuff said
Special Thanks:
TheMogMiner implemented his own Colored Lights before, then was hired by Mojang! Having gotten lost in some implementation, he stepped in and was incredibly helpful! Thank you for helping out the project when I was stuck!
Heaton84... for pretty much anything that just happened with the 1.7.2 update! Thank you for your time and effort put into getting this project along with the new systems!
Murray, for basically everything in 1.7.10 on the rendering side of things. He showed up with a couple of pull requests, and then made a whole bundle of nice additions with his work in the Shader! Give him a huge thanks for his work on the new system.
Nocte's shown some interest and has supplied incredibly helpful knowledge about Minecraft's internal workings.
Kovu's been around and has helped out with a bit of testing, and his knowledge of Git was quite nice to have on hand. A major contributor for the ASM packaging. Thank him for the easy installation of the core mod!
StraightDigger and I've been pming each other quite a bit, and we discuss where the mod's going, and how it might behave. Expect to see excerpts from our conversations show up as answers to any questions you might have!
Xeronut has been on the up and up testing out everything, and maintaining this incredibly impressive list of compatible mods. Thank you so much for your time and effort! A list like that is incredibly helpful!
A quick shout out to Galatic Muffin and the Colored Glass/Light Forum thread. If you haven't seen that, make sure to check it out!
Avarisc and Glitchfinder have been working together on the smooth lighting side of things. While their work has come and gone, they did a ton of amazing work, and deserve a lot of credit for it here!
ShaderCore is not happy at all.... and I don't know where to begin. Hopefully, someone can help me out here.
Atomicstryker's DynamicLights are almost compatible, but they cause update bugs (which I need to fix) and the lights aren't colorful due to his implementation. Hopefully I can do something about this.
On that note: The lighting engine will cause a hiccup or two once in a while... If you see something weird, just break a block, or place a light to cause another light update. If you found something that's repeatable, and you don't like it, report it as a bug!
Colored Glowstone spawns in the nether now!
Rave lights don't randomly change colors... nor do they light up at all... I intend to do something fancy here... but I need to sit down and learn a bit more about OpenGL before I can do anything like that
"Black Lights" were fixed recently! Let me know if you find anymore!
*Reporting bugs old versions will most likely incur a brief response saying that this is fixed. No I will not port features down to old versions. Please enjoy the mod for what it's worth, but refrain from posting bugs from incomplete work.
Thank you
Where's the Source?
If you want to see the code, or are interested in working or offering advice, go ahead and PM me. We have the code set up as a Git Repository, and it can be applied to an FML/MCP workspace. https://github.com/C...tsModdingLight/
We've got some awesome Signatures courtesy of StraightDigger. Make sure to give him a +1 for the awesomeness!
Red:
Green:
Blue:
Cyan:
Yellow:
Magenta:
Head to My Settings->Signature, then click "Toggle Editing Mode"
Paste the code you want in there, and enjoy!
Texture Packs:
We've got some awesome texture packs for those who want something a little different!
Here's one that has high resolution 128x128 stone-looking textures for all of the blocks
Post here in the forums if you have a crash report, and I can read through it when I can. Feel free to ask any sort of question, and we also registered an IRC channel on espernet! So feel free to hop in #ColoredLightCore if you get a chance, or need some more help.
If you wish to report a bug with the mod, please be sure to include...
The version of the ColoredLightCore (CLC) you are using
The version of Forge you are using
The crash report (preferrably via Pastebin) generated by the error
Depending on the error, an image of the problem
Also, DO NOT INCLUDE 100 MODS IN YOUR CRASH REPORT! If you have a mod conflict, please find the offending mods before submitting a bug report. I'd like to hear about the crash, and we can look at the issues on a close basis... But I'm tired of reading through mile long logs filled with clutter.
PSA:
I don't think I'm going to work on this mod very much anymore.
I will continue maintaining the git-repo, and I'll make sure the build server stays up... If anyone submits a PR, or wants to develop/make changes to the mod in a significant way, the door is wide open. I'll review code to the best of my ability, and make sure things stay the same, but I simply don't have any motivation to spend hours of my life learning Java + ASM.
Since many of you may not know what that is... I'll try to give you guys a 2 second low-down:
Minecraft by itself doesn't have colored lights... or any ability to color lights in its unmodded state. So my job is to stop Minecraft from loading, grab the classes that handle light calculations, light data, world saves, etc, and modify them. This modification is usually hacky to some extent, and requires a deep understanding of how Minecraft's rendering pipeline works, as well as interactions between modified classes, and the Java Virtual Machine (JVM). There are some libraries that can help modders make changes like I was doing: (ASM) And I was able to use Forge to create a Core-Mod that would alter Minecraft as it was loaded into RAM.
If everything works, you get to see colors, and your worlds are STILL backwards compatible.
The issues that I kept on running into are twofold.
1.) I don't know ASM that well... and how I need to use it to satisfy the JVM... It's a LOT of guess + check. Doing simple things like adding variables could take me hours if I didn't know what was going wrong. Here are the 17 lines of code that set the default sunlight color variable in the world class. It's not simple stuff... and writing that kind of code isn't fun for me either. I'm sure there are better ways of doing it... and I simply don't want to find out anymore.
2.) I don't know NEARLY enough about OpenGL. At first, I wasn't using much of OpenGL to add color to the world, but it became increasingly clear that I'd need delve into OpenGL and shaders to get everything to work. I don't have a clear understanding still... Murray and a couple others were able to start the implementation, and we got most of it working. So while I can see what's going on in the current setup, I don't know how to rewrite a "better shader" or fix the issues that currently exist in the pipeline. (This is what causes so many issues with Optifine and the ShaderCore)
So... what does that mean?
I'll make sure things compile. And I'll make sure to help anyone who wants to show up, and start turning wrenches and writing code. But... my interests have moved on. When Minecraft moves to C++ (the Windows 10 release thing), I might look at it again, but I don't need more Java right now... especially ASM + Java... It's not a very useful skill for what I do (embedded systems developer/engineer) and I'm sad I have to break it to you all. It hasn't been all bad, and I've had moments that were a TON of fun!
I hope we can still be friends,
-CptSpaceToaster-
Licensing
The Colored Light Core shall hence forth be classified under the WTFPL.
Oh my gootness, I love you so much! Been waiting for someone to put in the time and extreme effort in this for a long, long time. Just curious, are able to combine the lights in-game? Like if you were to put the red block by the blue block, purple light would shine out in the middle? Or is that something that's super far away in terms of development?
Oh my gootness, I love you so much! Been waiting for someone to put in the time and extreme effort in this for a long, long time. Just curious, are able to combine the lights in-game? Like if you were to put the red block by the blue block, purple light would shine out in the middle? Or is that something that's super far away in terms of development?
I was working on this very functionality when all of a sudden, minecraft updated to 1.6.4... resulting in me being set back a bit.
So, to answer: "Not Yet"
Aye! Alright once this is released, can I do a mod spotlight? If possible.
If so, alrigt! (Reserving comment. :3)
Spotlights are always great! If you could, I'd love to get with you before the spotlight actually gets made so we can discuss what it does and what might be included in the video...
We've got a while before we get there, but here's to thinking optimistically!
I would definately put out a mod spotlight of this at the second it comes out. If you want to talk to me about it before making it, please contact me through th PM's and maybe give a possible release date?
I would definately put out a mod spotlight of this at the second it comes out. If you want to talk to me about it before making it, please contact me through th PM's and maybe give a possible release date?
You are number three... ^.^
I'm glad you guys like it, however I can only have so many spotlights... and I'm busy enough making my own colored ones... *pun intended
Oh my gootness, I love you so much! Been waiting for someone to put in the time and extreme effort in this for a long, long time. Just curious, are able to combine the lights in-game? Like if you were to put the red block by the blue block, purple light would shine out in the middle? Or is that something that's super far away in terms of development?
I was working on this very functionality when all of a sudden, minecraft updated to 1.6.4... resulting in me being set back a bit.
So, to answer: "Not Yet"
I got a really bad new for you : mojang is rewritting the lighting engine for 1.7,that would break your mod,I hope the new lighting engine isn't too different
And what exactly are they changing? Really curious.
I got a really bad new for you : mojang is rewritting the lighting engine for 1.7,that would break your mod,I hope the new lighting engine isn't too different
It can always be changed back... But I think they were planning on changing how skylight factors into everything... Which won't break everything too badley...
I'll have to get together with someone form Mojang soon!
I noticed that Minecraft stores all blocks light values into an array of integers.
Is that specifically at runtime? Because when chunks are written to disk, they seem to be only stored as 4 bits per block. Does your mod store new byte arrays for the RGB components, or does it convert all light data into a single int array?
Is that specifically at runtime? Because when chunks are written to disk, they seem to be only stored as 4 bits per block. Does your mod store new byte arrays for the RGB components, or does it convert all light data into a single int array?
All in all, nice work!
I haven't messed with storage yet. Which is actually kind of handy. When I have a bad lighting algorithm go nuts on me, I need a way to clear out all of the colored lights.
By not modding the saving algorithms, I can exit the world, and reload it, and make the janked up colors disappear.
I'll have to work on that in the future, however I liked leaving it out for a simplified way of "clearing out" colored lights if something spread out wrong.
My priorities have been to focus on getting lights to "blend together", then there are a whole host of things to expand to.
Colored Light For Minecraft!
Mod Developers. Thank you!
What is this?
Colored light has been well sought after, highly debated, and a seemingly complex addition to Minecraft.
Lot's of people have claimed it's impossible, hard to do, or won't run well.
I hereby provide a counter example:
I've been working for quite some time, and there are progress posts littered about the forums.
This post will serve as a center point to refer to. If you want to see my progress, stick around and I'll be sure to keep you up to date on my progress.
What is this trying to accomplish?
I am trying to add three separate channels of colored lighting within blocks, so that they appear to spread around and mix Red, Green, and Blue channels!
Now, I must immediately say that while this mod relies on base Minecraft edits, We've been writing this in the Forge Environment. Forge has allowed us to test the lighting methods, while also giving us easier access to the Decompiled Minecraft source. The mod will likely stay as a Forge Mod for the rest of it's existence
After having several conversations, this will most likely stand as a separate, stand-alone API, much like the CodeChickenCore. I might be able to get some help with a couple of method hooks in Forge, but they aren't necessary. The API can be used relatively easily.
How does this work?
With this simple change came a great number of problems with things that weren't expecting extra bits of information in the lightvalue, so we went through, and edited all of the methods that weren't happy. This coremod is a collection of edits to two primary systems:
The Vanilla Lighting Engine - To now support color, and the spreading of color
The Rendering Engine - To render the color on top of your favorite blocks!
Why choose RGB over Y'CbCr?
RGB tinting is already implemented. I simply used what Minecraft was expecting. While it uses more RAM and packet chatter, it was the easiest way to start thinking about the whole project. I am not opposed to moving to a more compact data system that uses the already existing vanilla brightness, but It's not a high priority on the list at the moment.
edit: When it's all said and done, OpenGL speaks RGB. I think I'm going to keep it, over Y'CbCr, simply because it works already ^.^
If you happen to know how to rewrite computeLightByType and updateLightByType using Y'CbCr while keeping all of the functionality, go right ahead! I'm very open to this idea, and a pull request accomplishing this task would be a welcome addition. All credit will be given where it's due.
What about performance?
Well, we know that performance is of top concern, however you can't go about a project like this without impeding some performance somewhere. Currently, the two large areas that were modified have become slightly more complex.The Lighting Engine takes a bit longer to spread light values around - I've written a brand new one from scratch to stay as efficient as possible!
The Rendering Engine now implements a custom Vertex and Fragment Shader to place color over other vertexes. This was an easy way for us to write it "one time" and have it apply to a lot of places all at once. This is a cause for some mod conflicts, as the shader core and other "shader themed" mods may conflict directly, and there are also rendering mishaps when you load this mod with other custom blocks, such as the chisel mod.
That's right... OpenGL 2.1 is used heavily. This means that while we share the same OpenGL requirement that Minecraft has... we may stop on a graphics adaptor here or there (looking at YOU intel) because we simply use a couple more things in the OpenGL 2.1 toolkit that Minecraft doesn't use itself.
Overall, if you have some sort of GPU, then the core won't be a huge hit to performance, but if it is, try running fast lighting and see if it improves. Feel free to post in the forums about your change in performance. I'm interested in what you have to say!
If you have a lot of trouble, I'm trying to make sure that I stay compatible with Optifine and Fastcraft, (and I honestly recommend that you run those mods anyway). You'll be able to reclaim some of the frams you lose here, while maintaining the rainbow!
So why isn't it out of Beta yet?
There is a ton of work to do. I have several bugs that I have to hunt still, and a lot more functionality I'd like to add! Again, it's still a work in progress. Feel free to hang around, and discuss what you see. What you like and what you don't like, and I'll be sure to hang around myself and answer what I can!
Current TODO list:
Special Thanks:
Latest ColoredLightsCore for Minecraft Forge 1.7.10 - Does not run with Forge 1339 or later.
Moved to Curse! - https://minecraft.curseforge.com/projects/colored-light-core
Warning: Make Backups before you go running this please.
List of Mod Compatibility:
https://docs.google.com/spreadsheets/d/1mfAradGBs1U2LOVHIW6_2FNKnc4pKB00qr9VAYtrKZc/pubhtml
Recent Notes:
Expect bugs, and poor performance. And have fun!
Old Versions:
1.2.2 - http://www.mediafire.com/download/x78xmp5912tg8er/ColoredLightsCore-1.2.2.jar
1.2.1 - http://www.mediafire.com/download/r3k45h8a845yt13/ColoredLightsCore-1.2.1.jar
1.7.10.01 - http://www.mediafire.com/download/j5thct8w1h2ctsm/ColoredLightsCore-1.7.10.01.jar
1.7.2.2 - http://www.mediafire.com/download/wgp9hcygwd13vpq/ColoredLightsCore[1.7.2.2].jar
1.7.2.1 - http://tinyurl.com/n6wq9vj
1.6.4.4 - http://tinyurl.com/k5eekds
*Reporting bugs old versions will most likely incur a brief response saying that this is fixed. No I will not port features down to old versions. Please enjoy the mod for what it's worth, but refrain from posting bugs from incomplete work.
Thank you
Where's the Source?
If you want to see the code, or are interested in working or offering advice, go ahead and PM me. We have the code set up as a Git Repository, and it can be applied to an FML/MCP workspace.
https://github.com/C...tsModdingLight/
Media
Forum Signatures:
Red:
Green:
Blue:
Cyan:
Yellow:
Magenta:
Head to My Settings->Signature, then click "Toggle Editing Mode"
Paste the code you want in there, and enjoy!
Texture Packs:
Here's one that has high resolution 128x128 stone-looking textures for all of the blocks
https://www.dropbox.com/s/p5lyvo5mqc5k2z5/Easycolouredlights.zip
Credit: Schlingman
And this one does a great job by adding 15 high resolution Lamp Textures that look a bit like SPHAX would!
http://www.mediafire.com/download/13eebdstnq1zd74/Sphax_ColoredLightsCore-1.7.10.01.rar
Credit: Ruyan
Found a bug? Want to Chat?
Post here in the forums if you have a crash report, and I can read through it when I can. Feel free to ask any sort of question, and we also registered an IRC channel on espernet! So feel free to hop in #ColoredLightCore if you get a chance, or need some more help.
If you wish to report a bug with the mod, please be sure to include...
Also, DO NOT INCLUDE 100 MODS IN YOUR CRASH REPORT! If you have a mod conflict, please find the offending mods before submitting a bug report. I'd like to hear about the crash, and we can look at the issues on a close basis... But I'm tired of reading through mile long logs filled with clutter.
PSA:
I don't think I'm going to work on this mod very much anymore.
I will continue maintaining the git-repo, and I'll make sure the build server stays up... If anyone submits a PR, or wants to develop/make changes to the mod in a significant way, the door is wide open. I'll review code to the best of my ability, and make sure things stay the same, but I simply don't have any motivation to spend hours of my life learning Java + ASM.
Since many of you may not know what that is... I'll try to give you guys a 2 second low-down:
Minecraft by itself doesn't have colored lights... or any ability to color lights in its unmodded state. So my job is to stop Minecraft from loading, grab the classes that handle light calculations, light data, world saves, etc, and modify them. This modification is usually hacky to some extent, and requires a deep understanding of how Minecraft's rendering pipeline works, as well as interactions between modified classes, and the Java Virtual Machine (JVM). There are some libraries that can help modders make changes like I was doing: (ASM) And I was able to use Forge to create a Core-Mod that would alter Minecraft as it was loaded into RAM.
If everything works, you get to see colors, and your worlds are STILL backwards compatible.
The issues that I kept on running into are twofold.
1.) I don't know ASM that well... and how I need to use it to satisfy the JVM... It's a LOT of guess + check. Doing simple things like adding variables could take me hours if I didn't know what was going wrong. Here are the 17 lines of code that set the default sunlight color variable in the world class. It's not simple stuff... and writing that kind of code isn't fun for me either. I'm sure there are better ways of doing it... and I simply don't want to find out anymore.
2.) I don't know NEARLY enough about OpenGL. At first, I wasn't using much of OpenGL to add color to the world, but it became increasingly clear that I'd need delve into OpenGL and shaders to get everything to work. I don't have a clear understanding still... Murray and a couple others were able to start the implementation, and we got most of it working. So while I can see what's going on in the current setup, I don't know how to rewrite a "better shader" or fix the issues that currently exist in the pipeline. (This is what causes so many issues with Optifine and the ShaderCore)
So... what does that mean?
I'll make sure things compile. And I'll make sure to help anyone who wants to show up, and start turning wrenches and writing code. But... my interests have moved on. When Minecraft moves to C++ (the Windows 10 release thing), I might look at it again, but I don't need more Java right now... especially ASM + Java... It's not a very useful skill for what I do (embedded systems developer/engineer) and I'm sad I have to break it to you all. It hasn't been all bad, and I've had moments that were a TON of fun!
I hope we can still be friends,
-CptSpaceToaster-
Licensing
The Colored Light Core shall hence forth be classified under the WTFPL.
I'm also known as TANNAR in some places.
If so, alrigt! (Reserving comment. :3)
I was working on this very functionality when all of a sudden, minecraft updated to 1.6.4... resulting in me being set back a bit.
So, to answer: "Not Yet"
Spotlights are always great! If you could, I'd love to get with you before the spotlight actually gets made so we can discuss what it does and what might be included in the video...
We've got a while before we get there, but here's to thinking optimistically!
You are number three... ^.^
I'm glad you guys like it, however I can only have so many spotlights... and I'm busy enough making my own colored ones...
*pun intended
We'll see.
*Streched Pun Intended
I always look forward to your pm's!
That is major bugbear right now. It is possible in theory, but not now.
And what exactly are they changing? Really curious.
It can always be changed back... But I think they were planning on changing how skylight factors into everything... Which won't break everything too badley...
I'll have to get together with someone form Mojang soon!
Is that specifically at runtime? Because when chunks are written to disk, they seem to be only stored as 4 bits per block. Does your mod store new byte arrays for the RGB components, or does it convert all light data into a single int array?
All in all, nice work!
I haven't messed with storage yet. Which is actually kind of handy. When I have a bad lighting algorithm go nuts on me, I need a way to clear out all of the colored lights.
By not modding the saving algorithms, I can exit the world, and reload it, and make the janked up colors disappear.
I'll have to work on that in the future, however I liked leaving it out for a simplified way of "clearing out" colored lights if something spread out wrong.
My priorities have been to focus on getting lights to "blend together", then there are a whole host of things to expand to.