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?
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
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. TestProjectiveTextureMapping.java) 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.
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)
I ran the TestProjectiveTextureMapping.java test, using my own jpeg instead of the monkey4.png image. I found that I got the same issue with the image bleeding.
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);
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.
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.
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.