0
\$\begingroup\$

Let's say we're using DirectX 9/10/11. In our game we have a character wearing armor.

The armor has 50 different color variations. So, if armor is red, the first method would load the red texture from file. The second method would display the 1 base texture, with a red overlay.

Code wise the overlay armor would just contain an extra flag that would specify color.

Is it faster / more efficient to load different textures in? Or, is it faster / more efficient to color the texture on the fly?

I'm not aware if there is some huge overhead for dropping a tint over a texture...

\$\endgroup\$
0
\$\begingroup\$

Technically, using overlays would require less memory, and loading all the different textures would require less computing every frame. Knowing which one is more efficient can be difficult because it depends on the circumstance, on what you prefer.

However, textures are really big and overlays may use hardware acceleration which is very fast. So I would recommend the use of overlay.

I didn't manage to find the info about DirectX 11. I can't find the documentation. I found that Direct 3D uses hardware to perform the overlay operations. If someone has the info please edit my answer.

\$\endgroup\$
  • \$\begingroup\$ I didn't want to appear too generic which is why I mentioned DX11, this is what I was hoping for, thanks for the answer! \$\endgroup\$ – Joe Swindell May 16 '14 at 14:14
0
\$\begingroup\$

Since i cant add a comment ( i dont have 50 reputation) i post this: if i have understand the question and you have to change all the color of the armor you can simple change pixel color in pixel shader passing a value in a costant buffer (es pixel.color.r*=1.5, make sure you aren't using a float render target view). if you change just a part of your texture (ex the cloack of the armor) render first the armor and then a white overlay(1.0f,1.0f,1.0f,1.0f) and multiply it by a color passed with a constant buffer. I think it isn't a good idea load 50 textures for the same oject.

\$\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.