Advertisement Jump to content
Sign in to follow this  
Amine Dico

Using more fx effect in one quad

This topic is 1819 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

Advertisement

You either draw the quad twice, or you merge the code from both fx files together into a single effect.

Share this post


Link to post
Share on other sites

You either draw the quad twice, or you merge the code from both fx files together into a single effect.

 

thanks for your reply ,i do what you say for draw quad twice , but that doesn't work :(

 

i do the following :

 

effect1 begin(...)

 

            beginPass()

 

              draw_quad()

 

            EndPass()

 

effect1 End()

 

effect2 begin(...)

 

            beginPass()

 

              draw_quad()

 

            EndPass()

 

effect2 End()

 

---------------------------

 

But doesnt work  !!

Share this post


Link to post
Share on other sites

You have to explain what it is that you're trying to do, what the effects are, and what "doesn't work" means.

 

Drawing the quad twice (each time using a different effect) is a solution to what you asked - to use two effects on one quad. The quad is being drawn using two different effects, but this probably isn't what you actually want to do!

 

What's the actual problem that you're trying to solve?

Share this post


Link to post
Share on other sites

I have two effects (blur and bloom)  , My problem is that the first effect is overwritten by the second effect , in final render i see just the second effect

Share this post


Link to post
Share on other sites


My problem is that the first effect is overwritten by the second effect

Then you should probably render the second somewhere else besides on the same render target as the first effect.

Still more information needed to give any more details than that.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

I have two effects (blur and bloom)  , My problem is that the first effect is overwritten by the second effect , in final render i see just the second effect

A solution is to render the first effect onto a 'temporary' texture, then to render the second effect from this texture (not as a render target anymore but as a shader resource) on your final render target.

Share this post


Link to post
Share on other sites

 


My problem is that the first effect is overwritten by the second effect

Then you should probably render the second somewhere else besides on the same render target as the first effect.

Still more information needed to give any more details than that.

 

 

L. Spiro

 

 

I want to combine two post process in one quad.

 

 

 

 

I have two effects (blur and bloom)  , My problem is that the first effect is overwritten by the second effect , in final render i see just the second effect

A solution is to render the first effect onto a 'temporary' texture, then to render the second effect from this texture (not as a render target anymore but as a shader resource) on your final render target.

 

 

I'm using the same texture a the first render target , but finally i get the second effect !!.
can you give me small exemple ?

Share this post


Link to post
Share on other sites

Before the rendering loop :

Create a texture with the same attributes (size, format) as your render target.

 

When rendering :

Render the first effect on this texture as render target.

Render the second effect with this texture as shader resource on your final render target.

 

Here, effect1 result is overwritten by effect 2 result

That's why there's only the second effect 'left' at the end.

 

instead of this :

input->effect1->render target

input->effect2->render target

 

this :

input->effect1->texture

texture->effect2->render target

 

Hope it's more clear ...

Edited by Tournicoti

Share this post


Link to post
Share on other sites

Before the rendering loop :

Create a texture with the same attributes (size, format) as your render target.

 

When rendering :

Render the first effect on this texture as render target.

Render the second effect with this texture as shader resource on your final render target.

 

Here, effect1 result is overwritten by effect 2 result

That's why there's only the second effect 'left' at the end.

 

instead of this :

input->effect1->render target

input->effect2->render target

 

this :

input->effect1->texture

texture->effect2->render target

 

Hope it's more clear ...

 

Thank you man for the fast reply .

 

this what i do :

D3DXCreateTextureFromFileInMemoryEx(engine_device,buffer,size,width,height,D3DX_FROM_FILE,D3DUSAGE_RENDERTARGET,D3DFMT_UNKNOWN,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,D3DCOLOR_ARGB(255, 255, 0, 255), 0, 0, &effect_Texture);



in render i do :

   pixelShader1->SetTexture("textureMap", effect_Texture);
   pixelShader1->Begin()
   for( UINT uPass = 0; uPass < uPasses; ++uPass )
   {
	pixelShader1->BeginPass( uPass );
 	pixelShader1->CommitChanges();

	engine_device->SetTexture(0,effect_Texture);
	
	engine_device->SetStreamSource(0, QUAD_VB, 0, sizeof(SIZE_VERTEX));
	engine_device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
	pixelShader1->EndPass();

   }

   pixelShader2->SetTexture("textureMap", effect_Texture);
   pixelShader2->Begin()
   for( UINT uPass = 0; uPass < uPasses; ++uPass )
   {
	pixelShader2->BeginPass( uPass );
 	pixelShader2->CommitChanges();

	engine_device->SetTexture(0,effect_Texture);
	
	engine_device->SetStreamSource(0, QUAD_VB, 0, sizeof(SIZE_VERTEX));
	engine_device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
	pixelShader2->EndPass();

   }

but that give me the second effect !!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!