1
\$\begingroup\$

Is it possible to overlay one texture over another and make them into a new texture? It should also work with an offset.

Here's an example:

This texture

and this texture

should make this texture

It should be possible to change the position of one texture.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ How do you intend to use the "new" texture? I think that makes all the difference in what kind of answer will be useful to you. \$\endgroup\$ Apr 19 '13 at 15:26
  • \$\begingroup\$ It should be ingame possible to change the position of one of the textures and that means I nead a method that combines the 2 textures to a third one but with a offset. \$\endgroup\$ Apr 19 '13 at 15:30
  • \$\begingroup\$ Right, but once you have a new texture, what are you going to do with it? If the question is "is possible?", the answer is almost always yes. But that doesn't answer the question "should I?" \$\endgroup\$ Apr 19 '13 at 16:04
  • \$\begingroup\$ There's no other solution. I need to change the texture, so I can attach it to a 3D model. \$\endgroup\$ Apr 19 '13 at 16:12
  • \$\begingroup\$ There are nigh-innumerable ways to alter a model's texture. Why don't you elaborate on what you're trying to do, so that people might be able to offer you a different solution? \$\endgroup\$ Apr 19 '13 at 22:44
0
\$\begingroup\$

I see a couple ways to do this when I first think of it. Here's how I would take my first stab at it.

  1. Create a RenderTarget that you can draw to. (Make it the size of the "base texture")
  2. Draw your base texture on the RenderTarget so it fills it up.
  3. Draw onto the RenderTarget again if needed; you can use SourceRectangle and DestinationRectangle on the SpriteBatch overload to accomplish this.
  4. You can then save or use this texture inside your game.

Seems simple enough.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.