Xray shader problem

Hi, i’m trying to use xray shader but i can’t make it work



i have this result:







i used this shader:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=9184.0



Anybody can help me?



thanks

That screen shot looks remarkably similar to this one

nymon said:

That screen shot looks remarkably similar to this one


Yes, i have this result  but with others 3d objects, the same same same result, that's why i didn't post any more pictures

any idea?

the answer I'm about to write reads remarkably similar to this one:

dhdd said:

..., but maybe you're missing a BlendState?
dhdd said:

the answer I'm about to write reads remarkably similar to this one:
dhdd said:

..., but maybe you're missing a BlendState?



Ok, this is my code:

public class Main extends SimpleGame
{
protected void simpleInitGame ()
    {
        display.getRenderer().setBackgroundColor( new ColorRGBA( 0.02f, 0.0f, 0.776f, 1.0f ) );
        try
        {
            ResourceLocatorTool.addResourceLocator ( ResourceLocatorTool.TYPE_TEXTURE,
            new SimpleResourceLocator ( Main.class.getClassLoader ().getResource ( "comcityviewer/data/model/tex" ) ) );
        }
        catch ( Exception e )
        {
            e.printStackTrace ();
        }
       
        if (modelToLoad == null)
        {
            modelToLoad = Main.class.getClassLoader ().getResource ( "Media/Naves/Models/moto.jme" );
        }
       
        try
        {
            Node r1 = ( Node ) BinaryImporter.getInstance ().load ( modelToLoad );
     
            GLSLShaderObjectsState xray = DisplaySystem.getDisplaySystem().getRenderer().createGLSLShaderObjectsState();
                xray.load(getClass().getClassLoader().getResource(
                        "Media/Shaders/xray.vert"),
                        getClass().getClassLoader().getResource(
                        "Media/Shaders/xray.frag"));
                xray.setEnabled(true);
                xray.setUniform("edgefalloff", 1f);

                r1.setRenderState(xray);
            rootNode.attachChild(r1);
           
            //pManager.add(sketchRenderPass);
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failed to load Max file", e);
        }
    }
}

what BlendState? help me please :D

Ok, i can do it jejejej you alright:



i do:



BlendState mAlphaState = display.getRenderer ().createBlendState ();

        mAlphaState.setBlendEnabled ( true );

        mAlphaState.setSourceFunctionAlpha ( SourceFunction.SourceAlpha );

        mAlphaState.setDestinationFunctionAlpha ( DestinationFunction.OneMinusSourceAlpha );

        r1.setRenderState(mAlphaState);



and i have:







Thanks