RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 16 Jul 2012 10:53 AM |
i'm trying to create a white noise GUI effect for a game i'm making. the original plan involved over half a million frame updates per frame for that screen - but that's too laggy.
the new plane involves using pre-rendered white noise textures(through imagelabels) and applying them on a grid on the screen. on a 1080p monitor it'd take only a mere 48(or 24 if i use a more blocky effect) updates per frame(compared to about 1M on the previous system).
however, the effect will need transparency - and i can't set it on imagelabels.
here's a script i've made in like... 10 minutes to test that effect.
ScreenGUI = Script.Parent imgsize = 256 -- how many pixels a texture is supposed to take on the screen
texturetable = {0,1,2,3} -- placeholder. frame=nil
function createframe() _frame = Instance.new("Frame", ScreenGUI) for x=1,(ScreenGUI.AbsoluteSize.X/imgsize)+1 do for y=1,(ScreenGUI.AbsoluteSize.Y/imgsize)+1 do label = Instance.new("ImageLabel",frame) label.Name = x.."/"..y label.BackgroundTransparency=0 --label.BorderSizePixel=0 --uncomment this to render view attempts useless, lol label.Size = UDim2.new(0,-imgsize,0,-imgsize)--clever trick so i don't have to invert the rest label.Position = UDIM2.new(0, x*imgsize, 1, y*imgsize) end end frame = _frame end
function updateframe() if frame ~= nil then frame.Position = UDIM2.new(0,math.random(0,imgsize-1), 0, math.random(0,imgsize-1)) for k,v in pairs(frame:GetChildren()) do v.Image = "http://www.roblox.com/asset/?id="..texturetable[math.random(1,#texturetable)] end end end
createframe()
ScreenGUI.Changed:Connect(function() frame:Destroy() createframe() end)
Delay(0,function() while true do updateframe() wait(0.1) -- supposed to be a smaller time, depending of how laggy this turns out to be end
are there any valid workarounds to support transparency?
|
|
|
| Report Abuse |
|
|
| 16 Jul 2012 12:05 PM |
_frame = Instance.new("Frame", ScreenGUI) frame = _frame
The point of _frame is...?
Do you mean being able to change transparency on a texture? |
|
|
| Report Abuse |
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 16 Jul 2012 01:01 PM |
the point of _frame was to make sure that frame didn't appear only for that function's environment.
i just want to change a GUI texture's transparency in-game(i won't upload 255*aumountofsampleimages). |
|
|
| Report Abuse |
|
|
| 16 Jul 2012 01:30 PM |
I don't believe it is possible.
You could make the texture have 15/255 transparency and then overlap 17 times to get a range of transparencies without using millions of images. |
|
|
| Report Abuse |
|