1

I have a texture I want to use for a TriangleMesh (it's a simple cube). Some parts of the texture are transparent. When I put the texture on the mesh, it's black. Is there a possibility to change that? I would like to make it transparent.

Appreciate your help, thanks

José Pereda
  • 44,311
  • 7
  • 104
  • 132
leyren
  • 524
  • 6
  • 20
  • Not entirely sure what you're asking here, what have you tried so far and where specifically are you having a problem? – Pseudonym May 27 '15 at 20:33
  • I have created a TriangleMesh, shaped like a cube. And I have a texture which is mapped to the mesh. My problem is that the faces on the texture are not really rectangular (they are too complex to make the mesh matching to it, at least for mee). So I just want to place this texture on a block, even if the texture has transparent parts. I want to keep this transparency. The problem is that, if I put the texture on the mesh, all the transparent parts become black. I want them to be transparent.. as if the cube has a hole. – leyren May 27 '15 at 20:43
  • If you added those details to the question I am sure that would help generate a useful answer – Pseudonym May 27 '15 at 20:44

1 Answers1

3

Transparency in JavaFX 3D shapes has been a long time request... until recently: Since JDK8u60 early access release b14, transparency is enabled in 3D shapes.

You can add color with transparency as diffuse color, like in this answer.

Also you can add images with some transparency level on every pixel, like this one:

Cylinder

where this is the image used with 50% transparency:

palette

And you can use full transparency areas too. For instance, in this image, Duke has 50% transparency and the rest is 100% transparent:

Duke

Giving this result applying that image as diffuse map over the cylinder:

Cylinder 2

Have a look at FXyz project for more details on creating 3D shapes and using textures in many different ways, and the FXyz Sampler.

Community
  • 1
  • 1
José Pereda
  • 44,311
  • 7
  • 104
  • 132