Alrighty! I almost replied asking another question but realized I could just reload the material for Oto and keep track of it. Thus, giving me access to it. I dunno why, but there’s no Spatial.getMaterial() method. And since I had Oto as a spatial I was sorta screwed.
Anyways, thought I’d post a small test I wrote that displays this functionality. It’s not great, probably lacks some polish, but it works as intended. I think once I implement this for real I’d probably use more than one ray, probably 4-8 so that you don’t have to be behind a wall for it to go transparent, but rather just near one. Also, some controllers to fade the walls in and out instead of just popping in and out. And, I’d probably get rid of the hard coding of the golem material for the ray collision… That’s a bit hacky… heh… 
Thanks for the help as always Normen! 
~FlaH
[java]package com.flah.playground;
import com.jme3.app.SimpleApplication;
import com.jme3.collision.CollisionResults;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.AnalogListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Ray;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
public class WallOcclusionTest extends SimpleApplication {
Geometry geom1;
Spatial golem;
Material golemMaterial;
Node roomNode;
public static void main(String[] args) {
WallOcclusionTest app = new WallOcclusionTest();
app.start();
}
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(35f);
// Create a box to move around
Mesh mesh1 = new Box(0.5f, 0.5f, 0.5f);
geom1 = new Geometry(“Box”, mesh1);
geom1.move(2, 1, -.5f);
Material m1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
m1.setColor(“m_Color”, ColorRGBA.Blue);
geom1.setMaterial(m1);
rootNode.attachChild(geom1);
// Load Oto and keep his material handy
golem = assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);
golemMaterial = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
golemMaterial.setTexture(“m_DiffuseMap”, assetManager.loadTexture(“Models/Oto/Oto.jpg”));
golemMaterial.setColor(“m_Diffuse”, new ColorRGBA(1, 1, 1, 0.5f));
golemMaterial.setBoolean(“m_UseMaterialColors”, true);
golemMaterial.setBoolean(“m_UseAlpha”, true);
golemMaterial.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
golem.setQueueBucket(Bucket.Transparent);
golem.setMaterial(golemMaterial);
golem.scale(0.5f);
golem.setLocalTranslation(-1.0f, 3f, -0.6f);
// Create a “Room”
roomNode = new Node(“A Room”);
rootNode.attachChild(roomNode);
// Floor
Box floor = new Box(5f, 0.5f, 5f);
Geometry floorGeom = new Geometry(“Floor”, floor);
Material floorMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
floorMat.setColor(“m_Color”, ColorRGBA.Red);
floorMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
floorGeom.setQueueBucket(Bucket.Transparent);
floorGeom.setMaterial(floorMat);
roomNode.attachChild(floorGeom);
// Walls
Box eastWallMesh = new Box(0.5f, 2f, 5f);
Geometry eastWall = new Geometry(“Wall 1 - X5.5”, eastWallMesh);
eastWall.move(5.5f, 2.5f, 0);
Material eastWallMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
eastWallMat.setColor(“m_Color”, ColorRGBA.Orange.clone());
eastWallMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
eastWall.setQueueBucket(Bucket.Transparent);
eastWall.setMaterial(eastWallMat);
roomNode.attachChild(eastWall);
Box westWallMesh = new Box(0.5f, 2f, 5f);
Geometry westWall = new Geometry(“Wall 2 - X-5.5”, westWallMesh);
westWall.move(-5.5f, 2.5f, 0);
Material westWallMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
westWallMat.setColor(“m_Color”, ColorRGBA.Orange.clone());
westWallMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
westWall.setQueueBucket(Bucket.Transparent);
westWall.setMaterial(westWallMat);
roomNode.attachChild(westWall);
Box northWallMesh = new Box(5f, 2f, 0.5f);
Geometry northWall = new Geometry(“Wall 3 - Z5.5”, northWallMesh);
northWall.move(0, 2.5f, 5.5f);
Material northWallMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
northWallMat.setColor(“m_Color”, ColorRGBA.Orange.clone());
northWallMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
northWall.setQueueBucket(Bucket.Transparent);
northWall.setMaterial(northWallMat);
roomNode.attachChild(northWall);
Box southWallMesh = new Box(5f, 2f, 0.5f);
Geometry southWall = new Geometry(“Wall 4 - Z-5.5”, southWallMesh);
southWall.move(0, 2.5f, -5.5f);
Material southWallMat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
southWallMat.setColor(“m_Color”, ColorRGBA.Orange.clone());
southWallMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
southWall.setQueueBucket(Bucket.Transparent);
southWall.setMaterial(southWallMat);
roomNode.attachChild(southWall);
// We must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
golem.addLight(sun);
roomNode.attachChild(golem);
// Create input
inputManager.addMapping(“MoveRight”, new KeyTrigger(KeyInput.KEY_L));
inputManager.addMapping(“MoveLeft”, new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping(“MoveUp”, new KeyTrigger(KeyInput.KEY_I));
inputManager.addMapping(“MoveDown”, new KeyTrigger(KeyInput.KEY_K));
inputManager.addListener(analogListener, new String[]{
“MoveRight”, “MoveLeft”, “MoveUp”, “MoveDown”
});
}
private AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float value, float tpf) {
if (name.equals(“MoveRight”)) {
geom1.move(2 * tpf, 0, 0);
}
if (name.equals(“MoveLeft”)) {
geom1.move(-2 * tpf, 0, 0);
}
if (name.equals(“MoveUp”)) {
geom1.move(0, 0, 2 * tpf);
}
if (name.equals(“MoveDown”)) {
geom1.move(0, 0, -2 * tpf);
}
}
};
@Override
public void simpleUpdate(float tpf) {
rootNode.updateGeometricState();
// Reset all the walls to their non-transparent state
for (int i = 0; i < roomNode.getChildren().size(); i++) {
if(roomNode.getChild(i) instanceof Geometry) {
Geometry g = (Geometry) roomNode.getChild(i);
ColorRGBA c = (ColorRGBA) g.getMaterial().getParam(“m_Color”).getValue();
c.a = 1.0f;
} else if (roomNode.getChild(i) instanceof Spatial) {
// Spatial s = (Spatial) roomNode.getChild(i);
golemMaterial.setColor(“m_Diffuse”, new ColorRGBA(1, 1, 1, 1));
}
}
// Build a ray that point the opposite of the camera.
// This would obviously work a LOT BETTER if the cam was focused on the box ;p
Ray ray = new Ray(geom1.getWorldTranslation(), cam.getDirection().negate());
CollisionResults results = new CollisionResults();
roomNode.collideWith(ray, results);
for (int i = 0; i < results.size(); i++) {
System.out.println(results.getCollision(i).getGeometry().getName());
if(results.getCollision(i).getGeometry().getMaterial().equals(golemMaterial)) {
golemMaterial.setColor(“m_Diffuse”, new ColorRGBA(1, 1, 1, 0.4f));
}
else {
Geometry g = results.getCollision(i).getGeometry();
ColorRGBA c = (ColorRGBA) g.getMaterial().getParam(“m_Color”).getValue();
c.a = 0.4f;
// g.getMaterial().setColor(“m_Color”, c);
}
}
}
}[/java]