Lluis B

Hello,

Is it possible to tint programatically a Texture2D with another Texture2D

For example:

  • I have 3 furniture textures: a chair, a table and a cupboard
  • I have 3 material textures: pine wood, teak wood and birch wood

I want to show the chair, table and cupboard in pine wood, teak wood and birch wood.

How can I do in XNA

Thanks in advance

Lluis



Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Arek Bal

What do you mean, behind the furniture texture(maps or what)....maybe some examples

Is this 2D or 3D application

EDIT1:
Think about it ...every pixel have assigned value. By reading streams... You can do with this values whatever you like...(I love This One in programming).

So answer is: Yes, you can tint texture by another texture... For more help, provide us with some more information.
EDIT2:
But that's not so easy...Better use some painting App like Paint.net(have .dds plugin). More files but far more easy and efficient.




Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Bill Reiss

If this is a 3D application, you should be able to do it pretty easily using a custom shader, loading the texture dynamically. If it's a 2D application, I think I'd just have more than one copy of the sprite texture already mapped with the different grains.

Bill






Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Lluis B

Thanks for your answers. I will try to be more explicit.

This is a 2D application. Let's imagine that I have a furniture catalogue with 30 different elements and these elements can be made in 10 different types of wood. If I have to use a graphic tool to do the work, I will have to create 300 images which is out of my skill, patience and time.

I was wondering if there is a way in XNA or that can be incorporated in an XNA game, to do it by program, that is, to render the Texture2D that represents the chair and tint it. In my case the tint is a little different from the one provided by the SpriteBatch.Draw (Texture2D, Rectangle, Color) method. Instead of using a color to tint I want to use another Texture2D.

I hope this is now clearer.




Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Bill Reiss

If you use SpriteBatch in Immediate mode, you can set pixel shader effects before drawing the sprite. You could then texture your sprite using the pixel shader. Another option would be to actually use 3D models and pixel shaders and draw them using an orthographic projection, giving the appearance of 2D.






Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Arek Bal

Now it tells something...
You can try this one also..
Help>content>.netFramework SDK>How to and walkthrough >GDI+

How to: Use a Color Matrix to Set Alpha Values in Images.
Recoloring Images and all related.

Much to read. But It's all you need.





Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Lluis B

Hi,

Thanks for your answer. I haven't had much time to look at it but a fast search in Internet have shown me only samples based in generating a matrix by hand. When I have some free time I will look for a sample more similar to my needs.

Best regards

Lluis





Re: XNA Framework Tint programatically a Texture2D with another Texture2D

Lluis B

Hello,

Thanks for your answer. When I have some time I will give it a try.

Thanks

Lluis