How to create a PS1 rendering style shader in UE4

Introduction

Back in the old days PSX games had a shaky and wobbly effect of vertices, this unwanted effect is caused by the lack of floating point precision.

psx_shaky_vertices_example

The PSX’s hardware only allow fixed point calculation so when the camera is moving or an object is moving, any given vertex stays in its position until it’s close to the next position and suddenly snap to it, nowadays graphics hardware can interpolate vertices between two position smoothly thanks to more floating point precision that is available.

We assume you have already created a project ready to test the shader or you already have a project that you want to apply the effect in it. The minimum you must have is a mesh with material applied to it.

Preview

You can download the complete project at the end of this tutorial so you can check it at your own pace, you will find everything documented.


Casual Game Lighting is a material function with a collection of lighting features like fog, diffuse, ambient lighting, and specular lighting. It’s made for anyone who wants to make a beautiful and appealing casual (or hyper casual) mobile games. It will make your game looks on mobile devices exactly the same way it looks in the editor.
Marketplace Link: Click Here
Documentation and how to use it: Link



Step 1: Create a material parameter collections

Material parameter collections is an asset that store global parameters (a set of scalar and vector parameters) that you can reference in any material. For example wind direction and strength can be referenced by all foliage’s materials. To read more, check this link.

To create a new material parameter collections assets, in content browser right click and go to Materials & Textures > Material Parameter Collection.

Next add two scalar parameters, Global_PSXEffect_3dGridCellSize & Global_PSXEffect_PixelizationAmount

Hit save and close the window.


Step 2: Create material function

The function PSXEffect_Function return a vertex offset data, we use it to offset vertices for the shaky effect. The function also pixelate UV data, we plug the return value in Texture Sample node to have a pixelated texture.

PSXEffect_Function

Notice that we used the parameters we created previously in material parameter collections.

To understand how we shake the vertices, imagine a 3D grid around your mesh, and vertices snaps the the closest points in that grid.

Changing the imaginary cell size


Step 3: Add PSXEffect_Function to you materials

It’s easy to add a function to a material. You can add it by left click in the material editor and type the name of the function.

Source File

That’s all folks ! Thanks for reading. If you have any questions drop a comment here or join me on Discord.

19 Comments

  1. Davers December 11, 2019
    • Mourad March 27, 2020
  2. Can March 27, 2020
  3. Can Sandikci March 27, 2020
    • Mourad March 27, 2020
  4. Zia Holt July 2, 2020
    • Mourad July 13, 2020
  5. Lo July 12, 2020
    • Mourad July 13, 2020
  6. Rykane August 2, 2020
    • Mourad August 11, 2020
  7. jean-gabriel lapointe September 24, 2020
    • Mourad October 31, 2020
  8. Ismael September 25, 2020
    • Mourad October 31, 2020
  9. antonio October 30, 2020
    • Mourad October 31, 2020
  10. Argemon October 31, 2020
  11. Argemon November 1, 2020

Leave a Reply

Update cookies preferences