geom.setQueueBucket(Bucket.Transparent); else geom.setQueueBucket(Bucket.Opaque);
geom.setQueueBucket(Bucket.Transparent);
@Override public void simpleInitApp() { Quad quadMesh = new Quad(512,512); Geometry quad = new Geometry("Quad", quadMesh); quad.setQueueBucket(Bucket.Gui); mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png")); quad.setMaterial(mat); guiNode.attachChildAt(quad, 0); nextColor = ColorRGBA.randomColor(); prevColor = ColorRGBA.Black; }
material.setTransparent(true); material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); geometry.setQueueBucket(Bucket.Transparent);
if (geom.getMaterial().getAdditionalRenderState().getBlendMode() == RenderState.BlendMode.Alpha) { geom.setQueueBucket(RenderQueue.Bucket.Transparent);
private void createBox() { //creating a transluscent box box = new Geometry("box", new Box(50, 50, 50)); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f)); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); //mat.getAdditionalRenderState().setDepthWrite(false); //mat.getAdditionalRenderState().setDepthTest(false); box.setMaterial(mat); box.setQueueBucket(Bucket.Translucent); //creating a post view port // ViewPort post=renderManager.createPostView("transpPost", cam); // post.setClearFlags(false, true, true); box.setLocalTranslation(-600, 0, 300); //attaching the box to the post viewport //Don't forget to updateGeometricState() the box in the simpleUpdate // post.attachScene(box); rootNode.attachChild(box); }
@Override public void simpleInitApp() { Quad q = new Quad(1, 1); Geometry g = new Geometry("quad", q); g.setLocalTranslation(-500, -500, 0); g.setLocalScale(1000); rootNode.attachChild(g); cam.setLocation(new Vector3f(0.0f, 0.0f, 0.40647888f)); cam.setRotation(new Quaternion(0.0f, 1.0f, 0.0f, 0.0f)); Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg"); Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md"); //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Yellow); mat.setTexture("ColorMap", tex); g.setMaterial(mat); //place the geoms in the transparent bucket so that they are rendered back to front for maximum overdraw g.setQueueBucket(RenderQueue.Bucket.Transparent); for (int i = 0; i < 1000; i++) { Geometry cl = g.clone(false); cl.move(0, 0, -(i + 1)); rootNode.attachChild(cl); } flyCam.setMoveSpeed(20); Logger.getLogger("com.jme3").setLevel(Level.WARNING); this.setAppProfiler(new Profiler()); }
bGeom.setQueueBucket(RenderQueue.Bucket.Transparent); attach(wireAttach, deforms, bGeom); if (outlinesAttach != null) {
/** * Adds a "transparent" quad to the scene, that limits the color values of the scene behind the object.<br/> * This effect can be good seen on bright areas of the scene (e.g. areas with specular lighting effects). */ private void createRightQuad() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); material.setColor("Color", new ColorRGBA(0.4f, 0.4f, 0.4f, 1f)); // Min( Source , Destination) material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom); material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Min); material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Min); // In OpenGL no blend factors are used, when using the blend equations Min or Max! //material.getAdditionalRenderState().setCustomBlendFactors( // RenderState.BlendFunc.One, RenderState.BlendFunc.One, // RenderState.BlendFunc.One, RenderState.BlendFunc.One); rightQuad = new Geometry("RightQuad", new Quad(1f, 1f)); rightQuad.setMaterial(material); rightQuad.setQueueBucket(RenderQueue.Bucket.Transparent); rootNode.attachChild(rightQuad); }
/** * Adds a "transparent" quad to the scene, that shows an inverse blue value sight of the scene behind. */ private void createLeftQuad() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // This color creates a blue value image. The effect will have a strength of 80% (set by the alpha value). material.setColor("Color", new ColorRGBA(0f, 0f, 1f, 0.8f)); // Result.RGB = Source.A * Source.RGB - Source.A * Destination.RGB // Result.A = Destination.A material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom); material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Subtract); material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Add); material.getAdditionalRenderState().setCustomBlendFactors( RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Zero, RenderState.BlendFunc.One); leftQuad = new Geometry("LeftQuad", new Quad(1f, 1f)); leftQuad.setMaterial(material); leftQuad.setQueueBucket(RenderQueue.Bucket.Transparent); rootNode.attachChild(leftQuad); }
sky.setQueueBucket(Bucket.Sky); sky.setCullHint(Spatial.CullHint.Never); sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
mat.getAdditionalRenderState().setDepthWrite(false); mat.setTexture("ColorMap", guiTexture); guiQuad.setQueueBucket(Bucket.Translucent); guiQuad.setMaterial(mat);
cube2.setQueueBucket(RenderQueue.Bucket.Transparent); cube2.getMaterial().setColor("Color", ColorRGBA.Red); rootNode.attachChild(cube2);
cube2Mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png")); cube2Geo.setQueueBucket(Bucket.Transparent); cube2Geo.setMaterial(cube2Mat); rootNode.attachChild(cube2Geo);
Geometry box = new Geometry("box", boxMesh2); box.setMaterial(matBox); box.setQueueBucket(RenderQueue.Bucket.Translucent);
public static Node createBillboard(Material mat, float radius) { Node sunGeom = new Node(); Geometry sun = new Geometry("", new Quad(radius, radius)); sun.setMaterial(mat); sun.setQueueBucket(Bucket.Transparent); sunGeom.attachChild(sun); sun.move(-radius / 2f, -radius / 2f, -radius / 2f); BillboardControl bc = new BillboardControl(); sunGeom.addControl(bc); return sunGeom; }
private void createRangeSphere() { Sphere sphere = new Sphere(32, 32, getRefDistance()*2); rangeGeometry = new Geometry("Shiny rock", sphere); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(1, 0, 0, 0.2f)); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); rangeGeometry.setMaterial(mat); rangeGeometry.setQueueBucket(Bucket.Transparent); }
public Geometry createRangeSphere(AudioNode audioNode) { Sphere sphere = new Sphere(32, 32, audioNode.getRefDistance()*6); Geometry rangeGeometry = new Geometry("Shiny rock", sphere); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(1, 0, 0, 0.2f)); mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha); rangeGeometry.setMaterial(mat); rangeGeometry.setQueueBucket(RenderQueue.Bucket.Transparent); return rangeGeometry; } }
public static Node createBillboard(Material mat, float radius) { Node sunGeom = new Node(); Geometry sun = new Geometry("", new Quad(radius, radius)); sun.setMaterial(mat); sun.setQueueBucket(Bucket.Transparent); sunGeom.attachChild(sun); sun.move(-radius / 2f, -radius / 2f, -radius / 2f); BillboardControl bc = new BillboardControl(); sunGeom.addControl(bc); return sunGeom; }
public void createJointGeom(PMDJoint joint) { Geometry geom = new Geometry(joint.getJointName()); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Mesh mesh; mesh = new Line(Vector3f.ZERO, Vector3f.ZERO); mat.setColor("Color", ColorRGBA.White); geom.setMesh(mesh); geom.setMaterial(mat); // mat.getAdditionalRenderState().setWireframe(true); mat.getAdditionalRenderState().setDepthTest(false); geom.setQueueBucket(Bucket.Transparent); node.attachChild(geom); } }