Projective Texture Mapping

Shaders infos are in the src folder, not in the assets…as might be expected…



http://code.google.com/p/survivor-jme/source/browse/#svn%2Ftrunk%2FProjectiveTextureMapping%2Fsrc%2FCommon%2FMatDefs%2FMisc

1 Like

Thanks, didn’t notice that. They are still referenced as if they are in the assets/ folder though. Moving it back into assets/ works fine.



Is there a practical reason to put the shaders into the /src folder? Just curious.

It’s based on the package structure of jme3 (see here). It should not be necessary to move the shaders to run the tests.

1 Like

Hmm, I get AssetNotFoundExceptions if I dont copy the assets to the assets/ folder ( I am still running the Beta version, not RC ). I guess a locator has not been registered for the src/ folder on the assetmanager of the version I am running.



I was expecting the structure described on: http://hub.jmonkeyengine.org/wiki/doku.php/jme3:advanced:asset_manager. Which is what I am familiar with.



Thank you for the link though. I was not aware shaders ever went into src.



I am now using it in my simulator to label and mark things in the scene… It gives such a nice look and feel, and the code is very sleek. Good job.

I was referring to this structure:

http://hub.jmonkeyengine.org/wiki/doku.php/jme3:jme3_source_structure



I’ll create an extension library as @erlend_sh proposed. This should eliminate problems like yours.

2 Likes

For the sake of completeness: “Projective Texture Mapping” is available as a jME3 SDK plugin for quite some time, but I forgot to mention it here. The source code has also moved to the contributions repository. Don’t expect too much of it. You’ll most likely want to create your own solution if you need something like that, but it might be a good starting point.

The plugin also contains a sample project template to demonstrate the features:

I’m unable to edit / update the first post for some reason.

9 Likes
@survivor said:

I’m unable to edit / update the first post for some reason.

just add /edit to the basic url. That’ll make the first post editable.

1 Like

Just wanted to mention again how useful this is… Thanks a ton!

Nice example of what projective texture mapping can be used for (not-jME afaik but still…)

1 Like

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/0.1.1.1003] 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. http://updates.jmonkeyengine.org/contributions/

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)
{
geometry.add((Geometry)s);
break;
}
getGeometry(s, geometry);
}
return geometry;
}

Then i use the returned geometry list like this:

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

for(Geometry geo : targets)
gl.add(geo);

pd1.projector.setTargetGeometryList(gl);

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
Edit:
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() 
    {
        @Override
        public void visit(Spatial spat) 
        {
            if(spat instanceof TerrainPatch)
                geometry.add((Geometry)spat);
        }
    };
    
    terrain.depthFirstTraversal(visitor);