JDK-8170852 : Order-independent transparency for 3D objects
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: other
  • CPU: x86
  • Submitted: 2016-12-07
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :Currently correct transparency rendering with depth buffer enabled is dependent on draw order, drawing the further objects before closer objects. This is impractical/impossible for complicated objects in the scene which interact or intersect each other.There are now a number of modern graphics techniques to implement order independent transparency blending, at the cost of some performance, and hardware backwards compatibility. It would be good if a feature like this could be made available on an optional basis.JUSTIFICATION :The current options for combining transparency with depth testing make it impossible/impractical for catering for complicated/intersecting geometry.EXPECTED VERSUS ACTUAL BEHAVIOR :EXPECTED -An algorithm like what is described in one of these papers:http://on-demand.gputechconf.com/gtc/2014/presentations/S4385-order-independent-transparency-opengl.pdfhttps://researchbank.rmit.edu.au/eserv/rmit:161520/Knowles.pdfMade available to enable on a JavaFX scene.Draw order of objects in the scene has a much smaller (depending on algorithm) impact on the visual output. Blending of transparent objects is much closer to expected in complicated scenarios.For the provided test case, this would enable the green cube to be shown through the transparent sphere (which is physically in front) regardless of the draw order.---------- BEGIN SOURCE ----------import javafx.application.Application;import javafx.geometry.Point3D;import javafx.scene.DepthTest;import javafx.scene.Group;import javafx.scene.PerspectiveCamera;import javafx.scene.PointLight;import javafx.scene.Scene;import javafx.scene.effect.BlendMode;import javafx.scene.paint.Color;import javafx.scene.paint.PhongMaterial;import javafx.scene.shape.Box;import javafx.scene.shape.Sphere;import javafx.stage.Stage;public class JavaFXDepthTransparencyTest extends Application {	final Group root = new Group();			@Override	public void start(Stage primaryStage) throws Exception {		primaryStage.setTitle("JavaFX Transparency Test");				PhongMaterial boxMaterial = new PhongMaterial();		boxMaterial.setDiffuseColor(Color.rgb(0, 255, 0, 0.5));		boxMaterial.setSpecularColor(Color.WHITE);		Box box = new Box(400, 400, 400);		box.setMaterial(boxMaterial);		box.setTranslateX(250);		box.setTranslateY(250);		box.setTranslateZ(450);		box.setDepthTest(DepthTest.ENABLE);				PhongMaterial sphereMaterial = new PhongMaterial();		sphereMaterial.setDiffuseColor(Color.rgb(255, 0, 0, 0.5));		sphereMaterial.setSpecularColor(Color.WHITE);		Sphere sphere = new Sphere(200);		sphere.setMaterial(sphereMaterial);		sphere.setTranslateX(250);		sphere.setTranslateY(250);		sphere.setTranslateZ(50);		sphere.setDepthTest(DepthTest.ENABLE);				final Group parent = new Group(sphere, box);		parent.setRotationAxis(new Point3D(1,1,1));				Group root = new Group(parent);		Scene scene = new Scene(root, 500, 500, true);		scene.setCamera(new PerspectiveCamera(false));						PointLight pointLight = new PointLight(Color.ANTIQUEWHITE);		pointLight.setTranslateX(15);		pointLight.setTranslateY(-10);		pointLight.setTranslateZ(-100);				root.getChildren().add(pointLight);				primaryStage.setScene(scene);		primaryStage.show();			}		public static void main(String[] args) {		System.setProperty("prism.dirtyopts", "false");		launch(args);	}	}---------- END SOURCE ----------
Comments
We have an old RFE relating to this to properly sort 2D objects that are transformed by 3D transforms, JDK-8091693. Both could be looked at for a future release of JavaFX, but are unplanned at this time.
09-12-2016