tModLoader Smooth Lighting

The way the game normally works:

Whenever a tile is drawn, the game does a lookup in the lighting data and writes that color value into the vertices of whatever is being drawn. The shader that draws tiles will multiply that vertex value by the texture color and draw it to the screen.

Sometimes the game wants to draw things while ignoring lighting (emissive), and in those cases it will write the glow color into the vertices and draw a texture in the shape of the part that glows. Dyes and some paints that use custom shaders can also ignore what light color is written in the vertices when drawing the part that glows.

The mod's current approach:
  1. Before drawing starts, generate a texture containing lighting data for the part of the world that overlaps with the screen referred to by RandomComputerUser as a "light texture".
  2. Any code that wrote a light value into vertices, instead write white. Everything is drawn as if it were fully lit.
  3. After all drawing is finished, multiply the light texture by the entire screen to darken the world back from fully lit to the correct brightness.
Why this mod fails:

Once tiles are drawn, there is no distinction between pixels that are glowing and pixels that are lit by the lighting texture, so the mod cannot tell the difference between pixels from a regular tile, and pixels from the glow effect of a spelunker potion.

Suggested future mod version:
My plan is to try to rewrite the mod and implement a shader that multiplies the tile texture color by the light texture color and apply the shader while drawing tiles, but I'm not currently sure how long that will take.
The difference between this fixed mod version and the current version is that lighting will no longer be done in a single step after all drawing is finished. The mod will be able to treat glowing objects differently from lit ones.
 
there is a horrendously annoying bug, great mod, this bug ruined it all, what is it? dangersence, hunter and spelunker potions arrent working...., i always mine using that, now? mining takes around 3 hours longer for a total of 5 because i sometimes mine for 2 hours xd, more loot means more joy for me hahah

please fix
 
@RandomComputerUser

There is 2 major bug I finded while I played with your mod was on:

1. When drinking a Spelunker Potion, it will not show any ores or any nearby objects or treasure.

2. When night ends and the sun comes up, it can be seen that the lightning is a bit wierd or glichy in a way.


If you would pls fix this, that would be rly great! I love your mod, it rly adds much more and a brand new feeling to the game.

Update: Also, your mod makes the the Crystal Shard or any that type of object to not glow at all, or just very low, that will makes it rly hard to find it too, even more so, cuz Spelunker Potion not working either, as I said it once.
The crystal shard thing is kind of an understandable oversight, looking at the tModLoader page. It says "Ore dusts have been supressed because they were revealing ore in complete darkness." For the meantime though, I will just keep the mod disabled until future patches regarding this problem because I don't want to search fr the hardmode ores (+Chlorophyte) in complete darkness.
 
Please consider porting this great mod to 1.4 if it's even possible. Playing without it feels like I'm on some alpha version of the game, that's how bad default lighting looks compared to this mod's look.
 
This mod adds smooth lighting. Most computers should be able to run this mod, as the performance penalty ended being surprising small (my machine requires 0.3 ms / frame for the highest quality, so the smooth lighting alone could run at over 3000 FPS). Just in case the highest quality option lowers the framerate significantly, there are different quality options and an auto quality option.

Download
github.com/RandomComputerUser/SmoothLighting/releases
Or search "Smooth Lighting" in the Mod Browser

TODO
  • Improve visual quality during night​
can you port this to 1.4 if possible?
 
can you port this to 1.4 if possible?
Seems to have gone missing

Classic QoL author move: shows up, does the thing, gone the next. (oh, and he never made his mod open source like he said he would so... effectively LuiAFK all over again)
Honestly... kinda sad, I've talked about this mod to others and said it would make a good feature to PR to TMODLoader.
 
Seems to have gone missing

Classic QoL author move: shows up, does the thing, gone the next. (oh, and he never made his mod open source like he said he would so... effectively LuiAFK all over again)
Honestly... kinda sad, I've talked about this mod to others and said it would make a good feature to PR to TMODLoader.
goddammit :/ my pc is really :red:ty so i gotta play with all settings on low, this type of stuff helps a lot with the aesthetic in the game, hope someone makes something like this in the future
 
goddammit :/ my pc is really :red:ty so i gotta play with all settings on low, this type of stuff helps a lot with the aesthetic in the game, hope someone makes something like this in the future
I'm assuming that, based off how his github activity (which already doesn't have much on it) matches up with his forum activity

He's free to come in here and prove me wrong; honestly, I'd prefer he does, since this mod still has a few bugs that would need to be squashed before a 1.4 port anyways

Edit: I guess to end this off, it was rather funny to see RandomComputerUser being accused of ripping off Starlight River's lightning buffer code lol
I guess unless he shows back up and shows proof of who he is and his past work (and makes his stuff open source), we won't really know.
 
Last edited:
*Sigh* This is the closest possible fix for the color/white lighting lag. If anybody has any tips they'd be greatly appreciated. My game lags and stutters immensely on color/white lighting mode, and I know it isn't my pc. I recently upgraded from a low-end laptop to a beast of a desktop. Color mode was just fine on the laptop, but not on the pc. The lag goes away on retro/trippy mode. The only problem is that I think color mode looks a lot better, I'd rather use that than retro/trippy.
 
Hi there, there is a major bug in your mod, in fact, there is two.
First of all, a spelunker potion, will not show any ores or any nearby objects or treasure.

And when the sun first comes up the lighting is like really weird and glitchy? I don't know how to explain it.
 
Hi there, there is a major bug in your mod, in fact, there is two.
First of all, a spelunker potion, will not show any ores or any nearby objects or treasure.

And when the sun first comes up the lighting is like really weird and glitchy? I don't know how to explain it.
Those bugs have been fixed in my mod for 1.4 tModLoader, Fancy Lighting. I have no plans to continue working on this mod for 1.3 tModLoder.
 
Back
Top Bottom