Java Code Examples for com.jme3.material.Material#setVector3()

The following examples show how to use com.jme3.material.Material#setVector3() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WelcomeScreen.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void setupSkyBox() {
    Mesh sphere = new Sphere(32, 32, 10f);
    sphere.setStatic();
    skyBox = new Geometry("SkyBox", sphere);
    skyBox.setQueueBucket(Bucket.Sky);
    skyBox.setShadowMode(ShadowMode.Off);

    Image cube = SceneApplication.getApplication().getAssetManager().loadTexture("Textures/blue-glow-1024.dds").getImage();
    TextureCubeMap cubemap = new TextureCubeMap(cube);

    Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Sky.j3md");
    mat.setBoolean("SphereMap", false);
    mat.setTexture("Texture", cubemap);
    mat.setVector3("NormalScale", new Vector3f(1, 1, 1));
    skyBox.setMaterial(mat);

    ((Node) SceneApplication.getApplication().getViewPort().getScenes().get(0)).attachChild(skyBox);
}
 
Example 2
Source File: TestEnvironmentMapping.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o");

    TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true);
    key.setGenerateMips(true);
    key.setTextureTypeHint(Texture.Type.CubeMap);
    final Texture tex = assetManager.loadTexture(key);

    for (Spatial geom : buggy.getChildren()) {
        if (geom instanceof Geometry) {
            Material m = ((Geometry) geom).getMaterial();
            m.setTexture("EnvMap", tex);
            m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f));
        }
    }

    flyCam.setEnabled(false);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f));
    buggy.addControl(chaseCam);
    rootNode.attachChild(buggy);
    rootNode.attachChild(SkyFactory.createSky(assetManager, tex,
            SkyFactory.EnvMapType.CubeMap));

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
    bf.setBloomIntensity(2.3f);
    bf.setExposurePower(0.6f);
    
    fpp.addFilter(bf);
    
    DirectionalLight l = new DirectionalLight();
    l.setDirection(new Vector3f(0, -1, -1));
    rootNode.addLight(l);
    
    viewPort.addProcessor(fpp);
}
 
Example 3
Source File: CartoonSSAO.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    this.renderManager = renderManager;
    this.viewPort = vp;

    int screenWidth = Math.round(w / downsample);
    int screenHeight = Math.round(h / downsample);

    normalPass = new Pass();
    normalPass.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth);

    frustumNearFar = new Vector2f();

    float farY = (vp.getCamera().getFrustumTop() / vp.getCamera().getFrustumNear()) * vp.getCamera().getFrustumFar();
    float farX = farY * (screenWidth / (float) screenHeight);
    frustumCorner = new Vector3f(farX, farY, vp.getCamera().getFrustumFar());
    frustumNearFar.x = vp.getCamera().getFrustumNear();
    frustumNearFar.y = vp.getCamera().getFrustumFar();

    //ssao Pass
    material = new Material(manager, "Common/MatDefs/VR/CartoonSSAO.j3md");
    material.setTexture("Normals", normalPass.getRenderedTexture());        

    material.setVector3("FrustumCorner", frustumCorner);
    material.setVector2("FrustumNearFar", frustumNearFar);
    material.setFloat("Distance", applyDistance);
    if( useOutline == false ) material.setBoolean("disableOutline", true);
    if( instancedRendering ) material.setBoolean("useInstancing", true);
}
 
Example 4
Source File: DirectionalLightShadowRendererVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void setMaterialParameters(Material material) {
    material.setColor("Splits", splits);
    material.setVector3("LightDir", light.getDirection());
    if (fadeInfo != null) {
        material.setVector2("FadeInfo", fadeInfo);
    }
}
 
Example 5
Source File: SimpleWaterProcessor.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a SimpleWaterProcessor
 * @param manager the asset manager
 */
public SimpleWaterProcessor(AssetManager manager) {
    this.manager = manager;
    material = new Material(manager, "Common/MatDefs/Water/SimpleWater.j3md");
    material.setFloat("waterDepth", waterDepth);
    material.setFloat("waterTransparency", waterTransparency / 10);
    material.setColor("waterColor", ColorRGBA.White);
    material.setVector3("lightPos", new Vector3f(1, -1, 1));
    
    material.setFloat("distortionScale", distortionScale);
    material.setFloat("distortionMix", distortionMix);
    material.setFloat("texScale", texScale);
    updateClipPlanes();

}
 
Example 6
Source File: DirectionalLightShadowRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void setMaterialParameters(Material material) {
    material.setColor("Splits", splits);
    material.setVector3("LightDir", light == null ? new Vector3f() : light.getDirection());
    if (fadeInfo != null) {
        material.setVector2("FadeInfo", fadeInfo);
    }
}
 
Example 7
Source File: TestEnvironmentMapping.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o");

    TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true);
    key.setGenerateMips(true);
    key.setAsCube(true);
    final Texture tex = assetManager.loadTexture(key);

    for (Spatial geom : buggy.getChildren()) {
        if (geom instanceof Geometry) {
            Material m = ((Geometry) geom).getMaterial();
            m.setTexture("EnvMap", tex);
            m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f));
        }
    }

    flyCam.setEnabled(false);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f));
    buggy.addControl(chaseCam);
    rootNode.attachChild(buggy);
    rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false));

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
    bf.setBloomIntensity(2.3f);
    bf.setExposurePower(0.6f);
    
    fpp.addFilter(bf);
    
    viewPort.addProcessor(fpp);
}
 
Example 8
Source File: SimpleWaterProcessor.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates a SimpleWaterProcessor
 * @param manager the asset manager
 */
public SimpleWaterProcessor(AssetManager manager) {
    this.manager = manager;
    material = new Material(manager, "Common/MatDefs/Water/SimpleWater.j3md");
    material.setFloat("waterDepth", waterDepth);
    material.setFloat("waterTransparency", waterTransparency / 10);
    material.setColor("waterColor", ColorRGBA.White);
    material.setVector3("lightPos", new Vector3f(1, -1, 1));
    
    material.setFloat("distortionScale", distortionScale);
    material.setFloat("distortionMix", distortionMix);
    material.setFloat("texScale", texScale);
    updateClipPlanes();

}
 
Example 9
Source File: TerrainTestModifyHeight.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void createTerrainGrid() {
    
    // TERRAIN TEXTURE material
    matTerrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");

    // Parameters to material:
    // regionXColorMap: X = 1..4 the texture that should be appliad to state X
    // regionX: a Vector3f containing the following information:
    //      regionX.x: the start height of the region
    //      regionX.y: the end height of the region
    //      regionX.z: the texture scale for the region
    //  it might not be the most elegant way for storing these 3 values, but it packs the data nicely :)
    // slopeColorMap: the texture to be used for cliffs, and steep mountain sites
    // slopeTileFactor: the texture scale for slopes
    // terrainSize: the total size of the terrain (used for scaling the texture)
    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region1ColorMap", grass);
    matTerrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));

    // DIRT texture
    Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
    dirt.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region2ColorMap", dirt);
    matTerrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));

    // ROCK texture
    Texture rock = assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
    rock.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region3ColorMap", rock);
    matTerrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));

    matTerrain.setTexture("region4ColorMap", rock);
    matTerrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));

    matTerrain.setTexture("slopeColorMap", rock);
    matTerrain.setFloat("slopeTileFactor", 32);

    matTerrain.setFloat("terrainSize", 513);

    FractalSum base = new FractalSum();
    base.setRoughness(0.7f);
    base.setFrequency(1.0f);
    base.setAmplitude(1.0f);
    base.setLacunarity(2.12f);
    base.setOctaves(8);
    base.setScale(0.02125f);
    base.addModulator(new NoiseModulator() {
        @Override
        public float value(float... in) {
            return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
        }
    });

    FilteredBasis ground = new FilteredBasis(base);

    PerturbFilter perturb = new PerturbFilter();
    perturb.setMagnitude(0.119f);

    OptimizedErode therm = new OptimizedErode();
    therm.setRadius(5);
    therm.setTalus(0.011f);

    SmoothFilter smooth = new SmoothFilter();
    smooth.setRadius(1);
    smooth.setEffect(0.7f);

    IterativeFilter iterate = new IterativeFilter();
    iterate.addPreFilter(perturb);
    iterate.addPostFilter(smooth);
    iterate.setFilter(therm);
    iterate.setIterations(1);

    ground.addPreFilter(iterate);

    this.terrain = new TerrainGrid("terrain", 65, 257, new FractalTileLoader(ground, 256f));


    terrain.setMaterial(matTerrain);
    terrain.setLocalTranslation(0, 0, 0);
    terrain.setLocalScale(2f, 1f, 2f);
    
    rootNode.attachChild(this.terrain);

    TerrainLodControl control = new TerrainLodControl(this.terrain, getCamera());
    this.terrain.addControl(control);
}
 
Example 10
Source File: SSAOFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
    protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
        this.renderManager = renderManager;
        this.viewPort = vp;
        int screenWidth = w;
        int screenHeight = h;
        postRenderPasses = new ArrayList<Pass>();

        normalPass = new Pass();
        normalPass.init(renderManager.getRenderer(), (int) (screenWidth / downSampleFactor), (int) (screenHeight / downSampleFactor), Format.RGBA8, Format.Depth);


        frustumNearFar = new Vector2f();

        float farY = (vp.getCamera().getFrustumTop() / vp.getCamera().getFrustumNear()) * vp.getCamera().getFrustumFar();
        float farX = farY * (screenWidth / (float) screenHeight);
        frustumCorner = new Vector3f(farX, farY, vp.getCamera().getFrustumFar());
        frustumNearFar.x = vp.getCamera().getFrustumNear();
        frustumNearFar.y = vp.getCamera().getFrustumFar();





        //ssao Pass
        ssaoMat = new Material(manager, "Common/MatDefs/SSAO/ssao.j3md");
        ssaoMat.setTexture("Normals", normalPass.getRenderedTexture());
        Texture random = manager.loadTexture("Common/MatDefs/SSAO/Textures/random.png");
        random.setWrap(Texture.WrapMode.Repeat);
        ssaoMat.setTexture("RandomMap", random);

        ssaoPass = new Pass("SSAO pass") {

            @Override
            public boolean requiresDepthAsTexture() {
                return true;
            }
        };

        ssaoPass.init(renderManager.getRenderer(), (int) (screenWidth / downSampleFactor), (int) (screenHeight / downSampleFactor), Format.RGBA8, Format.Depth, 1, ssaoMat);
//        ssaoPass.getRenderedTexture().setMinFilter(Texture.MinFilter.Trilinear);
//        ssaoPass.getRenderedTexture().setMagFilter(Texture.MagFilter.Bilinear);
        postRenderPasses.add(ssaoPass);
        material = new Material(manager, "Common/MatDefs/SSAO/ssaoBlur.j3md");
        material.setTexture("SSAOMap", ssaoPass.getRenderedTexture());

        ssaoMat.setVector3("FrustumCorner", frustumCorner);
        ssaoMat.setFloat("SampleRadius", sampleRadius);
        ssaoMat.setFloat("Intensity", intensity);
        ssaoMat.setFloat("Scale", scale);
        ssaoMat.setFloat("Bias", bias);
        material.setBoolean("UseAo", useAo);
        material.setBoolean("UseOnlyAo", useOnlyAo);
        ssaoMat.setVector2("FrustumNearFar", frustumNearFar);
        material.setVector2("FrustumNearFar", frustumNearFar);
        ssaoMat.setParam("Samples", VarType.Vector2Array, samples);
        ssaoMat.setBoolean("ApproximateNormals", approximateNormals);

        float xScale = 1.0f / w;
        float yScale = 1.0f / h;

        float blurScale = 2f;
        material.setFloat("XScale", blurScale * xScale);
        material.setFloat("YScale", blurScale * yScale);

    }
 
Example 11
Source File: ToneMapFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    material = new Material(manager, "Common/MatDefs/Post/ToneMap.j3md");
    material.setVector3("WhitePoint", whitePoint);
}
 
Example 12
Source File: PointLightShadowRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void setMaterialParameters(Material material) {
    material.setVector3("LightPos", light == null ? new Vector3f() : light.getPosition());
}
 
Example 13
Source File: SpotLightShadowRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void setMaterialParameters(Material material) {    
     material.setVector3("LightPos", light.getPosition());
     material.setVector3("LightDir", light.getDirection());
}
 
Example 14
Source File: TerrainTestModifyHeight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void createTerrainGrid() {
    
    // TERRAIN TEXTURE material
    matTerrain = new Material(this.assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");

    // Parameters to material:
    // regionXColorMap: X = 1..4 the texture that should be appliad to state X
    // regionX: a Vector3f containing the following information:
    //      regionX.x: the start height of the region
    //      regionX.y: the end height of the region
    //      regionX.z: the texture scale for the region
    //  it might not be the most elegant way for storing these 3 values, but it packs the data nicely :)
    // slopeColorMap: the texture to be used for cliffs, and steep mountain sites
    // slopeTileFactor: the texture scale for slopes
    // terrainSize: the total size of the terrain (used for scaling the texture)
    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region1ColorMap", grass);
    matTerrain.setVector3("region1", new Vector3f(88, 200, this.grassScale));

    // DIRT texture
    Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
    dirt.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region2ColorMap", dirt);
    matTerrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));

    // ROCK texture
    Texture rock = assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
    rock.setWrap(WrapMode.Repeat);
    matTerrain.setTexture("region3ColorMap", rock);
    matTerrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));

    matTerrain.setTexture("region4ColorMap", rock);
    matTerrain.setVector3("region4", new Vector3f(198, 260, this.rockScale));

    matTerrain.setTexture("slopeColorMap", rock);
    matTerrain.setFloat("slopeTileFactor", 32);

    matTerrain.setFloat("terrainSize", 513);

    FractalSum base = new FractalSum();
    base.setRoughness(0.7f);
    base.setFrequency(1.0f);
    base.setAmplitude(1.0f);
    base.setLacunarity(2.12f);
    base.setOctaves(8);
    base.setScale(0.02125f);
    base.addModulator(new NoiseModulator() {
        @Override
        public float value(float... in) {
            return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
        }
    });

    FilteredBasis ground = new FilteredBasis(base);

    PerturbFilter perturb = new PerturbFilter();
    perturb.setMagnitude(0.119f);

    OptimizedErode therm = new OptimizedErode();
    therm.setRadius(5);
    therm.setTalus(0.011f);

    SmoothFilter smooth = new SmoothFilter();
    smooth.setRadius(1);
    smooth.setEffect(0.7f);

    IterativeFilter iterate = new IterativeFilter();
    iterate.addPreFilter(perturb);
    iterate.addPostFilter(smooth);
    iterate.setFilter(therm);
    iterate.setIterations(1);

    ground.addPreFilter(iterate);

    this.terrain = new TerrainGrid("terrain", 65, 257, new FractalTileLoader(ground, 256f));


    terrain.setMaterial(matTerrain);
    terrain.setLocalTranslation(0, 0, 0);
    terrain.setLocalScale(2f, 1f, 2f);
    
    rootNode.attachChild(this.terrain);

    TerrainLodControl control = new TerrainLodControl(this.terrain, getCamera());
    this.terrain.addControl(control);
}
 
Example 15
Source File: SkyFactory.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static Spatial createSky(AssetManager assetManager, Texture west, Texture east, Texture north, Texture south, Texture up, Texture down, Vector3f normalScale, int sphereRadius) {
    final Sphere sphereMesh = new Sphere(10, 10, sphereRadius, false, true);
    Geometry sky = new Geometry("Sky", sphereMesh);
    sky.setQueueBucket(Bucket.Sky);
    sky.setCullHint(Spatial.CullHint.Never);
    sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));

    Image westImg = west.getImage();
    Image eastImg = east.getImage();
    Image northImg = north.getImage();
    Image southImg = south.getImage();
    Image upImg = up.getImage();
    Image downImg = down.getImage();

    checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);

    Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null);

    cubeImage.addData(westImg.getData(0));
    cubeImage.addData(eastImg.getData(0));

    cubeImage.addData(downImg.getData(0));
    cubeImage.addData(upImg.getData(0));

    cubeImage.addData(southImg.getData(0));
    cubeImage.addData(northImg.getData(0));
    
    if (westImg.getEfficentData() != null){
        // also consilidate efficient data
        ArrayList<Object> efficientData = new ArrayList<Object>(6);
        efficientData.add(westImg.getEfficentData());
        efficientData.add(eastImg.getEfficentData());
        efficientData.add(downImg.getEfficentData());
        efficientData.add(upImg.getEfficentData());
        efficientData.add(southImg.getEfficentData());
        efficientData.add(northImg.getEfficentData());
        cubeImage.setEfficentData(efficientData);
    }

    TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
    cubeMap.setAnisotropicFilter(0);
    cubeMap.setMagFilter(Texture.MagFilter.Bilinear);
    cubeMap.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
    cubeMap.setWrap(Texture.WrapMode.EdgeClamp);

    Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    skyMat.setTexture("Texture", cubeMap);
    skyMat.setVector3("NormalScale", normalScale);
    sky.setMaterial(skyMat);

    return sky;
}
 
Example 16
Source File: SSAOFilter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    this.renderManager = renderManager;
    this.viewPort = vp;
    int screenWidth = w;
    int screenHeight = h;
    postRenderPasses = new ArrayList<Pass>();

    normalPass = new Pass();
    normalPass.init(renderManager.getRenderer(), (int) (screenWidth / downSampleFactor), (int) (screenHeight / downSampleFactor), Format.RGBA8, Format.Depth);


    frustumNearFar = new Vector2f();

    float farY = (vp.getCamera().getFrustumTop() / vp.getCamera().getFrustumNear()) * vp.getCamera().getFrustumFar();
    float farX = farY * ((float) screenWidth / (float) screenHeight);
    frustumCorner = new Vector3f(farX, farY, vp.getCamera().getFrustumFar());
    frustumNearFar.x = vp.getCamera().getFrustumNear();
    frustumNearFar.y = vp.getCamera().getFrustumFar();





    //ssao Pass
    ssaoMat = new Material(manager, "Common/MatDefs/SSAO/ssao.j3md");
    ssaoMat.setTexture("Normals", normalPass.getRenderedTexture());
    Texture random = manager.loadTexture("Common/MatDefs/SSAO/Textures/random.png");
    random.setWrap(Texture.WrapMode.Repeat);
    ssaoMat.setTexture("RandomMap", random);

    ssaoPass = new Pass() {

        @Override
        public boolean requiresDepthAsTexture() {
            return true;
        }
    };

    ssaoPass.init(renderManager.getRenderer(), (int) (screenWidth / downSampleFactor), (int) (screenHeight / downSampleFactor), Format.RGBA8, Format.Depth, 1, ssaoMat);
    ssaoPass.getRenderedTexture().setMinFilter(Texture.MinFilter.Trilinear);
    ssaoPass.getRenderedTexture().setMagFilter(Texture.MagFilter.Bilinear);
    postRenderPasses.add(ssaoPass);
    material = new Material(manager, "Common/MatDefs/SSAO/ssaoBlur.j3md");
    material.setTexture("SSAOMap", ssaoPass.getRenderedTexture());

    ssaoMat.setVector3("FrustumCorner", frustumCorner);
    ssaoMat.setFloat("SampleRadius", sampleRadius);
    ssaoMat.setFloat("Intensity", intensity);
    ssaoMat.setFloat("Scale", scale);
    ssaoMat.setFloat("Bias", bias);
    material.setBoolean("UseAo", useAo);
    material.setBoolean("UseOnlyAo", useOnlyAo);
    ssaoMat.setVector2("FrustumNearFar", frustumNearFar);
    material.setVector2("FrustumNearFar", frustumNearFar);
    ssaoMat.setParam("Samples", VarType.Vector2Array, samples);

    float xScale = 1.0f / w;
    float yScale = 1.0f / h;

    float blurScale = 2f;
    material.setFloat("XScale", blurScale * xScale);
    material.setFloat("YScale", blurScale * yScale);

}