Update:
- “(Single)TextureProjectorRenderer” is default again. I said multi would be faster, but that was a mistake.
- Some refactoring:
— “ProjectiveTextureMapping1pass” -> “ProjectiveMultiTextureMapping”
— “TextureProjectorRenderer1pass” -> “MultiTextureProjectorRenderer”
- Z-fighting fix “setPolyOffset(-0.1f, -0.1f)” by default
- Different CombineMethods in “MultiTextureProjectorRenderer”
- Bugfixes
- ul and li don’t work btw
Snapshot: ProjectiveTextureMapping-2012-03-15.zip
—
I wrote a post processor which does Projective Texture Mapping. See also this paper by nVidia. It is related to the thread Projected Texture on this forum.
Features:
- Can project an arbitrary number of textures onto scene geometry
- You can choose which geometry shall be affected (GeometryList)
- Perspective and parallel projection
- Back projection and backside projection fixed
- Fall off distance and fall off power to limit the projection
Video demonstration of latest version (note the rune is just projected onto one geometry):
Motivation:
A use case of projected textures are targeting circles and ground effects known from popular MMOs by BlizZzard and Buy-o-ware. It can also be used to simulate the light cone of a flashlight/torch.
The code including a test application can be checked out here:
http://code.google.com/p/survivor-jme/source/browse/#svn%2Ftrunk%2FProjectiveTextureMapping
Please note that this is work in progress. It might change frequently and it will surely have bugs.
Future work:
I’m planning to write a shader that can do all in one pass like this:
uniform vec3 m_ProjectorLocation[NUM_PROJECTORS];
uniform mat4 m_ProjectorViewProjectionMatrix[NUM_PROJECTORS];
for (int i = 0; i < NUM_PROJECTORS; i++)
{
vec3 pl = m_ProjectorLocation[i];
mat4 pm = m_ProjectorViewProjectionMatrix[i];
// process an arbitrary number of projectors in a single pass
}
I don’t know if this makes sense, though. I can’t yet estimate performance bottlenecks.
I’d also love to see this in the GL1Renderer.