• Journey's End on PC - Find info here and here. Please report bugs and issues for PC 1.4 and 1.4.1 to Re-Logic here.
  • Journey's End on Mobile - Find info here. Report bugs for Mobile 1.4 to DR Studios at this link and give as much detail as possible.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Console and Switch - The latest news can be found here. To report a bug, please use this link.

tModLoader Smooth Lighting

icon.png

Smooth Lighting Mod
SmoothLightingMod.png
SmoothLightingGemspark.png
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​
 
Last edited:

Warpshard

Empress of Light
Beautiful. Do you have any example pictures of how it looks with light sources and not just the sun?
 
Beautiful. Do you have any example pictures of how it looks with light sources and not just the sun?
SmoothLightingUnderground.png
SmoothLightingNight.png

To be honest, I chose a picture in sunlight because that's where the mod looks the best. During nighttime, lights outside look a bit strange because they light up the sky and the moon is darkened by the lack of light. Changing this would require rewriting most of the mod.
 

JittersTheQtPi

Terrarian
This makes everything look so good. Great mod and one of my new favorites. Only problem I have is that it makes the water opaque and difficult to see underwater enemies.
 
BUG.png
It seems this mod has the unfortunate side effect of making all my characters albino with a touch of anemia and glaucoma, or as the saying goes, whiter than a glass of milk riding a paper plane in a snowstorm. Everything but hair seems to be affected. I have no alternative texture packs/shaders that would conflict with the mod.
 
This is something that SLR's Scalie has been trying to do for some time now, and then suddenly random computer user just does.
The only flaw I've noticed so far is more of a problem with Terraria than anything: that is some (very minor) frame stuttering above 60 fps on a high refresh rate monitor, but trust me, *this* is the least disturbing thing that tends to happen to terraria at that rate.

Eitherway, framelock can be turned off to disable it of course.
 

Sumenora

Plantera
This mod seems to cause problems with the spelunker potions effects...it does not work with smooth lighting.
 

steviegt6

Official Terrarian
This is something that SLR's Scalie has been trying to do for some time now, and then suddenly random computer user just does.
The only flaw I've noticed so far is more of a problem with Terraria than anything: that is some (very minor) frame stuttering above 60 fps on a high refresh rate monitor, but trust me, *this* is the least disturbing thing that tends to happen to terraria at that rate.

Eitherway, framelock can be turned off to disable it of course.
lolwut
Did you just compare this to SLR's lighting rework? :kek:
 

Mail

Official Terrarian
Does this mod work correctly with emissive textures? (Any textures that glow without producing light.) Glowing moss, Duke Fishron's eyes, many player armors and weapons, strange dyes, Martian furniture, etc.

I was looking into making this mod, but did not because I wasn't sure that I would be able to do it properly without modifying shaders. This mod's approach of applying lighting after drawing everything usually makes emissive textures darker when lighting is applied. If any shaders draw emissive and non-emissive parts of a texture in a single draw call, it will be impossible to fix this mod without changing those shaders.

The only solution I can think of to make this mod bug free is to use the lighting texture to apply lighting to every sprite as it is drawn. This should require changing every shader that will receive light from the lighting texture.

Search for glowmask in the game's source code to get an idea of which items will cause problems.
 
Does this mod work correctly with emissive textures? (Any textures that glow without producing light.) Glowing moss, Duke Fishron's eyes, many player armors and weapons, strange dyes, Martian furniture, etc.

I was looking into making this mod, but did not because I wasn't sure that I would be able to do it properly without modifying shaders. This mod's approach of applying lighting after drawing everything usually makes emissive textures darker when lighting is applied. If any shaders draw emissive and non-emissive parts of a texture in a single draw call, it will be impossible to fix this mod without changing those shaders.

The only solution I can think of to make this mod bug free is to use the lighting texture to apply lighting to every sprite as it is drawn. This should require changing every shader that will receive light from the lighting texture.

Search for glowmask in the game's source code to get an idea of which items will cause problems.
No, this mod does not work with emissive textures. 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.
 

steviegt6

Official Terrarian
No, this mod does not work with emissive textures. 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.
I don't believe this is preferable.
GlowMasks are made to simulate glowing without producing light. If the modder intended for the sprite to be accompanied by light, they would have made it produce light as well.
 

Mail

Official Terrarian
I don't believe this is preferable.
GlowMasks are made to simulate glowing without producing light. If the modder intended for the sprite to be accompanied by light, they would have made it produce light as well.
The light texture will be ignored while drawing emissive textures and everything will look perfect.
No, this mod does not work with emissive textures. 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.
Definitely a good idea, but I am not sure how to deal with painted blocks and their shaders. I could be overthinking things, but it seems a large number of shaders will need to be decompiled and modified to do it properly and without a significant performance loss. I was looking into doing this for 1.4 which has additional shaders for animated trees and vines, so it might be easier for the current tModloader version.

Another hack solution I was considering was to keep using vertex lighting, but write different color values on each vertex and allow it to be interpolated along the tile. Spritebatch does not support this feature and always writes the same color to all four vertices of each sprite even though opengl/directx allow setting a different color for each vertex. Tiles would need to always split into 2x2 to provide enough vertices for smooth lighting. Pixel shaders could be left unmodified.
 
Another hack solution I was considering was to keep using vertex lighting, but write different color values on each vertex and allow it to be interpolated along the tile. Spritebatch does not support this feature and always writes the same color to all four vertices of each sprite even though opengl/directx allow setting a different color for each vertex. Tiles would need to always split into 2x2 to provide enough vertices for smooth lighting. Pixel shaders could be left unmodified.
I can honestly see this one being done, that's not a bad idea infact... On paper
but given stuff like player's skin turning albino there's going to be some issues regardless, let alone if it's going to be more resource demanding (I mean it shouldn't, this kind of thing wouldn't even need a custom shader, just a basic effect), if it wasn't for your point about how relogic already uses shaders.
painted tiles are indeed a shader being applied to the tiles (again, you could just multily the PS by the VS's colors), so I guess we'll see.


Also @RandomComputerUser is there any real reason your mods are closed source? Why do you even have a linked github page if your code is private?
 
Also @RandomComputerUser is there any real reason your mods are closed source? Why do you even have a linked github page if your code is private?
There isn't any real reason, until now it's just been because I'm lazy and there wasn't much incentive. The next release should be open source. Linking to GitHub allows previous releases of mods to be easily distributed and must be done in order for an icon to appear in the mod browser.
 

Katona

Official Terrarian
@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.
 

Attachments

  • MBugOne.png
    MBugOne.png
    920.7 KB · Views: 48
  • MBugTwo.png
    MBugTwo.png
    529.5 KB · Views: 48
Last edited:
Top Bottom