Godot: 2D rendering optimizations for 2.x

Created on 2 Nov 2016  Â·  12Comments  Â·  Source: godotengine/godot

I'm optimizing the 2D rendering. I was aware that my work would probably never get merged due to Godot 2.2 skipped and the new renderer for 3.0 will probably be already better optimized than the current.

At least it would be of use in my currently developed game until the Godot 3.0 version compatible with GL ES 2.0 were released.

But now I know Godot 2.1.1 will see the light of the day, tomorrow probably. So there is still a chance for my work to become official and get merged in an official Godot release. Probably I'm too late for 2.1.1, but is there any hope of a 2.1.2 or 2.2 release?

Of course, first I have to complete the task (one or two days I expect) and check it the performance gain worths it (provided there is actually some gain; you never know).

Also I would like to know if people are interested in this being released.

discussion enhancement rendering

Most helpful comment

I think I have bad news. After more than a month of work, I re-implemented de 2D drawing applying a number of techiques.

I tried different approaches measuring on PC and mobile to try to find the fastest way of doing things and I researched a lot.

Anyway, my final implementation has ended up being a bit slower than the original. It does a lot of book-keeping, probably adding too much work for the CPU. It also adds some RAM overhead. It would worth it if it would have taken us to an overall faster rendering, but it hasn't.

So this has been a big waste of time. At least, I learned a couple of things about how GL driver and hardware works.

Anyway, if anybody wants to try it for himself, you can find by branch here: https://github.com/RandomShaper/godot/tree/exp-optimize-2d-render

It's based on _master_, though I think the relevant commits could be cherry-picked for the _2.1_ branch.

All 12 comments

What are these optimizations exactly? Somebody is working on a 3ds port at
the moment, they'll probably benefit from this

On 2 November 2016 at 15:56, Pedro J. Estébanez [email protected]
wrote:

I'm optimizing the 2D rendering. I was aware that my work would probably
never get merged due to Godot 2.2 skipped and the new renderer for 3.0 will
probably be already better optimized than the current.

At least it would be of use in my currently developed game until the Godot
3.0 version compatible with GL ES 2.0 were released.

But now I know Godot 2.1.1 will see the light of the day, tomorrow
probably. So there is still a chance for my work to become official and get
merged in an official Godot release. Probably I'm too late for 2.1.1, but
is there any hope of a 2.1.2 or 2.2 release?

Of course, first I have to complete the task (one or two days I expect)
and check it the performance gain worths it (provided there is actually
some gain; you never know).

Also I would like to know if people are interested in this being released.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/7017, or mute the thread
https://github.com/notifications/unsubscribe-auth/AGVmPeJRsZA9Yi75RqMu2MIo8DucSo7iks5q6NzPgaJpZM4Knnr0
.

As you know, Godot 3.0 is based on GLES 3.0 and about 45% android devices are still use GLES 2.0.
So, I would use 2.x version for production until 3.x released which support GLES 2.0 also.

I think there's a possibility for releasing 2.1.x with your optimization if it's good enough. :)
And there would be some people stick to 2.1.x for released game.

What a quick feedback! Knowing some people is interested encourages me.

I'm attempting thsee optimizations:
1) Use VBOs for primitives like lines and, the most relevant, rects. That with a cache. I hope the cache code is faster than submitting vertices and UVs on every draw.
2) Front-to-back rendering with depth buffering.

I don't want to give false hopes, but I think at least these deserve a try.

As I mentioned, there will be 2.1.x releases until we decide not to support it anymore (i.e. until 3.x is ripe enough to take over for 99% of use cases). There won't be a 2.2.

Is this optimization will fix jittering/stuttering bug that occurs in 2.1? That would be really nice if you can get it fixed.

Jittering can be due to a number of different things. I can't tell you
what I will be able to achieve.

El 04/11/2016 a las 13:23, JustDevs escribió:

Is this optimization will fix jittering/stuttering bug that occurs in
2.1? That would be really nice if you can get it fixed.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/7017#issuecomment-258417688,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALQCtuf2mkKTCewzEQIdZ6sVUorgUrDkks5q6yPAgaJpZM4Knnr0.

I'd say its related to your own code, but it's difficult to know without
knowing more about your scene.

I was able to fix my sprite jittering by following this rule of thumb:

  • physics = _fixed_process
  • everything else = _process

I think I have bad news. After more than a month of work, I re-implemented de 2D drawing applying a number of techiques.

I tried different approaches measuring on PC and mobile to try to find the fastest way of doing things and I researched a lot.

Anyway, my final implementation has ended up being a bit slower than the original. It does a lot of book-keeping, probably adding too much work for the CPU. It also adds some RAM overhead. It would worth it if it would have taken us to an overall faster rendering, but it hasn't.

So this has been a big waste of time. At least, I learned a couple of things about how GL driver and hardware works.

Anyway, if anybody wants to try it for himself, you can find by branch here: https://github.com/RandomShaper/godot/tree/exp-optimize-2d-render

It's based on _master_, though I think the relevant commits could be cherry-picked for the _2.1_ branch.

Uhm, given the above comment and the fact that this issue is getting a bit stale, should it be closed?
(i.e. "Pretty bump")

For me closing this is OK.

I expected some feedback about how my code performed for other people, but yes, this is not getting anywhere.

@akien-mga This can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bojidar-bg picture bojidar-bg  Â·  3Comments

blurymind picture blurymind  Â·  3Comments

nunodonato picture nunodonato  Â·  3Comments

RebelliousX picture RebelliousX  Â·  3Comments

gonzo191 picture gonzo191  Â·  3Comments