How to create game that renders 3D objects fast?

  • Thread starter icecubebeast
  • Start date
  • Tags
    3d Game
In summary, using Java for 3D rendering may be inefficient due to the language's slow performance. Other options like C++ or Unity 3D are more efficient and allow for more control over the rendering process.
  • #1
icecubebeast
66
3
Hello,
I was interested in making a game that renders 3d objects in the way they would look like in viewing them in real life. Rendering 3d objects takes lots of memory and processing power, and it may lag easily. So, I was wondering, what should I do to maximize efficiency in rendering 3d objects? What should I NOT do (things that aren't efficient or may cause lag) when trying to make the source code for the render?
 
Technology news on Phys.org
  • #2
This is a pretty big topic. What tools are you using or have experience in? Have you read up on any 3D engines?
 
  • #3
I am using java jdk 8 and I am using the IDE: eclipse 4.4 standard.
 
  • #4
Most don't do it in Java. 3d games work off GPUs, which are massively parallel clusters of little processors. People code for them in C/C++ and write little kernels for each little processor. At a higher level, people use Gaming Engines, which abstract all this. I know if you Google you can find an open source gaming engines, and some might have Java wrappers. But don't try to roll your own in Java its just too slow.
 
  • #5
If you are not restricted to use Java (that is, if you are not trying to add 3D to an existing application or something) I would second Foolality's comment and recommend you look into other tools. For instance, you may want to check out Unity [1] which comes in a Personal Edition that is free to use. I haven't used it myself, but a coworker who is a part time game developer recommends it highly.

[1] http://unity3d.com/5
 
  • Like
Likes kroni
  • #6
Only use unity if your not willing to think, if you want to go in depth into game design I advise a proper engine, like direct x if you know c++ or xna /monogame if you know c#. since you know java you could go with lwjgl. That way you have a lot more control, if your having lag issue you can come up with your own solution to solve it, and you get the satisfaction of building a game from scratch and getting to know how everything works.
 
  • #7
Have you done any reading about graphics theory? Understanding the math and how points get transformed through the pipeline will help you know what to optimize and how to best do it, programming languages aside. There are a lot of books on the subject as well and there's lots of techniques for speedup on the software side.

As for what language to use, it's really up to you. Most languages will support OpenGL or DirectX, so you'll end up using their prebaked functions to manipulate things although newer versions allow you get control of the shaders to make some really cool effects. The shaders are written in their own C-like language (either GLSL or HLSL) but they're usually passed to the rendering program as a string, so it's kind of language-independent. I've seen a few games and things written in Java, so you can do that if Java's your preference, but I hear the Java game programming community's a pretty small group.

As for using prebuilt tools, there's also a pretty big divide in the game programming community when it comes to actually writing games. Everyone's in basically in one of 2 camps: the people interested in the algorithms that games use, or the people interested in actually writing a game. The former group like to implement their own algorithms for everything and tinker around with things like optimization or speed. The fun for them is the exploration and learning about the methods and the game itself (playability, art, etc.) becomes a secondary objective. The latter group is interested in actually producing a game for the public (or a small private group). They love the challenge of making something function and playable and don't necessarily care about using pre-built tools like rendering or physics engines. These groups aren't necessarily exclusive groups and they're not usually at odds with one another. In fact, the former group usually ends up creating the tools for the latter to use. It's just mainly a question of focus.
 
  • #8
To be honest, I am still learning to apply 3D rendering. So would C++ be better for faster 3D rendering than Java?
 
  • #9
Yes, C++ is faster than Java in practically any application.
Also, I think that creating 3D objects and coloring them is done by the GPU. I don't know how deep you want to go into this. But you can either take advantage of the functions of an GPU or you make a program that also does the work of the GPU so you can maybe monitor the efficiency of your renderer? I am not too sure about your options here.
 
Last edited:
  • #10
If you are looking to create fast 3D games I would recommend using Unity 3D big time, not only is it easy but some really popular high quality games have come out of it :)
 
  • #11
Sadly, Martin's correct. It's cheaper for game developing companies to use third-party generic game engines (like Unity, ugh) rather than developing their own. This eventually leads to unfixable bugs.

You can get rich by spamming Unity 3D crap games onto PC game distribution networks, like Steam. Most people who try to do it the low-level way quit when they realize it's actually quite hard.
 
  • Like
Likes Joe Martin
  • #12
ellipsis said:
Sadly, Martin's correct. It's cheaper for game developing companies to use third-party generic game engines (like Unity, ugh) rather than developing their own. This eventually leads to unfixable bugs.

You can get rich by spamming Unity 3D crap games onto PC game distribution networks, like Steam. Most people who try to do it the low-level way quit when they realize it's actually quite hard.

Indeed. Obviously most people would prefer to develop their own engine etc... However, especially for you icecubeceast it's just not practical. Though Unity 3D may seem crap it does have its positive sides, at least it's best for what you want!
 
  • #13
ellipsis said:
It's cheaper for game developing companies to use third-party generic game engines (like Unity, ugh) rather than developing their own. This eventually leads to unfixable bugs.

Developing a (good) game engine is definitely not a trivial task and it is very rarely feasible to develop an engine "just" to support your own game. Regarding bugs I would say it is a fair claim that you need access to a very experienced development team in order to expect them to make fewer bugs in a newly created engine compared to the same team having to just manage getting around the few well-known bugs and short-comings that some of the popular engines have. This is pretty much a standard trade-off in the whole software business and the reason so many good libraries, engines and frameworks exists.

Anyone wishing to develop a game engine because the think they can do better ought to at least have an idea about what they are up against. Anyone developing a game engine because they think it would be fun to do so should probably also be inspired by how other engines are structured. And anyone wanting to do both (have fun and make a competitive engine) should probably try work on some of the open source engines [1] or apply for a job position somewhere.[1] http://en.wikipedia.org/wiki/List_of_game_engines
 
  • #14
Hey icecubebeast.

I used to do game developing for what its worth.

The best advice I can give you is to learn about scene classification and computational geometry.

Graphics cards are designed to process triangles extremely fast. They have vertex and fragment engines that are hugely parallelized and this is what all graphics cards render to the screen if they use the accelerated capabilities of the GPU.

What you need to do is to figure out a way of organizing your scene so that the optimal amount of triangles are processed. The scene organization techniques are varied but if you can classify the space easily so that you can filter out the triangles that don't have to be drawn then this is what will save a lot of time.

In addition to this I would also point out that GPU memory (on board memory) is getting bigger and bigger so uploading vertex and fragment data to the GPU can be done which also adds rendering benefits since accessing that memory rather than simply uploading it every frame will save you a lot of time.

You will need to learn how to classify spaces which involves linear algebra, vector algebra, and all kinds of geometry.

The easiest way to classify a space is to divide into a half-space which involves a plane. Learn about planes first and then learn about scene classification and computational geometry and take it from there.
 
  • #15
Would it be easier to use java libraries to make code for 3D rendering?
@Filip Larsen Are you referring to developing game engines from scratch or using existing/downloaded java libraries?
 
  • #16
I wouldn't use Java libraries unless they have been compiled in something like C++ and optimized with direct calls to graphics interfaces (like OpenGL).

If you have all the optimized code done properly then Java may be OK. If you don't then you will be looking at a really bad slide-show as opposed to a smooth rendering of your virtual environment.

I would suggest you learn C++ and get one of the many engines available and use/modify that particular engine and scripts that they use.

Developing engines from scratch take years and its often better to find a well developed one that is easy to modify for your purposes and go that route.
 
  • #17
There are some pretty good 3D engines out there which are very efficient, which means there is need to do all the work from scratch.
However I realize that promoting a particular one could get me in trouble, so I'll just mention that one of the best ones is actually free if you are not a commercial organisaton.
The free version has limitations of course, but almost everything you need to get started and a long way beyond that are there
A bit of googling will probably get you to what I am referring to.
 
  • #18
icecubebeast said:
Would it be easier to use java libraries to make code for 3D rendering?

Yes, using a suitable library will be the easiest way to draw a 3D scene in any language, including Java. Likewise, using a game engine will be the easiest way to make a game (with a game engine being more of a framework and typically contain much more support for games than just the 3D rendering libraries).

icecubebeast said:
Are you referring to developing game engines from scratch or using existing/downloaded java libraries?

I was commenting on the notion seemly made by several posters here, that using an engine or a library is a "bad thing". Yes, using a particular engine or library may easily have some negative issues associated (not necessarily all of a technical kind) which anyone using them would be wise to be aware of, but you still get a lot more than if you have to develop this yourself from scratch. And even more so if the engine or library is free or open source.

I would recommend that you find a library or engine that supports what you want to do or learn about, without forcing you to handle issues you do not want to learn about. For instance, if you are comfortable with Java and just want to learn how to render a 3D scene in Java then by all means choose a Java library like Java3D [1,2]. It won't get you an industry-strength game engine but if you are just trying to learn about 3D then it may not matter much since virtually any library have to map to a standard like OpenGL [3] or Direct3D [4] anyway. If language is not important to you then, as been said a few times already, you will probably have more libraries and engines to choose from if you go with C++ (for engines, see the list [5] I mentioned earlier).

And, of course, feel free to combine this with a good textbook on 3D game graphics if you want to dig into some of the algorithms. I remember 3D Game Engine Design [6] as a good algorithm book even if the title is somewhat miss-leading.[1] https://en.wikipedia.org/wiki/Java_3D
[2] https://java3d.java.net/
[3] https://en.wikipedia.org/wiki/OpenGL
[4] https://en.wikipedia.org/wiki/Direct3D
[5] http://en.wikipedia.org/wiki/List_of_game_engines
[6] 3D Game Engine Design, Dave Eberly, Taylor & Francis, 2007
 

Related to How to create game that renders 3D objects fast?

1. How important is choosing the right graphics engine for rendering 3D objects in a game?

The graphics engine is the foundation of any game and plays a crucial role in rendering 3D objects. It determines the overall performance, quality, and speed of the game's graphics. It is essential to choose a graphics engine that is optimized for 3D rendering and has the necessary features and tools to achieve the desired results.

2. What techniques can be used to optimize 3D object rendering in a game?

There are several techniques that can be used to optimize 3D object rendering in a game. These include using LOD (Level of Detail) models, implementing culling techniques to avoid rendering objects that are not visible to the player, and utilizing modern rendering pipelines such as deferred shading or forward+ rendering. Additionally, implementing efficient memory management and using texture atlases can also improve rendering performance.

3. How can hardware acceleration be utilized to improve 3D object rendering in a game?

Hardware acceleration, also known as GPU rendering, can significantly improve 3D object rendering in a game. By offloading rendering tasks to the graphics card, it allows for faster processing and better overall performance. Additionally, utilizing the latest hardware features, such as tessellation and compute shaders, can further enhance the quality and speed of 3D object rendering.

4. What role does the game's programming language play in fast 3D object rendering?

The programming language used to develop a game can have a significant impact on the speed of 3D object rendering. Low-level languages such as C++ or Assembly are generally more efficient for this purpose compared to high-level languages like Java or Python. However, the choice of language also depends on the game's specific requirements and the developer's expertise.

5. Are there any trade-offs between fast 3D object rendering and overall game performance?

There can be trade-offs between fast 3D object rendering and overall game performance. For example, implementing advanced rendering techniques and features may improve the speed of 3D object rendering but can also put a strain on the game's overall performance. It is crucial to find a balance and prioritize which aspects of the game require the most optimization for the best player experience.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
Replies
2
Views
983
  • Programming and Computer Science
Replies
2
Views
1K
Replies
1
Views
245
  • Programming and Computer Science
Replies
8
Views
2K
  • Classical Physics
Replies
21
Views
1K
  • Art, Music, History, and Linguistics
Replies
7
Views
2K
  • Programming and Computer Science
Replies
23
Views
2K
  • Programming and Computer Science
Replies
4
Views
787
  • Introductory Physics Homework Help
Replies
3
Views
662
Back
Top