Combining SketchRenderPass and normal RenderPass

Hello,



first of all, sorry for my bad English. I’m curently trying to build a program where you can walk through the outline plan of a museum and watch the pictures that are hanging there. It’s hard to describe, therefor I have included a Picture how it should look when it’s finished:





So I tried to use the SketchRenderPass for the outlines and a normal RenderPass to Render the pictures on the wall.

But it won’t work, you can only see the Walls rendered by the SketchRenderPass and the Pictures are not there. But when I only add the normal RenderPass to the BasicPassManager, the Pictures are rendered. I have no idea what’s wrong, maybe you can help me out?


import com.jme.app.SimplePassGame;
import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.renderer.pass.RenderPass;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.util.TextureManager;
import com.jme.scene.state.TextureState;
import com.jmex.effects.glsl.SketchRenderPass;

public class MockUp2 extends SimplePassGame {

   private Node pictures,room;

   protected void simpleInitGame() {
      pictures = new Node("pictures");
      room = new Node("room");
      Box wall1 = new Box("wall1",new Vector3f(-120f, -20f, -0.1f), new Vector3f(120f, 20f, 0.1f));
      Box wall2 = new Box("wall2", new Vector3f(-0.1f,-20f,-120f),new Vector3f(0.1f,20f,120f));
      wall2.setLocalTranslation(new Vector3f(-120f,0f,120f));
      Box wall3 = new Box("wall3",new Vector3f(-120f, -20f, -0.1f), new Vector3f(120f, 20f, 0.1f));
      wall3.setLocalTranslation(new Vector3f(0f,0f,240f));
      Box wall4 = new Box("wall4", new Vector3f(-0.1f,-20f,-80f),new Vector3f(0.1f,20f,80f));
      wall4.setLocalTranslation(new Vector3f(120f,0f,160f));
      
      Box pic1 = new Box("pic1",new Vector3f(0f,-20f,-20f), new Vector3f(0f,20f,20f));
      pic1.setLocalTranslation(new Vector3f(0f,0f,-20f));      
      pic1.setRandomColors();

      room.attachChild(wall1);
      room.attachChild(wall2);
      room.attachChild(wall3);
      room.attachChild(wall4);

      pictures.attachChild(pic1);
      
      SketchRenderPass skRenderPass = new SketchRenderPass(cam,1);
      skRenderPass.add(room);
      RenderPass rPass = new RenderPass();
      rPass.add(pictures);
      
      pManager.add(rPass);
      pManager.add(skRenderPass);
   }

   public static void main(String[] args) {
      MockUp2 app = new MockUp2();
      app.start();
   }
}



To figure out what's wrong, I used SimplePassGame for this test. I also assigned RandomColors to the Box, to avoid that the mistake is caused by the texture.

      pManager.add(rPass);
      pManager.add(skRenderPass);



You have the sketch pass drawn 2nd... maybe switch those two lines so you draw the sketch first, then the paintings

I tried that, but it didn't help…

Is the general idea how to build something like I showed in the picture right? Or can you think of an other way to achieve this look?



Greetings

You don't necessarily need a Sketch pass, you can achieve that illusion with a single pass. Simply render your walls with lines using PolygonOffset (search for it, there are a couple of threads discussing it here) on top of your normal walls. I assume your pictures will be billboards from what I can see in your image.