Draw calls and Defold

Brilliant post! Thank you!

2 Likes

thank you. I’ve used render hell before and it’s really nice tutorial with cool animations.

By the way. Are you planing to add virtual container to the gui. It’s a boxes with no content. I use them to align internal elements, currently i set alpha - 0 for them.
And also related issue with transparent pixels is slice9 textures. if it’s possible to add option “do not show center area”

2 Likes

@sicher I can’t find this :point_up: information in manuals.
Maybe has the meaning to add ? I think it would be very useful.
What do you think?

3 Likes

Yes! I’ll make a note.

2 Likes

This definitely cleared some things up for me, thank you!

2 Likes

As of Defold 1.2.106 this is no longer true. Instead of issuing one drawcall per emitter, we now batch on:

  • Emitter material
  • Texture (tile source)
  • Blendmode
  • Render constants
7 Likes

@britzl wrote a nice summery here How to "merge" sprites in defold here is a blatant copy of it!


To clarify:

Rendering of sprites, spine models, particle fx etc

  • Rendering is based on z-order, back to front.
  • Components on different depths will be batched unless one of the following is different from the previous component:
    • Component type (sprite, spine, particle, label, model)
    • Texture
    • Material
    • Blend mode, tint etc
    • Collection proxies
    • Note: Each particle emitter will result in a draw call

Rendering of gui scenes

  • Rendering is based on the order of the nodes in the outline, depth first
    • Nodes will be batched unless one of the following is different from the previous node:
    • Node type (box, text, pie)
    • Texture
    • Blend mode
    • Font
    • Stencil settings

Layers are used to group different nodes to reduce the number of draw calls. Some images:




Example of the complexity stencil add

A basic scene

Same scene with a stencil

12 Likes

Does somebody can to explain why?

In gui the color is sent as vertex attributes as opposed to uniforms (I’m quoting Sven here).

3 Likes

Thank you, as I thought. And I have been to look into shaders before ask =)

1 Like

And why is that? You could have the possibility to set vertex attributes for sprites as well to be used for tinting (or other things) in the sprite shader as well.
Or do you use them internally for something?

1 Like

Good question! @sven?

2 Likes

Could you post your overdraw shaders?

If we could get the ability to set tinting / alpha with sprites in a way which didn’t break batching it would be super great.

The answer to that is customizable vertex formats, which I think is on our roadmap for this second half of this year. (@britzl knows more)

3 Likes

The one I use are available in DefFX

4 Likes

agree,
sprite tinting is required to create a retro lighting like the old X-Com, for example:
ufo_041

2 Likes

Yeah, it’s in our roadmap. Not sure when we’ll tackle it, but if I’m guessing it’s somewhere in December or January.

6 Likes

Hi! When are you planning on fixing the issue(batching tint and other)?

1 Like

We mentioned custom vertex formats in our most recent Roadmap Post. We’re slightly behind in terms of what we had hoped to deliver by now due to in part some stability issues during the autumn and in part because of internal needs that was given higher priority. The roadmap post is still accurate, but I will post an update in beginning of January with some updates.

5 Likes