gdx-psx its a library for LibGDX designed to assist you in simulation of PlayStation 1 graphics with few simple steps!
If you have questions or suggestions for this project, or you want to just chat about it - welcome to our discord.
- Vertex Jitter(Inacuraccy)
- Screen dithering
- Color depth change
- Texture shrink(compression)
- Resolution downscaling
You can look at demo here
- Add JitPack repository in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the psx-gdx dependency
dependencies {
...
implementation 'com.github.fxgaming:gdx-psx:0.1.2a'
}
gdx-psx have a lot of configurable parameters, recommended to check the demo before starting work with library!
Library provides tool that helping you process textures and and downgrade their quality!
Fast texture processing:
TextureTransformer.shrinkTexture(Pixmap, ResizeType, textureSizeFactor, colorDepthFactor);
or with recommended parameters:
TextureTransformer.shrinkTexture(pixmap, ResizeType.FORCE, 192f, 32f);
Instead of using Pixmap you can use FileHandle with your texture's path.
If you need to process bigger amount of textures with specified parameters:
TextureTransformer transformer = new TextureTransformer(); //using recommended parameters by default
transformer.setResizeType(ResizeType.ACCORDING_TO_HEIGHT);
transformer.setColorDepthFactor(32f);
//...
Texture newTexture = transformer.shrinkTexture(fileHandle);Library can provide Vertex Jitter effect to your models (via ModelBatch)
//You can provide your own shaders, but using libgdx's default shader by default.
ShaderTransformer transformer = new ShaderTransformer();
transformer.setResolution(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
transformer.setFactor(4f); //Jitter factor
//You can provide Config for ShaderProvider if needed
ModelBatch myModelBatch = new ModelBatch(transformer.createShaderProvider());Library also supports gdx-gltf by mgsx
To use ShaderTransformer with PBRShaderProvider use PBRShaderTransformer.
Also library provides few things to work with post-processing!
- Create and customize post processing tool
PSXPostProcessing postProcessing = new PSXPostProcessing(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
postProcessing.setDownscalingIntensity(4f);
postProcessing.setColorDepth(32f, 32f, 32f);
postProcessing.setDitheringMatrix(DitherMatrix.Dither4x4);
postProcessing.setFlagState(FlagType.DITHERING, true);- Put this in the render loop
postProcessing.capture();
//rendering everything
postProcessing.endCapture();
postProcessing.drawImage();