Resizing a procedural texture?

When a procedural texture is loaded (and generated) on startup of my game, it seems to be 1024 x 1024. But I would like to iterate over a 32 x 32 image. The texture is a binary image of a perlin noise to determine whether or not to place a grass blade.

How can I resize the image on startup. Or how can I resize the image in the neotexture editor? I only found a specify export setting, but that will export the map to a png.



Try NeoTextureKey.setResolution()


I was so happy reading that this is possible! But I am now stuck with a bigger problem. The NeoTexture code generates an invalidCastException.


java.lang.ClassCastException: com.jme3.texture.Image cannot be cast to com.jme3.texture.Texture
at com.jme3.asset.TextureKey.createClonedInstance(

I am already debugging the source code and all. And it seems indeed that using a NeoTextureKey results in an Image, which cannot be cloned into a Texture. Using a string is fine and loads an image of 1024x1024, but this won't let me control the resolution of course. Is this a bug in NeoTextureKey?

NeoTextureKey grassMapKey = new NeoTextureKey("Textures/grassMap.tgr");
Texture grassMap = assetManager.loadTexture(grassMapKey);

I’ve been digging even deeper into the code of jMonkeyPlatform and came across the following line: 257 says:

o = key.postProcess(o);

When I step into the code, it refers to AssetKey instead of NeoTextureKey. So the asset is just returned and no postProcessing is done. This seems very odd, because the NeoTextureKey actually inherits from TextureKey. So it should do a postProcess. What is wrong with my above snippet? Should I call something else? I can't call postProcess myself, right?

If you have a fix to the bug you mentioned maybe you can post a patch? That method might indeed help, as at one point an images becomes a texture and that happens in the TextureKey

When I take a look at the code, it seems just fine. But somehow it calls the super implementation. Where can I find the source code for the project, so I can build it myself?

As far as I look into the code, it seems fine to me with the inheritance. Why the assetManager doesn’t call the right method is a bit vague…

I did find a workaround, but it’s not what we’re looking for of course:

NeoTextureMaterialKey grassMapKey = new NeoTextureMaterialKey("Textures/grassMap.tgr");
Material mapMat = assetManager.loadAsset(grassMapKey);
Texture grassMap = mapMat.getTextureParam("Diffuse").getTextureValue();

Wow I did a quick find there:

The method for post-processing is overridden, but shouldn’t.

public Object postProcess(Object asset) {
return asset;

This method should just be deleted from code. The old postProcess method from TextureKey should work fine.

How can I fix and commit this? Is there a manual for doing the whole svn setup for these projects? I assume they aren't public?

They are, just PM me your googlecode mail and I add you to the project. Note that you have to check out via httpS to be able to commit.