Need to set translucent emissive texture.

Have jReality programming problems or questions? Post them here.
Post Reply
ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Need to set translucent emissive texture.

Post by ted » Sat 28. Jul 2012, 05:39

I want a translucent texture, (from a png image with varying transparency).
I try Intro07, changing "gridSmall.jpg" to an arbitrary image with half-transparent areas or feathered transparency around the edges.

What I see is a sharp edge with full transparency where the alpha value is zero, and completely opaque material mixed with my translucent image where the alpha value is between 1 and 255.

Do I need to use something like tex2d.setCombineModeAlpha(Texture2D.GL_BLEND);

with some other value besides GL_BLEND? How do I make my image to be used with its own translucency and no underlying material directly as the final texture? Can I also set my image to be emissive?

I will want it in a BufferedImage rather than a JRViewer, but I think I can figure that out myself from what I've looked over before.

This is how Java3D works with the following code:

Code: Select all

		Appearance appearance = new Appearance();
		try {
			File file = new File(filename);
			TextureLoader textureLoader = new TextureLoader(ImageIO.read(file));
			Texture texture = textureLoader.getTexture();
			appearance.setTexture(texture);
		} catch (IOException e) {
			e.printStackTrace();
		}
		TransparencyAttributes ta = new TransparencyAttributes();
		ta.setTransparencyMode(TransparencyAttributes.BLENDED);
		appearance.setTransparencyAttributes(ta);
and I want the same alpha blending for my transparency in JReality.

Thanks.

ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Re: Need to set translucent emissive texture.

Post by ted » Sat 28. Jul 2012, 07:06

The answer appears to be setting a RenderingHintsShader transparencyEnabled property.

Post Reply