Jump to content
  • Advertisement
Sign in to follow this  
dyerseve

Colors without D3DRS_LIGHTING, that ARENT per-vertex

This topic is 4777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way to specify color's per DrawIndexedPrimitive call without turning on lighting? I don't want to put a color in each vertex, because each vertex in a batch will have the same color. I can specify materials and ambient colors, but these only work when D3DRS_LIGHTING is enabled.

Share this post


Link to post
Share on other sites
Advertisement
D3DRS_TEXTUREFACTOR, which is D3DTA_TFACTOR as a color/alpha arg. Support on any recent hardware (RagePro/XPert98 type cards are notoriously bad at handling it). This is what most people would use if they aren't using shader capable hardware.

If the caps bit for per stage constant is set (only shader capable card SHOULD have this available), you can set a constant color per stage (D3DTSS_CONSTANT) and use D3DTA_CONSTANT to get at it.

You can make a vertex shader (vertex shader emulation for older cards works just fine), set a constant to a color you'd like, and output that as the vertex color.

If supported, you can have invalid texture coordiantes, and use border sampling. I think only nVidia supports border sampling.

Use a 1x1 texture (some hardware requires textures to be 4x4, 8x8, or some other minimum size).

Use a pixel shader. It's easier to learn to emulate the TSS_COLOROP type things in a pixel shader than to emulate the entire vertex fixed-pipe. Just set a pixel shader constant to the color you'd like and use it where appropriate. Of course any card supporting this likely supports per stage constants in the fixed pipe, which may be an easier route to take.

Setting D3DRS_BLENDFACTOR, and using D3DRS_SRCBLEND of D3DBLEND_BLENDFACTOR. It might do what you want. Requires D3DPBLENDCAPS_BLENDFACTOR in the SRCBLENDCAPS (or DESTBLENDCAPS if you're using it there).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!