最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javafx - Road texture is blurred where camera is far - Stack Overflow

matteradmin3PV0评论

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);
Post a comment

comment list (0)

  1. No comments so far