Introduction
Hello! I am Zf.
In this post I am going to show you how to simulate or create a subpixel effect.
What is a subpixel?
A subpixel is 3 components making up a singular pixel. A pixel on a screen is made up of three subpixels: one red, one green, and one blue. These subpixels can be controlled independently to create different colours and shades.
What can this be used for?
This effect can be used for simulating electronic screens, such as:
- Tv Screens
- Computer Screens
- Smartphone Displays
- Electronic Billboards
Now that you have knowledge to what subpixels are, Lets get started!
Step 1: Creating the subpixel
To start with this tutorial you need to have only 2 things!
- A picture of a 1x1 or 3x3 sub-pixel
- Your image of choice to overlay the pixels
I have provided the sub-pixel below, just in case you dont have one:
---------------------------
Now that you have this image, import it into the roblox editor, using the Asset Manager.
Step 2
Now that you have the sub-pixel imported you can now create a part in the workspace. For this demonstration i will be using the size 6, 6, 0.4
for my part.
Letâs add a SurfaceGui to the part
Make sure that you set the face to the way you would like.
Setting up the SurfaceGui
There are a couple of settings you will need to change before we continue on,
-
PixelsPerStud
We will be changing this to the max option, or 200. The reason we do this is to reduce the amount of images to have on the part, this is to reduce the lag on start up.
-
LightInfluence
We will be changing this to stop the brightness of the image from becoming darker under a roof or being in front of a part. We will be setting this value to 0
Step 3: Setting up the sub-pixel
Now with our SurfaceGui created and our sub-pixel imported, we can start to create our sub-pixels!
Firstly, We will add a ImageLabel under the SurfaceGui and rename it to âPixelâ. It should look a little something like this.
After you have the ImageLabel in, you need to change a couple of properties
-
BackgroundTransparency
We will set this to0
to stop the colour of the background overlapping to the actual image. -
Size
We will set this value to:1, 0, 1, 0
. The reason for this is so the image completely covers the partâs face, no matter what size the part is. -
ZIndex
We will change this value to0
. This is to stop the two images from overlapping each other. -
Image
Now, We will add our image to the label. To do this simply click on the value and select the image we imported earlier.
-
ScaleType
We will be changing the scaletype for two reasons:
1: To reduce the amount of images we need to have to complete a full part
2: To have more than one sub-pixel in one imageLabel
For this tutorial we will have the scale type set to Tile.
-
TileSize
Since we have the ScaleType set to tile, we need to configure the TileSize, In our case we will be settings the size to:0.005, 0, 0.005, 0
If you are using the 1x1 pixel then set the size to:0.002, 0, 0.002, 0
Boom!
Now we have the sub-pixel effect, You can now move your camera towards the part to see the sub-pixels up close! But wait, Now we can add our image of choice.
A question you may have:
Why is it purple? or Why is it green?
Sub-pixels appear purple from a distance because of a phenomenon, known as âsub-pixel ditheringâ or âcolour fringing.â It occurs because of the way our eyes perceive colours and the arrangement of subpixels on certain types of displays, such as the RGB stripe display.
Step 4: Adding our final piece
For your image of choice, import it into the roblox editor, using the Asset Manager. For this tutorial i have chosen a sky and ground texture, If you would like to use it i have posted it below:
Add a new ImageLabel under the SurfaceGui. If you wish, rename the ImageLabel to Image
Now, Open the properties of the new ImageLabel and change these properties:
-
Size
We will change the size to1, 0, 1, 0
, so it covers the entire part -
Change the image to your image of choice
-
ImageTransparency
Last but not least, the ImageTransparency. We will set this value to0.2
to allow the sub-pixels to show through the image.
Voila! Now you have your very own sub-pixel simulation! Now if we move our camera close to the part you will see the effect.
Hey there! This is my first ever post on the dev forum. Please let me know if i need to fix anything or if there is a better way this can be done.