Fake Reflections/Global Illumination

so basically putting point lights in every part? that’s very simple

2 Likes

this is not a property of point light or at least it says on the Hub

1 Like

The way I made it a bit better is that is changes the brightness of the light depending on the part size. It gets the average of all the part sizes, then divides it by a high number and sets the light brightness to that. I keep range at one number.

2 Likes

what i meant by y size is, u could calculate the range of light by dividing the parts y size

2 Likes

where are these models from?

every part in the workspace?

1 Like

how did you make the spheres not look wierd?

1 Like

Glass houses map from roblox, its a classic

For each part it gets the x, y, z and then averages it

2 Likes

here’s the code

-- once u paste this in a script make an attribute on the script and name it "outlines"
for i, v in pairs(workspace:GetDescendants()) do
	if v:IsA("Part") then
		local light = Instance.new("PointLight")
		light.Parent = v
		light.Shadows = true
		light.Brightness = math.ceil((v.Size.X + v.Size.Y + v.Size.Z)*1.5)+1--math.round(((v.Size.X * v.Size.Y * v.Size.Z) * 1/3)) 
		light.Range = 3
		light.Color = v.Color
		if (light.Brightness * 3) >= 100 then
			light:Destroy()
		end
	end
end

you can customize what size parts get your point light

I tried it I think it came out pretty good it wasn’t very easy to get here also the thirds photo stairs are weird and idk on how to fix that also the last photo is with out the script.

10 Likes

I personally love it. Wonderful job! :smiley:

2 Likes

what is that???

Future is Bright - new realistic lighting engine basically. More info here

2 Likes

how did you make yours so clean?

I really only showed the places that look good with reflections. If I showed all of them it wouldn’t look as good

I think I did a kind of different way than this guy did but I forgot what

2 Likes

i know that but how did yours look so clean did you do something with lighting?

1 Like

Oh, make sure you use future lighting instead of shadowmap. Future adds light reflections. Also make sure you graphics quality is very high.

image
image

it didnt work it didnt even look close it looked worse idk what you did to make it look so clean

1 Like

I tried this and made my own script(its serverside)

it works best with full graphics and future lighting
later i’ll later add support for dynamic parts(parts that change size and color)


--[[updates:
Changed from pointlights to surface lights
--]]

task.wait(5)

local function light_constructer(part, side)
	local light = Instance.new("SurfaceLight", part)
	
	local avg_size = (((part.Size.X + part.Size.y + part.Size.z)/3))
	
	light.Angle = 180
	light.Brightness = 0.2
	
	light.Color = part.Color
	light.Face = side
	light.Range = avg_size
end

local function bake_lights(part)
	
	light_constructer(part, "Front")
	light_constructer(part, "Back")
	light_constructer(part, "Top")
	light_constructer(part, "Bottom")
	light_constructer(part, "Right")
	light_constructer(part, "Left")
	
	--light.Brightness = math.clamp((((part.Size.X + part.Size.y + part.Size.z)/3)), 1, 1.5)
end

local function check_v_is_acceptable(part)
	if part.Name ~= "Terrain" then-- checks if its not a terrian
		if part:IsA("BasePart") then-- checks if its a basepart
			local average_size_of_part = ((part.Size.X + part.Size.y + part.Size.z)/3)-- gets average size
			if average_size_of_part < 61 and average_size_of_part > 3 then-- checks if part is within the size limit
				return true
			end
		end
	end
end

function bake(int, part)
	if check_v_is_acceptable(part) == true then-- checks if accepted
		bake_lights(part)--adds lights
	end
end

for i,v in pairs(game:GetService("Workspace"):GetDescendants()) do
	bake(i, v)
end


Photos

P.S
it looks great with most maps

1 Like

Set your graphics mode in studio to D3D11 instead of Automatic. If you have a low powered pc your graphics mode is automatically set to OpenGL which won’t render Future lighting.

1 Like

Thank you I will try that but pray that my computer won’t explode

1 Like

Updated shaders with settings idk
without shaders


with shaders(no outlines)

with shaders and outlines

code:

-- once u paste this in a script make an attribute on the script and name it "outlines"
for i, v in pairs(workspace:GetDescendants()) do
	if v:IsA("Part") then
		if v.Shape == Enum.PartType.Ball and script:GetAttribute("Outlines") == true then
			local outline = Instance.new("SelectionSphere")
			outline.SurfaceTransparency = 1
			outline.Transparency = .9
			outline.Color3 = Color3.new(0, 0, 0)
			outline.Parent = v
			outline.Adornee = v
		elseif script:GetAttribute("Outlines") == true then
			local outline = Instance.new("SelectionBox")
			outline.SurfaceTransparency = 1
			outline.Color3 = Color3.new(0, 0, 0)
			outline.LineThickness = .01
			outline.Parent = v
			outline.Adornee = v
		end
		
		local light = Instance.new("PointLight")
		light.Parent = v
		light.Shadows = true -- prob should remove this line
		light.Brightness = math.ceil((v.Size.X + v.Size.Y + v.Size.Z)*1.5)+1--math.round(((v.Size.X * v.Size.Y * v.Size.Z) * 1/3)) 
		light.Range = 3
		light.Color = v.Color
		if (light.Brightness * 3) >= 100 then
			light:Destroy()
		end
	end
end