NickMcCrea

Hello all,

I'm starting to get to grips with the structure of things, but through all the code I've looked at, all the tutorials etc etc, I'm still not clear on a few things. I've searched these forums pretty exhaustively, but I'll issue the obligatory pre-emptive apology if I've missed something obvious.

Now, to start with, I believe I'm correct in saying that camera position must be set via the view and projection matrices of an effect. Let's take the case of BasicEffect. You get yourself a new BasicEffect, and then you set some nice view/projection matrices. Stick some variables in there and update it and you've got yourself a moving camera, more or less. So far, so good.

Let's say you have a couple of different classes for your own primitive obects. A cube and a sphere. Standard stuff, you might have a class for the objects themselves, and a manager class for handling multiples of these objects. Now, each of these manager classes (CubeManager and SphereManager) have been given their own Draw() methods, which render their cubes and spheres from a list. All very standard.

What I find slightly puzzling is what exactly is the correct use of BasicEffect here. Now, my camera information is stored in the view and projection matrices of my basiceffect. Does this mean you must always use this basiceffect instance in all your draw loops of your various objects How would you accomplish different graphical effects for different objects Using different techniques in different object draw loops

Secondly, although both are possible, do people generally do the effectpasses at the CubeManager/SphereManager end, and just have a simple CubeManager.Draw(cubeList) call in your main game draw loop Or do you have an effectpass loop in your main game class Draw() method I suppose it doesn't really matter...

Finally, onto custom effects, I've seen examples of code where there's a number of different .fx files in use. I'm steering clear of HLSL until I've nailed the basics, but I'm curious as to what is normally done. Multiple .fx files, one each for different objects How is camera position kept constant throughout

Bit of a ramble, this post. I think the problem is that there's something of a gap in the tutorials I've found. Coverage of basicEffect tends to be, well, basic. People tend to move on to simple custom effects for rendering even relatively simple objects. Any answers/hints/tips or handy links would be much appreciated.

Thanks all.



Re: XNA Game Studio Express The Quest to understand BasicEffect continues...

dczraptor

You will need to pass camera info to each different BasicEffect that you use. They are completely independent of one another. You can, and will, use multiple BasicEffects, one for every model that you have. You can change the parameters for each one to get the results you want, and the results will not carry over into the other models' BasicEffects.

Normally, there will be a different .fx file for each type of object that needs rendering. For example, there might be a standard .fx file for normal game objects, another one for terrain, another one for 2d effects, etc.






Re: XNA Game Studio Express The Quest to understand BasicEffect continues...

NickMcCrea

That certainly clarifies things, thanks!