Tiling sprite texture

A kind of sprite that can be resized and when it does its texture is tiled within it without actually stretching the texture - although a property which resizes the texture within it to be larger or smaller would be handy too + ability to change dimensions of the sprite with scripting while not changing the tiling offset. Meant to be used with textures that are made to tile seamlessly. Can be useful with layouts, making level.

1 Like

You can do that with a custom material and the right sampler setting. Check out http://www.defold.com/manuals/material/#_sampler_settings

You won’t get editor feedback through which may be what you’re after?

Yes, to see it in the editor.

I apologize for the bump, but if this is still the way to achieve a tilesprite is there an example somewhere of this custom material and how to use it

I still think the tiling texture would be a useful primitive type to compliment normal sprites / gui nodes.

2 Likes

No update for this request :frowning: ?

Yes and no, we have started working on custom vertex formats which should help with accessing specific per-sprite data in a shader while not breaking batching. To implement the effect you need to know the size of the texture a sprite is using, and there’s certainly several ways of achieving it currently depending on your needs.

4 Likes

Hi, after one year :rofl:, there’s no update? :cry:

I would say this is the last beta release, if I understand correctly. Clearly @jhonny.goransson may confirm this.

Yes you can put whatever data you need into vertex attributes, including texture or atlas region sizes.

Sorry, what do you mean? Have I to follow the same steps to make tiled sprites? There’s no builtin GUI system like a flag or configuration to activate this? :frowning_face:

Here’s the manual entry for attributes:

In the last beta we added functionality to write attribute data via go.set (and get it via go.get) so it could used to implement tiling.

1 Like

Correct. There is no automated way of doing this (yet). It might be something we add at some point. Or maybe a material that does this for you (not sure if it is possible).

1 Like