So i was bored and try to challenge my scripting skills and i have this idea of making a volumetric cloud but i said to myself “how?” the first thing that comes to my mind is stacking editable images and perlin noise to simulate the clouds that kind of worked and here’s the result
Honestly it doesn’t look that bad it actually looks cool might use it in my other games but if you guys want the script here
Script
local SkyColor = Color3.new(0.4, 1, 0.309804)
local CloudSize = 0.9
local CloudSoftness = 0.3
local CloudQuality = 1
local CloudLayer = 20
local CSize = 10
local function volumentricCloud(layers)
for i,v in script.Parent:GetChildren() do
if not v:IsA("Script") then
v:Destroy()
end
end
for i = 1, layers do
local Part = Instance.new("Part", script.Parent)
Part.Position = Vector3.new(0, 5 + (i / layers), 0)
Part.Size = Vector3.new(CSize, 0.05, CSize)
Part.Anchored = true
Part.Transparency = 1
local SurfaceGUI = Instance.new("SurfaceGui", Part)
SurfaceGUI.Face = Enum.NormalId.Top
local Image = Instance.new("ImageLabel", SurfaceGUI)
Image.AnchorPoint = Vector2.new(0.5, 0.5)
Image.Position = UDim2.fromScale(0.5, 0.5)
Image.Size = UDim2.fromScale(1, 1)
Image.BackgroundTransparency = 1
Image.ResampleMode = Enum.ResamplerMode.Default
local EditableImage = Instance.new("EditableImage", Image)
local Size = Vector2.new(100*math.clamp(CloudQuality,0,10), 100*math.clamp(CloudQuality,0,10))
local Pixel = {}
EditableImage.Size = Size
for x = 0, Size.X - 1 do
for y = 0, Size.Y - 1 do
local noise = math.noise(x / 10, y / 10) + 0.5
noise = math.pow(noise,1-CloudSize)
local color = noise
local alpha = math.clamp(color * CloudSoftness, 0, 1) * (i / layers * CloudSoftness)
if color < 0.8 then
alpha = 0
end
table.insert(Pixel, SkyColor.R * color)
table.insert(Pixel, SkyColor.G * color)
table.insert(Pixel, SkyColor.B * color)
table.insert(Pixel, alpha)
end
end
EditableImage:WritePixels(Vector2.zero, Size, Pixel)
end
end
volumentricCloud(CloudLayer)
So what do you think? is it good?
- YES ITS REALLY GOOD
- ITS GOOD
- NOT BAD
- BAD
0 voters
**please if you ever use the script please give a credit