A very limited Pixelation/Glitch "Shader" using Glass

Pixelation/Glitch “Shader” Using Glass

I’ll start right off the bat saying…

:warning: This is VERY limited!

Depending on your device, this effect might not work at all!

If the effect does not work for you at high graphics quality, glass might completely lack refractions for you: Glass lacks refraction on certain devices

Because this effect uses the Glass material, any non-opaque object will not be rendered behind it.
Additionally, this effect does not work on Graphics Quality levels lower than 8.
See Limitations for more information.

I discovered this effect by complete accident while messing around with glass, and decided to turn it into a “shader” effect and share it here!


Technical Explanation

Technical Explanation

This effect uses a ridiculously large glass sheet (81,920 x 81,920 studs by default) to clamp the precision of the refraction effect of glass.

To create the massive part, I sized a part to the maximum of 2048x2048 studs, then added a SpecialMesh to it and used it to stretch it even further, and to have the refraction take effect, I added a Highlight to it.

image


Limitations

Limitations

  • Because glass is glass (and we’re on Roblox), any non-opaque object behind the glass shader part will not be rendered. This includes, but is not limited to, transparent parts, decals on transparent parts, particles, and world-space gui objects.
  • This effect does not work below Graphics Quality level 8.
  • This isn’t a true pixelation shader, and it generates quite a few artifacts.
  • Glare from light sources appears on the glass when using Future lighting technology or Realistic lighting style (Unified Lighting), and is visible on all lighting technologies from global illumination.
    • Not much can be done about glare with Future or Realistic lighting without changing to Voxel/ShadowMap or Soft lighting style. But you can remove the glare from global illumination by setting Lighting.Brightness to 0 at the cost of your entire game being dark.

Quick Start Guide

To start, get the latest release from my GitHub repository.

Download and Insert the .rbxm file into your desired location.

Initializing and enabling the effect

local pixelationShader = require(PATH.TO.SHADER_MODULE)
pixelationShader.SetEnabled(true)

Changing the strength of the effect

pixelationShader.SetStrength(50, 50)

Causing a distortion effect

pixelationShader.SetTransparency(2)

API Reference

API Reference

The module is fully typed with auto-completion available, but an API reference can still be handy!


Properties

Active: boolean

Read Only
Indicates whether the shader is currently enabled.

StrengthX: number

Read Only
Indicates the current X pixelation strength.

StrengthY: number

Read Only
Indicates the current Y pixelation strength.

Offset: Vector3

Read Only
Indicates the current glass shader part offset relative to the camera.

Transparency: number

Read Only
Indicates the current glass shader part transparency.


Methods

SetEnabled (enabled: boolean?): ()

Sets whether the shader effect is enabled or disabled.

SetStrength (strengthX: number?, strengthY: number?): ()

Sets the strength of the pixelation effect.
Default Value: 40, 40

SetOffset (offset: Vector3?): ()

Sets the offset of the glass pixel overlay part relative to the camera.
NOTE: Changing the offset may result in undesirable effects such as ‘pixel shivering’ if not tuned carefully.
Default Value: Vector3 [0.3, 0.3, -0.101]

SetTransparency (transparency: number?): ()

Sets the Transparency of the glass pixel overlay part.
Values above 1 result produce distortion that may be useful for a ‘nausea’ effect.
Default Value: 1


Although this is quite limited due to the inherent limitations of glass, I’m sharing this here in case anyone can find a use for it. :heart:
(my first ever community resource i hope i didnt mess up any formatting)

34 Likes

Apparently the effect might not work for some people, not sure what’s going on, I’ll do a bit more tweaking to see if I can fix it.

3 Likes

Update: Seems like glass refraction just doesn’t exist on mobile devices or a particular rendering API, don’t think I can do anything about that unfortunately :C

3 Likes

Glass on mobile:


Glass on PC:

Is this an engine bug?

2 Likes

Was literally figuring out something like this today, feels like fate for me to find this, can’t wait to try it out!

2 Likes

Super cool!
I think its possible to create VHS-scanlines with this as well, am I right?

2 Likes

aww its not fair high graphics users get all the cool glass effects : ( tho this is rlly cool

2 Likes

Why cant the roblox engineers let us “force” high quality effects for e.g. glass. They don’t trust us to use this sparingly?

3 Likes

*higher quality glass on lower graphics quality levels

1 Like

it’s not a bug

mobile has a different glass shader than pc

edit you figured it out already

2 Likes

Refraction was one of the main features of glass back when it was first announced in 2017.

It would be understandable if it was restricted depending on hardware capability, but 2017 was 8 years ago, and mobile devices have come a long way since then.
What is glass without the effects that make it glass? Just a slightly shiny plastic material? Not to mention that this difference was not mentioned or documented anywhere.

2 Likes

for some reason it doesn’t work for me even though I am on a good pc :thinking:
the glass itself has refraction but not the pixelation effect

Can you show what it looks like to you? That I may be able to fix.

it’s expected because mobile devices are constrained by thermals and battery life, they can’t infinitely pull power from the grid unlike desktops can. if the thermals get too high, then the SoC will throttle, lowing performance.

this is the reason why some shaders are dumbed down than the desktop variant, they have to.

though this shader literally could’ve been achieved by giving us an option to lower the viewport resolution with nearest sampling

Can you provide some sources to prove that this isn’t a bug or oversight?
This behavior isn’t documented or mentioned at all, and the statement of the original announcement was that refractions would be visible at high graphics qualities.

This might’ve been true back in 2017, but we’re in 2025 now, efficiency and processing power have gone up, why not allow users who deliberately set their graphics level 8 or above to experience some decent glass graphics? These aren’t raytraced refractions we’re talking about here.

Until Roblox provides that, the community has to use some rather janky methods or depend on slow CPU heavy raycasting with very limited resolution.

Can you provide some sources to prove that this isn’t a bug or oversight?

it is not a bug or oversight, it literally isn’t in the mobile client (at least for android) because i tried this on a personal place. no refraction, just rim lighting and a dimmed colour

This might’ve been true back in 2017, but we’re in 2025 now, efficiency and processing power have gone up, why not allow users who deliberately set their graphics level 8 or above to experience some decent glass graphics? These aren’t raytraced refractions we’re talking about here.

yes, but then theres the thermal problem. everything in a phone is fit into a thickness of less than a centimetre. since it is impractical to fit a fan into phone, the SoC have to be cooled passively, which cannot keep up with the amount of processing to draw a frame

the top of the line enthusiast phones suffer from heat dissipation problems – to the point that someone could get a serious burn. no phone manufacture wants to hear complaints about their phones causing burns on peoples skin, so they aggressively throttle the SoC to prevent overheating, which leads to stutters, low fps and just terrible user experience.

to prevent these from happening, unfortunately, somethings just needs to be cut

as for the shader, i would assume that it’s a fragment shader that distorts the UV’s to achieve the refraction effect

the issue that i see is dependent texture reads (basically texture reads that is completely random that the gpu cannot optimize for) which may cause a problem on some devices

How do you know it’s not a bug by it not appearing when that is literally the issue?
Refractions have broken before, most recently with the Unified Lighting beta, which is now fixed.

top of the line enthusiast phones suffer from heat dissipation problems

Refractions only appear on high graphics qualities, the user would have to manually opt in to it.
And let me remind you, plenty of other mobile games have refractions with perfectly fine performance.
The source engine had refractions 20 years ago on PCs that are potatoes in comparison to modern phones.

1 Like


the glass itself works

Are you on graphics level 8 or above?