Jme-Graphics Handler




implementation 'com.jayfella:jme-graphics:1.1.1'

The first of many libraries I’ll be uploading to jcenter. To use it, just add this dependency to your gradle project.

A global graphics object for jmonkey to allow modifying the various graphics configurations at any time during your game.

  • Enable/disable post-processing effects easily.
  • Manipulate camera view-frustum and field-of view.
  • Set anistropic filtering level with a single line of code.
  • Change resolution, frame-rate, vsync, etc… at any time in your game.
  • Get the camera depth texture.

public class Main extends SimpleApplication {

    public static void main(String... args) {
        Main main = new Main();

    public void simpleInitApp() {


        // Enable Anistripic Filtering
        // change some camera settings
        // enable some built-in post-processing filters
        // enable an effect you made yourself
        Graphics.getInstance().getPostProcessor().setFilterEnabled(MyFilter.class, true);
        // get a filter
        BloomFilter bloomFilter = Graphics.getInstance().getPostProcessor().getBloomFilter();
        MyFilter myFilter = Graphics.getInstance().getPostProcessor().getFilter(MyFilter.class);
        // modify any context settings
        // since we enable FXAA we also need to set the strength.
        Graphics.getInstance().getContextSettings().setResolution(1280, 720);
        // any time we change getContextSettings settings we must apply them.
        // we "apply" manually so we can chain settings before applying them.

        // Get the camera depth texture and use it in a material
        Texture2D depthTexture = Graphics.getInstance().getCameraSettings().getDepthTexture();
        myMaterial.setTexture("DepthTexture", depthTexture);



Source code is available as always on github.


This is great, thank you for sharing this!


Great, Thanks for sharing :slightly_smiling_face:


Updated to v1.0.2

I’ve added some javadoc while I was there, but the only addition is being able to easily get the depth texture of the main camera. It’s lazily loaded, so it only starts generating it upon first request.

Texture2D depthTexture = Graphics.getCameraSettings().getDepthTexture();
myMaterial.setTexture("DepthTexture", depthTexture);


Maybe we should pin this topic to be on top of forum page for a while ?