Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to improve 3D rendering quality? #26

Open
armin-reichert opened this issue Dec 30, 2024 · 4 comments
Open

How to improve 3D rendering quality? #26

armin-reichert opened this issue Dec 30, 2024 · 4 comments

Comments

@armin-reichert
Copy link
Owner

Is there any chance to achieve something like this with JavaFX means (materials, lighting etc.)?

https://www.youtube.com/watch?v=Q-XlcsT_LLA

@Birdasaur
Copy link

can you be more specific about which thing in the video you want to achieve?
For example are you referring to the how the floor has a sort of... raised grid look?

@armin-reichert
Copy link
Owner Author

Well, I would like to achieve a more realistic rendering result (material, lights) than that of my primitive, amateurish current version (fixed color Phong materials). In a first step I would have more realistic ghosts with these nice reflections for example. Sorry for my lack of knowledge, I never programmed anything related to 3D before this game.

@Birdasaur
Copy link

hmmm... you're thinking more photo realistic effects. Those are tricky and expensive to compute. If you want those type of renders you need to use a more high end engine dedicated to gaming.

This is where you're going to hit a wall with JavaFX 3D. JavaFX has a lot of built in 2D shader type effects including reflection but only supports PhongMaterial for 3D "out of the box". To get the reflections you want something called a Planar Surface Reflection effect. To do this you would need code which detects when an object is near the material, then "inverts" the geometry of the object, renders that inversion to the texture image of the material.. This has to be done constantly in order to achieve the reflection effect so you would have to create an Animation Timer which essentially is constantly doing object checks and material draws. You can totally draw directly to a material in a scene. Its actually not that hard.

So making a reflective surface is technically feasible in JavaFX... and I'm tempted to try it just to prove it. However it would require a lot CPU bound code. This would be fine at first but probably would not scale well. Gaming engines would provide a special material which has a GPU shader which would do that work. I guess the question is how many objects must be drawn and how often. Also if you intend to reflect more than one object on a surface, transparency/z order of objects would need to be recalculated from the perspective of the surface. Definitely not easy.

@Birdasaur
Copy link

Also btw... just because your game does not have Triple A game studio looks doesn't mean it looks bad. Your version of PacMan looks cool. You have an Arcade art style... its not complicated ... and that works for PacMan!

As long as the game is fun that is all that really matters. I've been playing computer games since the 80's and honestly its the games that focus on cool and fun game mechanics that keep me coming back for more. There's a reason Angry Birds sold so much. Recent years game studios have been so focused on getting closer to photo realistic rendering that it actually ruins the gameplay. (and of course the games are boring broken crap with crap writing and crap ideas but I digress...)

So I guess what I'm saying is focus on adding cool new ideas for game play first.... graphical polish should really be low priority. But that said If there is a specific graphic effect you want to try I can try to help.
For example I think you should add a new game mechanic that lets you jump over walls... like a powerup that you can only use once. That would add a fresh idea to Pac Man. IF you implement something like that I can show you how to make little graphical effects wherever the jump starts and ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants