Sign in to follow this  

How are you using Effect Pools? (and do you at all?)

This topic is 4305 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 was using ID3DXEffect interface for quite a long time now. It's all very nice, yep... but I was using only its basic functionality. Now I want to give a try to all other interesting stuff, like shared parameters, annotations, and what not. [grin] So about the pools. From my understanding, if several of my effects are in one pool, and they all have parameter view_matrix, or curr_anim, or source_alpha, or light0_pos... then it is enough if I set the appropriate values to any one of the effects, and all other can use it. That's simple. But when do I set it? And to which one of these effects? Imagine I got some amount of objects to render, and that they use some amount of different effect. Now, some algorithm decides the order of the drawing, and I draw the objects from, say, a given list, or walking through a scene-graph. At some point I would have to pass the lightning parameters to all the effects, and it could be through any of the effects (that use lightning, of course). I was thinking: before the entire rendering begins, I have to choose any one effect from the pool, that uses lightning, and set the appropriate variables. That seems rather clumsy, since I have to know which effects requre which parameters being outside the rendering context :( How do you handle pool-usage issues? And also, do you have any sources on how to use all the fancy stuff from effect interface? I don't mean how to use them, I mean what could I use them for. I've seen Render Monkey, and how it extracts parameters from a shader and based on that, builds a GUI to control them. Sweet. Any other ideas? Cheers. ~def

Share this post


Link to post
Share on other sites
I second that question. My engine was planned to make use of effect pools, but somehow I forgot that ;) So it would be interesting to know how to effectively use them and actually start that.
As for the "fancy stuff" from the effect interface:
What do you mean by that? I´m currently "parsing" my effects for variables, checking whether they´re used for a specific technique in that effect, and store the retrieved technique-variable-relation in a class of mine. This class contains the D3DXHANDLEs for the variables needed for that technique so I can quickly set all needed variables in the render pass. This could be of course extended with usage of effect pools, so I´m a bit clueless about how to integrate those pools effectively, which is why I second your question ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by matches81
As for the "fancy stuff" from the effect interface:
What do you mean by that? I´m currently "parsing" my effects for variables, checking whether they´re used for a specific technique in that effect, and store the retrieved technique-variable-relation in a class of mine. This class contains the D3DXHANDLEs for the variables needed for that technique so I can quickly set all needed variables in the render pass.


Is there anything, beyond pure optimisation, that you use the knowledge of the variables in an effect for?
I gave the example of RenderMonkey, even some of the DX examples do the same: use the informations in variable's annotations to create a GUI element specific to that variable's requiments (be it a slider, a checkbox, or a edit control). Variable can also be saying names of textures that it would require to use, or it could be some fixed names of dynamic resources created in the game on the fly (like environment map). Those are just simple examples. I can't produce better ones, because that was one of my original questions[grin].

Share this post


Link to post
Share on other sites
yeah, I actually do use either variable names or semantics, perhaps annotations later (have look into that first), to determine whether this variable for example is used as the world, view, projection, world-view, view-projection or world-view-projection matrix, should be transposed or inverse. In fact I do read out every matrix requirements the technique has, as long as either semantic or name are as expected for the corresponding matrix. Textures will be used in the same way, i.e. I´ll use a pre-defined name for color texture, normal map and specular map so I can read that out and set it accordingly in the engine.
Erm.... yes, I guess that´s about it for now. Though I guess as soon as I implement lighting I will define a set of names, semantics or annotations to use for them as well, so I´m able to do the same I do for matrices and textures for lights. Though my application is (or will hopefully be) a 2.5D action-adventure, so there is no need to generate something like sliders or anything like that for the variables, I guess that should be quite possible to do once you know what kind of variable you have and what it is used for.

So essentially I define a set of names, semantics and/or annotations to use in order to identify "special variables" like matrices and textures for example.

Don´t know if this is a good solution, yet currently it works.

Share this post


Link to post
Share on other sites
Quote:
Original post by matches81
So essentially I define a set of names, semantics and/or annotations to use in order to identify "special variables" like matrices and textures for example.


To be honest, I pretty sure all this falls into 'semantics' category. No usage for annotations at all :/


And for the original question:
does nobody use effect pool at all? Since I got the impression that that interface is for nothing!

Share this post


Link to post
Share on other sites

This topic is 4305 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.

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