Skip to main content
gamedev.net
🔒 Locked

Colored texturemapped polygons

Started by irreversible Oct 14, 2008 at 10:11 AM 1 replies 600+ views
Original Post
irreversible
irreversible
'lo, I'm stuck with a pretty trivial problem: I want to color-shade my texture-mapped polygon. I know the correct data order for the stream (I'm using a non-FVF stream) and all of the data is correct (including the flags). Moreover, when rendering a shaded polygon, it works as expected and when rendering a texture-mapped polygon, everything works. When I try to render a color-shaded texture-mapped polygon, however, the shading doesn't show - it's like all of the vertexes are white. Perhaps this is different from OpenGL, but is there some other thing I need to do (such as setting the blend mode for some odd reason)?
Namethatnobodyelsetook
Namethatnobodyelsetook
You may be setting you texture stage states to just use texture data, instead of mixing with lighting/vertex color. You want OP = MODULATE, ARG1 = TEXTURE, ARG2 = DIFFUSE, which says to multiply the two together.
irreversible
irreversible
Wait-wait-wait... This means that color shading either a) cannot be applied to bumpmapped surfaces or b) color-shaded bumpmapped surfaces take up 3 texture units. So the texture stages become:

//bump stage
0, D3DTSS_COLORARG1, D3DTA_TEXTURE
0, D3DTSS_COLORARG2, D3DTA_TFACTOR
0, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3

//texture stage
1, D3DTSS_COLORARG1, D3DTA_TEXTURE
1, D3DTSS_COLORARG2, D3DTA_CURRENT
1, D3DTSS_COLOROP, D3DTOP_MODULATE

//shading stage
2, D3DTSS_COLORARG1, D3DTA_DIFFUSE
2, D3DTSS_COLORARG2, D3DTA_CURRENT
2, D3DTSS_COLOROP, D3DTOP_MODULATE

Coming from OpenGL, I find this a bit... unusual :). If not wasteful.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.