Sign in to follow this  
Thergothon

Fixed function texturing help

Recommended Posts

Thergothon    160
I know how to do this with shaders, but I can't figure out how to set up all the render states and texture stages to get this working with the fixed function pipeline. What I want to do is apply a diffuse colour to vertices using an alpha mask from a texture file. This is what I have, but it doesn't work.
	d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	d3d_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	d3d_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

	d3d_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
	d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
	
	d3d_device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
	d3d_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);

Thanks s.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Lets just hope ntnbet picks up on this thread - he's usually pretty hot on the fixed function texture cascade [cool]

I'm pretty sure you need to get a D3DTOP_MODULATE (or D3DTOP_PREMODULATE) in there somewhere. Maybe even:

D3DTSS_COLOROP = D3DTOP_MODULATE
D3DTSS_COLORARG1 = D3DTA_DIFFUSE
D3DTSS_COLORARG2 = D3DTA_TEXTURE


??

Writing these out on paper always helped me prior to ditching FF effects.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Lets just hope ntnbet picks up on this thread - he's usually pretty hot on the fixed function texture cascade [cool]
I'm struggling with the idea that someone who knows shaders is voluntarily adding fixed pipeline support. Unless a publisher makes you do it, stay away! Once the GeForce4MX and GeForceFX series are considered completely outdated, we can finally rejoice in pure shader glory. (Seriously, we just added fixed pipe support to a game because the FX series cards pixel shaders are way too slow).

Share this post


Link to post
Share on other sites
Thergothon    160
I totally agree, I hate fixed function. I'm just making a game where the minimum spec is my brothers computer. Unfortunately he has some ancient video card with no shader support.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this