admin管理员组

文章数量:1023764

I am trying to develop a car race game using JavaFX. I am using perspective camera. I am using PointLight as well. The road gets blurred where the camera is far. How can I avoid this blurring? My camera settings are below:

PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setNearClip(5);
camera.setFarClip(1000);
camera.setFieldOfView(20);

PointLight pointLight = new PointLight(Color.WHITE); 
pointLight.setTranslateY(-500);
root3D.getChildren().add(pointLight);
pointLight.translateXProperty().bind(cameraPosition.xProperty());
pointLight.translateZProperty().bind(cameraPosition.zProperty());

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.BALANCED);
subScene.setCamera(camera);

I am trying to develop a car race game using JavaFX. I am using perspective camera. I am using PointLight as well. The road gets blurred where the camera is far. How can I avoid this blurring? My camera settings are below:

PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setNearClip(5);
camera.setFarClip(1000);
camera.setFieldOfView(20);

PointLight pointLight = new PointLight(Color.WHITE); 
pointLight.setTranslateY(-500);
root3D.getChildren().add(pointLight);
pointLight.translateXProperty().bind(cameraPosition.xProperty());
pointLight.translateZProperty().bind(cameraPosition.zProperty());

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.BALANCED);
subScene.setCamera(camera);

Share Improve this question asked Nov 18, 2024 at 18:53 Nebi SarikayaNebi Sarikaya 675 bronze badges 2
  • 1 The image looks like poor quality (or no) Anisotropic filtering. I don't have a suggestion on how you fix that for your application. – jewelsea Commented Nov 18, 2024 at 21:45
  • Default field of view is 30 try to tweak that value – Giovanni Contreras Commented Nov 20, 2024 at 4:20
Add a comment  | 

2 Answers 2

Reset to default 0

In order to debug the visual artifact you are seeing (the blurring at distance) we would need to see how you are adding the landscape, road and road lines to the scene. I am assuming you are achieving a road animation effect using a material animation but we need to see that mechanic too.

If your road or lines are separate 3D shapes with semi transparent materials then the order they are added to the scene will determine some transparency effects. Just guessing here. Need much more info.

Ok, when I disabled Anti-aliasing using:

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.DISABLED);

I am trying to develop a car race game using JavaFX. I am using perspective camera. I am using PointLight as well. The road gets blurred where the camera is far. How can I avoid this blurring? My camera settings are below:

PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setNearClip(5);
camera.setFarClip(1000);
camera.setFieldOfView(20);

PointLight pointLight = new PointLight(Color.WHITE); 
pointLight.setTranslateY(-500);
root3D.getChildren().add(pointLight);
pointLight.translateXProperty().bind(cameraPosition.xProperty());
pointLight.translateZProperty().bind(cameraPosition.zProperty());

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.BALANCED);
subScene.setCamera(camera);

I am trying to develop a car race game using JavaFX. I am using perspective camera. I am using PointLight as well. The road gets blurred where the camera is far. How can I avoid this blurring? My camera settings are below:

PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setNearClip(5);
camera.setFarClip(1000);
camera.setFieldOfView(20);

PointLight pointLight = new PointLight(Color.WHITE); 
pointLight.setTranslateY(-500);
root3D.getChildren().add(pointLight);
pointLight.translateXProperty().bind(cameraPosition.xProperty());
pointLight.translateZProperty().bind(cameraPosition.zProperty());

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.BALANCED);
subScene.setCamera(camera);

Share Improve this question asked Nov 18, 2024 at 18:53 Nebi SarikayaNebi Sarikaya 675 bronze badges 2
  • 1 The image looks like poor quality (or no) Anisotropic filtering. I don't have a suggestion on how you fix that for your application. – jewelsea Commented Nov 18, 2024 at 21:45
  • Default field of view is 30 try to tweak that value – Giovanni Contreras Commented Nov 20, 2024 at 4:20
Add a comment  | 

2 Answers 2

Reset to default 0

In order to debug the visual artifact you are seeing (the blurring at distance) we would need to see how you are adding the landscape, road and road lines to the scene. I am assuming you are achieving a road animation effect using a material animation but we need to see that mechanic too.

If your road or lines are separate 3D shapes with semi transparent materials then the order they are added to the scene will determine some transparency effects. Just guessing here. Need much more info.

Ok, when I disabled Anti-aliasing using:

SubScene subScene = new SubScene(root3D, 1920, 1080, true, SceneAntialiasing.DISABLED);

本文标签: javafxRoad texture is blurred where camera is farStack Overflow