
Work within PSSL had already been done whilst creating a 3D game on the PlayStation 4
had already been done but at a basic level. This basic level included having
vertex shader and pixel shader which essentially placed the object on screen with
either a solid colour or texture and having some basic lighting. For this 3D game
this was all that was needed as the game wasn't planned to be that complex,
however I knew other things were most definitely possible through shaders
to create even better visuals with the vertex and pixel shader.
Normal mapping was first trialled within the pixel shader. Normal mapping uses a
texture which consists of mainly red, green and blue colours
(which will be explained why soon). The normal map texture essentially
explains to the program how you would like light to be bounced off the object
in order to create a form of inconsistency to the surface. This could make a
cube reflect like it is made out of mud, or metal, or any other material.
However when game modellers create assets for a game, they can make a normal
map for the object in order to save polygons but still have a detailed model.
An example of this could be a human face in which there is a reasonable amount
of polygons on the model whilst making the normal map show the the little wrinkles
and dimples of a face by making the light bounce off the skin slightly. The main
use of normal mapping essentially is to make a model look complex whilst saving
on polygons.
Once this was explored with PSSL, I went further by including a height map
in combination to the normal map. As shown on the right, a normal map adds
detail to a model without the use of extra polygons by
changing how light reflects on the surface.
A height map is used with the vertex
shader to make vertices move depending on a black and white texture;
if you were to imagine the texture placed on the model the same way
a texture is placed on a model, wherever there would be white, the
vertex is raised and vise versa with the black.
Another thing which was explored within PSSL, was its own compute shader.
The compute shader can be used for a variety of things and focuses on doing
the calculations on different separate threads on the PlayStation 4's GPU;
multi tasking can be done on such a high scale. So using the compute
shader and placing around a high number of objects on screen (+1000),
I were able to do a flocking algorithm where all objects using the
algorithm had to check where all the other objects were to see if the
current object running the script had to do anything different in its
movement in order to flock appropriately. Due to using the compute
shader, all objects on screen managed to flock whilst having a high
frame rate on the PlayStation 4 showing that the program wasn't
struggling to keep up with the flock algorithm.
Working with the PSSL library has
been such an amazing experience which
few programmers are given the chance to freely
play around with the hardware Sony has to
offer in the PlayStation 4s.
