Projective Texture Mapping

Um, this looks great and I would like to use it in my game, however when I try to install the plugin I get an error stating:

The plugin installer found problem timeout of loading Projective Texture Mapping[com.jme3.ext.projectivetexturemapping/] while install the following plugins:
Projective Texture Mapping

The sample project doesn’t show up after “install”.

Can anyone please fix this?

Its a loading timeout, maybe an issue with your internet connection, a firewall or some “virus protection” on your system. I guess “anyone” is you in this case.

Huh? I’m on ubuntu and I don’t have any kind of firewall or antivirus. Maybe the case is internet connection, but I have tried it at work and at home and it still doesn’t work…

Well try downloading it directly and installing it locally then. Pretty much sure something is blocking the SDK from making a connection for you.

Downloading directly and then installing didn’t change anything. I still get the same error than before -.-
I am currently at work and they might have some blocking system, gotta try this once more at home.

You have to go via the “Downloaded” tab, right? If you still have issues (also with updating the SDK in general) try chown +x jmonkeyplatform/jdk/jre/bin/*

Yeah I went to “Downloaded tab”. Your chown command produces following output:

chown: invalid user: ‘+x’

Have you meant chmod?

EDIT: Just to be sure I preformed chmod on the files you specified, however I stil get the same old timeout error.

Yes, chmod, sorry. Can’t reproduce your error though, I can install the plugin just fine, very strange.

Hmmm… I will try it at home and report the results (it’ll take me about 2 hours to get home). Maybe the problem lies in the fact that I’m using Ubuntu from a live USB?

I’m having trouble to apply the projective texture mapping only in terrainquads. Is there a way to do it?
I successfully applied it in everything but I’m not being able to apply it only in the terrainquad.
I’m getting the geometry of the terrain quad with this code:

List listGeo = new ArrayList();
for(Spatial s : terrain.getChildren())
geometry = getGeometry(s, listGeo);

private static List getGeometry(Spatial spatial, List geometry)
for(Spatial s : ((Node)spatial).getChildren())
if(s instanceof TerrainPatch)
getGeometry(s, geometry);
return geometry;

Then i use the returned geometry list like this:

GeometryList gl = new GeometryList(new OpaqueComparator());

for(Geometry geo : targets)


What am I doing wrong?

Thanks in advance?

After start walking all over the map i discovered that it’s working in some parts of the map. I think the problem could not be the projective texture mapping code, but the code to get all the terrain patches.
I’ll post the solution if i’ll find it lol
After some more search in the documentation i found some code to get all the geometry.
My terrain patch is 65 units long and i was only getting 16 patches.
Now i have all the 65.
Here is the solution:

int patchSize = 65;
terrain = new TerrainQuad(“my terrain”, patchSize, 513, heightmap.getHeightMap());

    SceneGraphVisitor visitor = new SceneGraphVisitor() 
        public void visit(Spatial spat) 
            if(spat instanceof TerrainPatch)

I’m looking at adding Projective Texture Mapping to my application. Is this tool the best way to do that in JME? Or is there some better way to do Projective Texture Mapping with JME?

If this is indeed the best or only tool available:

  • Does this project still work with current JME version? (the last post here is 5 years ago…)
  • Do I have to use the SDK? I am currently using IntelliJ and Maven, not the SDK. Is there a standalone jar or library?
  • Is there any quick start guide or other documentation for this library? Or is this thread the best documentation?

Any help is much appreciated.

1 Like

I’m using this in one of my projects and I can assure you it works with latest jme. Use any of the following links:

I don’t remember which one of them I used but the latest has more recent commits (2018) so it’s a better option

What I did is checkout the repo and copy src and assets to my project equivalents. I had to slightly modify both the code and the shaders to make it work as I needed for my project but default works ok

About usage, the examples in this thread work also :wink:


Thanks for that.

I checked out the source from the second github link (“NemesisMate”).
I copied the source folders and the resources (MatDefs, Shaders and Textures) to my existing JME project.
I found the “test” classes (e.g. were a great help. They are called tests but are really example applications. They are runnable and I found I could just move the code over to my application and start modifying it.

1 Like

I have an issue with rendering the projected textures.
When I use the provided sample texture (monkey.png), it renders correctly. When I use any other image, the texture “bleeds” infinitely in the four directions out from each edge. I have provided two screenshots (one with the monkey image and one with my image).
This happens with every image I try (my own images, random pngs downloaded off the internet)

Things I have tried:

  • Making the image the same dimensions as monkey.png
  • Giving the image the same colour space (seems to be 32 bit ARGB)

Any ideas?

My code is basically copy and pasted from TestProjectiveTextureMapping .java


Looks like bleeding caused by specifying the wrong Texture.WrapMode.

With only the name of the texture different? Nothing else at all?

I ran the test, using my own jpeg instead of the monkey4.png image. I found that I got the same issue with the image bleeding.

To reproduce:

  1. Check out the code from the NemesisMate repo GitHub - NemesisMate/projective-texture-mapping
  2. In the TestProjectiveTextureMapping test, change Texture1 from monkey4.png to another image (e.g. the attached image).
    I have uploaded the image I am using. I am not sure if the forums software will alter the file format. I couldn’t see a way to attach a raw file.
//        Texture2D texture1 = (Texture2D) assetManager.loadTexture("Textures/Monkey4.png");
        Texture2D texture1 = (Texture2D) assetManager.loadTexture("Textures/satellite512.jpg");
        Texture2D texture2 = (Texture2D) assetManager.loadTexture("Textures/rune.png");

        pd1 = new ProjectorData();
        pd2 = new ProjectorData();
        initProjectorData(pd1, new Vector3f(1f, 2.1f, 0f), texture1);
        initProjectorData(pd2, new Vector3f(1f, 2.1f, 2f), texture2);
  1. Run the test.

Observed: Weird bleeding (see screenshot)

I noticed that the monkey4.png test image had empty (transparent) pixels all around the outer edge of the image.
So I created a new version of my image with a 2 pixel transparent border around the edge. And this solved the problem.
No idea if this is intended behaviour or if this is a bug. My guess is that the sample test doesn’t have the same problem because the test images both have transparent borders. In fact, if you look carefully at my screenshot above, you can see the pink from “rune.jpg” is bleeding out at the one point where the pink touches the edge of the image.

1 Like

Hello! Just an idea by the way:

Most of the article relate to the application on a map. However, on particularly uneven surfaces, near cliffs or steep mountains, the projections are very misshapen.

How about a ball / radial solution?

The center of the sphere is the center of the marker. Since a map can never go straight up, we have no problem with gimbal lock. The projection lies like a tablecloth on the map.
I would be more beautiful.

Edit: something like this:

The red marking is a parallel projection 0, -1,0. You can see the stretching on steeper slopes.
The turquoise marking is the radial solution.
White occurs on flat planes when they overlap.