blogs.novaleaf.com
The Best Batch

When rendering geometries, of course, most graphics developers know how to implement instancing and do it nicely using whatever technique to speed up their rendering performance rather than traditional single-instance rendering. So, does this mean that we should always draw every object in the game using instancing technique? If not, what should our decision be made based on?


Before answering that question we must realize that there are both cpu and gpu costs we have to pay when rendering primitives. The cpu cost is associated to API call to process primitive which is a fixed cost regardless of size, and the gpu cost is obviously for actual drawing regard to how complex the geometry is. This tells us that drawing a few large meshes might be more efficient than drawing many small ones, yes, might be.


Cpu and gpu are executed in parallel in the pipeline meaning that either of them could be the bottleneck at anytime. It’s our role to find the closest balance point for the workload to reach the maximum performance. Giving a set of mesh instances, as mentioned earlier, drawing them one by one might be more efficient
than batch them or vise versa. Then what should we use as a criteria to decide whether to batch them or not? The answer is triangle count. Let’s have a look at this example,


Suppose that we know that 500 triangles is the best number to make decision in our rendering system that gives the most balance workload to cpu and gpu. This means that if we draw objects that has less than 500 triangles, without instancing, it will be cpu-bounded because there are too many API calls, no matter how fast the graphics card is, the performance will not change. In the other hand, if we draw high poly objects higher than 500, with instancing, it will be gpu-bounded since the gpu has too much work relative to cpu work yet we won’t achieve maximum performance because both workloads are not balanced. This already answers the first question of this article about whether we should use instancing technique everytime or not. The final answer is you shouldn’t.


In summary, we pick a number, in this example 500, to be a target breakpoint where we batch meshes if they have lower poly and not batch if they have higher poly count. Keep in mind that this number is just and example and might be varied depending on many factors like hardware specifications, platform, graphics api, instancing technique used, game logic complexity etc. So how do we find the best number?, the key is measurement. There are many useful performance measuring tools to help you track down the bottleneck of your rendering. Keep experimenting
until you find the best one for your system. In advanced case, you might also want to determine this breakpoint dynamically.

- Thitipong (Nick)

Programmer & Ego

Have you ever noticed the feeling of superiority or a pride of being an awesome programmer?

Even though I don’t have a degree in psychology, I am pretty sure that for most people the more one accomplish in something, the more pride and ego he has. That also absolutely applies to many programmers. For me, I always think of programming as a game which you can never lose. As long as, you don’t attempt to solve things like Millenium Prize Problems. You will eventually find a solution either by code it yourself or google it somewhere.

As time pass by, you solve more and more problems without any problems (as you are an awesome programmer). Here is where pride and ego gradually stacks up in the programmers’ mind without their awareness.
There are a lot of problems associate to this. For example, I once got a comment about my work, of course, just like an instinct, I rejected it instantly and think that my way of doing thing is correct. That made me ignore some of the valuable comments in the past and I was the one who regret it at the end. Even worse ego can, in fact, even change your programming team into a nightmare if it is not deal with.

So, what can we do to prevent that?
In a team perspective, there is many articles out there for helping a team to avoid this problem. Most of them involves with the way to explain and compliment the team. Here is one guideline when you have to program as a team. How about what we can do for ourself as a personal improvement?
For me, I think the key is to avoid taking things personally. Well, this is easier to say than to do it.
Another effective way for me is to find and spend times with genius programmer, then, talk with him in the area he is specialized and realize that how stupid I am. At least, this helps me knowing that I’m not that good. Turn your ego into an inspiration to further expand your knowledge and becomes more opened to fruitful comments and advise.

Give it a try. Or if you have a better idea, I would love to hear it!

Note: I’m surprised when joining at Novaleaf though… Everyone are truly genius, yet, nice environment =)

- Chainan

Higher dimension for collision detection

This is my idea that there should be 4D collision system in future simulation engine for ULTIMATELY ACCURATE collision detection. So at some resting time of this moment, I use it to find information about higher dimension theory.

In this world we may know that we are live in 3 dimension space and forced to live along only 1 direction of timeline. But awesome physicists (such as Einstein) found out that there are 10 dimensions in the universe (by their MYSTERY MYSTIC EQUATION(S) which we, such a foolish people, cannot read and translate it tobe our language) .
The equasions tell them that a particle, like an electron and proton , which is ingredient to make all of us into human object, living in more than 4 dimension.

Warning, don’t just open google to see page about dimension. You may confused with concept of Dimension in Physics and Mathematics (Yes, It’s really different)
I have focus on physics side. Because, like I said, I focus on collision detection. However , the more I have find. The interesting imagination make me gone out of my focus.

And Yes, This blog already go out of what I want to say. So get back and say what I want to say. Then I will talking about theory in next time (if I think someone want to read).
I want to say ,we should compute collision detection in time dimension. then we will have no problem with jumping object between each update.

Nowaday we have ray traced back method to check to make sure that object in our game not  jump pass through another ting in previos update, this is the concept of time dimension collision but it still an incomplete. It can’t check surface and volume. That make me concern on 4D collision.

The easiest idea I have is ,we must make surface into volume in 4 dimensions, And collide those volume with very freaking 4D graph set mathematics theory equation solution or whatever you can name it. Then we get 4D position (bless you we have Vector4 in XNA :D) that is the REALLY PRECISELY contact point in X Y Z and Time.

I can say that. With media that I love ,such as game and comics, make me easier to imagine many physics theory. Include this theory of dimension.
So ,conclusion ,everybody should read comics :D

- Thaina