SpaceWars - can you work around Shader limitations?

Two days ago I started working on the XNA framework.
This is also the first time I've had any dealings with C# or DirectX.

I got the first game tutorial working pretty easily, but I couldn't get the SpaceWars starter kit to run properly.

Firstly, I had to set AllowMultiSampling to false (this is a known, and widely discussed problem), and also switch to keyboard mode. With this done, the game ran, but I could not see some of the graphics (ships, backdrop & bullets) in either retro or evolved mode. Score and explosions appeared ok.

As far as I can tell, this is because the missing graphics are using CompiledEffect shader objects which are loaded from the FX files. My poor graphics card (Nvidia GeForce 440MX) doesn't support any shader models, so consequently the graphics cannot be drawn.

My question is as follows:
How hard is it to convert SpaceWars to use non-Shader model effects
I mean, at the moment, even the retro-graphics don't draw, and this seems a bit odd since they are just lines ... is it not possible to "unplug" the effect, or draw the line list primitives with some basic effect setting instead

I've had a bit of a play commenting out the effects, etc, but so far this doesn't make anything in the game appear (I suspect that you do need *some* kind of effect to make the lines appear at all, but I haven't had a lot of time to investigate).

So - any ideas




Answer this question

SpaceWars - can you work around Shader limitations?

  • Burnt1ce

    The shaders are being used to orient and colorize the output. Seeing that the fixed function pipeline functionality has been removed, your prob not going to be able to remove the shaders and make the game function. There may be a chance you can covert all of the shader 2.0 files to 1.1. If your card supports shader 1.1 and you want to solely do 2D drawing, i'd suggest checking out the SpriteBatch object. It should allow you to do what your asking.

  • GLutz78

    In a shader based platform like XNA, shaders are essential to draw anything at all. They control where on the screen the graphics appear, and what color it is. So if you don't have any shader, you'll get nothing at all on the screen!

    Simple shaders may do no more than saying "look at this object using this camera, and color it red". That sort of thing will work even on 1.1 shader hardware like the GeForce3, but not on cards that don't support shaders at all.

    More advanced shaders that do fancy lighting and shadowing calculations will need a more recent graphics card that supports shader 2.0 or 3.0.

    The shaders currently used in Space War are model 2.0. The XNA Framework does support 1.1 shaders, so Space War could be modified to work with those, but it is impossible to run any XNA code on machines that have no shaders at all.


  • Scott E Johnson

    Shader support is a requirement to run the XNA framework, as the fixed function pipeline is no longer supported.
  • Adam Anderly

    Hi,

    Thanks for this.

    I am trying to understand the role of the shaders in Space Wars, and where exactly my lack of shader support is impacting (for example, I can do some things, like moving simple textures around).

    Do these compiled Effects just add nice features to the underlying primitives, or are they actually fundamental to the drawing in the first place For instance, I stripped out the references to the Effects in the retro-version of the code. I hoped I might see raw primitive vectors still being drawn, but instead I still got nothing ... so I thought maybe the vectors need to go through some kind of shader to become visible. Am I misunderstanding the way shaders work



  • dhanezep

    With no shader support at all (GeForce 4 series are DX7 cards) you are out of luck.

    There has been some talk that it could be possible to write the SpaceWar shaders to 1.x rather than the 2.x they need now, but for the demo release we did not do that.

    Your only choice is to but a new card.



  • SpaceWars - can you work around Shader limitations?