Thank you very much please post it I want to see
The update is a bit unstable as of right now, I’m working to fix that. As soon as I can I promise I’ll update the plugin! (Sorry for the late response.)
Currently on games with bright ambience it looks almost like there’s a lot of horizontal rays that look very weird.
I spent a little too much time doing this.
This code doesn’t fix the issue with bright ambience, but it works around it in a way.
I realized that I wouldn’t be able to get volumetric lighting in the bright daylight, but I also had areas where it would be dark enough for the lighting to work, and at nighttime it would look great.
So, I decided to change the way the code works to all the filter to disable and reenable based on the setting.
--This code engages the volumetric filter only once the the sun has set far enought that the odd effects go away or the player is inside.
local a=game.ReplicatedStorage.Filter
local clockCheck = game.ReplicatedStorage["Client Clock"] --This receives an hour update every time the time changes ingame.
local clock = 10.00 --The larger number is the hour, and the smaller number is how far through the hour the game is.
local localPlayer = game:GetService("Players").LocalPlayer
--Functions
local function getCharacter() --Checks that the character actually exists, since it doesn't always. Warning! The way I did this sucks and throws errors. Ignore them it works just fine.
local character = localPlayer.Character
if not character or not character.Parent then
character = localPlayer.CharacterAdded:wait()
end
return character
end
a.Size = Vector3.new(50* 2, 50* 2, 50 * 2)
clockCheck.OnClientEvent:Connect(function(time2)
clock = time2
end)
local function checkForInterior(character) -- This is the actual test for interior. Remove this function if not being used.
local status = false
local part = character.HumanoidRootPart
local connection = part.Touched:Connect(function() end) --Apparently Roblox can't detect noCollision objects, but this fixes it. How? I have no clue.
local partTouching = part:GetTouchingParts() --Gets all touching parts
connection:Disconnect() --This is also part of the previous solution
for i, parts2 in pairs(partTouching) do
if parts2.Name == "Interior Zone" then --You must make a part encompassing the area in which you want to have volumetric lighting. By default I have that part named as "Interior Zone"
status = true
end
end
return status
end
game:GetService("RunService").RenderStepped:Connect(function()
if UserSettings().GameSettings.SavedQualityLevel.Value>=script["Graphics Quality"].Value then
if clock > 17.75 or clock < 6.15 then --This engages the volumetric filter only after the sun has set far enough for the odd effects to go away. Remove this check if not being used.
a.Parent=game.Workspace
a.CFrame=game.Workspace.CurrentCamera.CFrame
elseif checkForInterior(getCharacter()) == true then --This runs a check to see if the player is inside and if so, engages the volumetric filter anyways. Remove this check if not being used.
a.Parent=game.Workspace
a.CFrame=game.Workspace.CurrentCamera.CFrame
else
a.Parent=game.ReplicatedStorage
end
else
a.Parent=game.ReplicatedStorage
end
end)
So what this code does is it changes when the filter is active based on time of day and whether the character is currently inside. I figured some people may find this useful so I thought I would post it here. It’s probably not the best code, but it works so…
This script replaces the “Volumetric” script under StarterPlayerScripts. You still need the plugin for this to work. The default script still works best for games in which volumetric lighting should always be on. It is much smaller and less complicated. This script simply allows the use of volumetric lighting indoors and at night on games where the ambient light would otherwise make the use of this plugin impossible. It’s also worth noting that it is fairly obvious to the player when it transitions between volumetric and regular lighting, so it may look odd to the player depending on the implementation.
I put more information in the comments within the code itself. Feel free to use it for whatever purposes.
I don’t know if this is helpful to anyone, but I hope someone finds it useful.
ooo la la, I likey. I likey a latte.
Sorry for the late response! Funny I was just thinking about adding the night check as an option. Would you mind if I added these features into the plugin? It won’t be using all of your code but it will be using your ideas, so it’s always good to ask first. I’m in the process of creating a different filter because the current one isn’t good with performance, so that should be useful & effective for removing the horizontal rays.
Sure, you can absolutely use these ideas/code. I’m also looking forward to a new filter, assuming it still looks pretty nice.
Verison 0.4 is finally out! My apologies for taking such a long time, but I hope the update helps! It adds two new options and a new filter as well as bug fixes.
It Is A Very Good Plugin
something sad about this is something that I call the rainbow effect that makes it generate a kind of rainbow next to the lights it is very difficult to remove this happens because of the version that uses roblox from future
I think it happens because of something to do with the limited color range or something like that.
It’s an issue with stacking multiple transparent objects on top of one another. I made a volumetric lighting demo which is smaller scale but more detailed, and it’s A LOT more visible for me: