XNA Procedural Textures

I am trying to make procedural textures in my XNA 4.0 game, mainly for buttons, but also for other textures. Here is an image describing what I want:

enter image description here

I hope you understand what I want to do, if you do not, there are a few words: I want to create objects in my game. These objects will use the same texture, but can be changed and their texture will not be changed, so the pixels will be โ€œstretchedโ€, but will be placed in the procedure.

+4
source share
2 answers

The general way to do this is to have one texture for the middle, 4 for each corner and 4 for each edge. The vertical edges and midpoints will be stretched vertically, and the horizontal edges and slice will be stretched horizontally.

You can pack it in 1 texture for easy editing. You define angles and edges implicitly with a boundary distance that will define parts of the texture that should not scale.

+3
source

I would recommend you split the textures into 5 textures. One for each side and one monochrome texture. You simply stretch one color texture and draw frame textures around your stretched color texture.

I hope I can help you.

+1
source

Source: https://habr.com/ru/post/1482755/


All Articles