• Advertisement
Sign in to follow this  

using the EffectPool

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

hi, i'm creating my effects like this: EffectPool effectpool; effect = Effect.FromFile(dev, Global.settings.InstallPath + @"resources\" + effectMaterial.FXFile, null, null, ShaderFlags.None, effectpool, out errors); Each material on my mesh creates an effect. i.e. I would like to set the world matrix on my mesh once and not for each material... this is not working. Any idea what i'm doing wrong? BTW, I found it odd that to use the effectpool we had a declare a variable for it. I was assuming we would just set the parameter to "true" to enable shared params. Maybe this is a source of my problems. V.

Share this post


Link to post
Share on other sites
Advertisement
actually, I had done this. just forgot to put it.

EffectPool effectpool = new EffectPool();

...

effect = Effect.FromFile(dev, Global.settings.InstallPath + @"resources\" + effectMaterial.FXFile, null, null, ShaderFlags.None, effectpool, out errors);


edit: Basically, I don't understand what the effectpool object is used for besides internally on the video card.


I have 2 effect files. Both use "ViewI". Setting ViewInverse on one variable does not set it on the second effect...

Share this post


Link to post
Share on other sites
You must also mark the effect's global variables with the "shared" keyword in order to place them in the pool.

Share this post


Link to post
Share on other sites
Ah. Perfect.

Thanks.


By the way, it looks like im going to have to create a dummy effect to apply my shared effects. Is there a better way?

Share this post


Link to post
Share on other sites
The effect pool will automatically share the parameters with same name, type and semantic across multiple effects. You could use a common include file which declares all the global effect variables, and include it to every effect file.

You can also create a dummy effect if you want, though. It's a matter of preference, mostly.

Share this post


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

  • Advertisement