I’m working on a fog of war system and I’m not liking the visuals–I hate seeing the independent spheres despite adjacent light nodes, I would like it if it molded together
I also encounter an odd reflectance (or what appears to be so?) on certain parts. I’m not sure if its a separate issue or if its derivative of the 1st
some configs I’m setting, I’ve experimented changing brightness, ranges but it has not addressed the issue. I’m not well versed with lighting so would love some suggestions
local lightPart = Instance.new("Part")
lightPart.Name = roundedName
lightPart.Size = Vector3.new(1,1,1)
lightPart.Anchored = true
lightPart.CanCollide = false
lightPart.Transparency = 1
lightPart.Position = position
lightPart.CastShadow = false
lightPart.Parent = gridFolder
local pointLight = Instance.new("PointLight")
pointLight.Brightness = 0
pointLight.Range = 15
pointLight.Enabled = false
pointLight.Shadows = false
pointLight.Color = Color3.fromRGB(234, 220, 202)
pointLight.Parent = lightPart
1 Like
Oh my god I just misread your entire post i didn’t know you wanted to fix the grid i thought u were trying to fix the lighting and fog of war thing 
I spent a good chunk of time making this //<3, hope you could use it although it most likely isn’t what your looking for.
[StarterPlayerScripts]
--// Serving 💅
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")
--// Player
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
--//\ Vision settings /\\
local Vision_R = 50
local WaitTime = 0.1
local Fade = 0.4
local LightColor = Color3.fromRGB(255, 255, 255)
--// Detection sphere to hide things outside the light's radius
local detectionPart = Instance.new("Part")
detectionPart.Anchored = true
detectionPart.CanCollide = false
detectionPart.Transparency = 1
detectionPart.Size = Vector3.new(Vision_R * 2, Vision_R * 2, Vision_R * 2)
detectionPart.Shape = Enum.PartType.Ball
detectionPart.Name = "VisionSphere"
detectionPart.Parent = Workspace
--// Light source
local light = Instance.new("PointLight")
light.Brightness = 1
light.Range = Vision_R
light.Shadows = false
light.Color = LightColor
light.Parent = detectionPart
--// Track state
local modelStates = {}
--// Fade util.
local function fadeTransparency(obj, propName, target)
local tween = TweenService:Create(obj, TweenInfo.new(Fade, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
[propName] = target
})
tween:Play()
end
--// Hide NameDisplays & accessories, but fade parts/decals only bc I don't want a nextbot chasing me
local function setModelFade(model, visible)
local state = modelStates[model]
if not state then
state = {
current = not visible,
parts = {},
decals = {},
nametags = {},
humanoid = model:FindFirstChildOfClass("Humanoid")
}
modelStates[model] = state
for _, obj in ipairs(model:GetDescendants()) do
if obj:IsA("BasePart") and not obj:IsA("Accessory") then
obj.LocalTransparencyModifier = visible and 1 or 0
obj.CanCollide = visible
table.insert(state.parts, obj)
elseif obj:IsA("Decal") then
obj.Transparency = visible and 1 or 0
table.insert(state.decals, obj)
elseif obj:IsA("BillboardGui") or obj.Name:lower():find("name") then
obj.Enabled = visible
table.insert(state.nametags, obj)
end
end
if state.humanoid then
state.humanoid.DisplayDistanceType = visible and Enum.HumanoidDisplayDistanceType.Viewer or Enum.HumanoidDisplayDistanceType.None
end
end
if state.current ~= visible then
for _, part in ipairs(state.parts) do
fadeTransparency(part, "LocalTransparencyModifier", visible and 0 or 1)
part.CanCollide = visible
end
for _, decal in ipairs(state.decals) do
fadeTransparency(decal, "Transparency", visible and 0 or 1)
end
for _, gui in ipairs(state.nametags) do
gui.Enabled = visible
end
if state.humanoid then
state.humanoid.DisplayDistanceType = visible and Enum.HumanoidDisplayDistanceType.Viewer or Enum.HumanoidDisplayDistanceType.None
end
state.current = visible
end
end
--// Visibility loop
local function updateVisibility()
detectionPart.Position = hrp.Position
for _, model in ipairs(Workspace:GetDescendants()) do
if model:IsA("Model") and model ~= character and model:FindFirstChildOfClass("Humanoid") then
local root = model:FindFirstChild("HumanoidRootPart")
if root then
local dist = (hrp.Position - root.Position).Magnitude
local inRange = dist <= Vision_R
setModelFade(model, inRange)
end
end
end
end
--// Initial pass
updateVisibility()
--// Loopin
task.spawn(function()
while true do
updateVisibility()
task.wait(WaitTime)
end
end)
Edit: Wanted to clean it up a bit b4 posting
1 Like
sorry i already have a functional system!
just a second ago i found the solution to problem; lighting technology
future places a huge empasis on individual lights (thus giving each pointlight its own independent sphere), swapping to shadowmap or voxel gives the desired effect
1 Like
Alright, looks pretty nice! Forgot that there’s different lighting settings and didn’t consider if you had it on voxel/shadowmap or future
You could maybe try a surface light in future mode as well
1 Like
ill definitely give it a try–i would definitely like to use future if that can be done