Skip to main content
gamedev.net
🔒 Locked

MultiTexturing

Started by manshy51 Oct 31, 2008 at 4:40 AM 3 replies 750+ views
Original Post
manshy51
manshy51
I wanted some objects in my game to be multitextured so i used pixel shader but i want this effect on certain object only. but the effect of multitexturing appeared on every object that are drawn after setting
Device->SetTexture(ShadeTexDesc.RegisterIndex, ShadeTex);
Device->SetSamplerState(ShadeTexDesc.RegisterIndex, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(ShadeTexDesc.RegisterIndex, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
Device->SetSamplerState(ShadeTexDesc.RegisterIndex, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
where ShadeTexDesc.RegisterIndex=2 every other objects drawn after that are multitextured despite that the vertex format of this objects doesn't allow that

struct Vertex
{
	float x,y,z;
	float u,v;

	Vertex(float X,float Y,float Z,float U,float V)
	{
		x=X;
		y=Y;
		z=Z;
		u=U;
		v=V;
	}
	static const DWORD FVF;
};

const DWORD Vertex::FVF =D3DFVF_XYZ|D3DFVF_TEX1;
So does anyone knows the reason or what i did wrong thanks in advace;
Zaph-0
Zaph-0
Hi,

Just an idea, but try your settings only right before the object supposed to be multitextured and do:

Device->SetTexture(ShadeTexDesc.RegisterIndex, NULL);

right afterwards. It would also help to see your shader code (especially pixelshader).

^_^

manshy51
manshy51
Quote:
Original post by Zaph-0
Hi,

Just an idea, but try your settings only right before the object supposed to be multitextured and do:

Device->SetTexture(ShadeTexDesc.RegisterIndex, NULL);

right afterwards. It would also help to see your shader code (especially pixelshader).

^_^


I have tried to do so :) .But when i did all the object drawn after this line are drawn in black color
manshy51
manshy51
i have tried something else that works i have closed the pixel shader after using it
Device->SetPixelShader(0);
ET3D
ET3D
You code has nothing to do with multitexturing, so there seems to me to be some misunderstanding.

Multitexturing means combining several textures in a single pass. This is defined in the pixel shader or texture stages, neither of which you have posted.

Topic Locked

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

Sign in to reply to this topic.