Jump to content
  • Advertisement
Sign in to follow this  

Shader Issue

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

I'm working on a particle system for a game and am having trouble getting the particles to draw. I'm rather new to DirectX and game programming in general so I have a limited knowledge on this stuff. My question is whether or not shaders play nice with the fixed-function pipeline? The majority of this game is written using fixed-function and FVF codes. I'm following an example from a book that uses shaders exclusively, so I'm curious if some shortcuts were taken in the code that will not work when the use of pre-transformed vertices is present. Sorry if I didn't provide a lot of information but mainly I'm wondering if I can use shaders with fixed-function? Thanks!

Share this post

Link to post
Share on other sites
Shaders (DX Effects) play nice with the FFP. However, pre-transformed vertices skip a lot of the rasterisation process which would explain why you're having difficulties with your shaders.

Can you give more details on what you're trying to do?

Share this post

Link to post
Share on other sites
Well, I have several basic things going right now. To give some examples, I'm drawing some terrain, I have placed a few models on top of it, I have lighting working, and a camera that can be rotated around a given position. This is all done using the FFP.

Now I'm working on a particle system. As I said I'm working from an example out of a book. The book I'm using can be found here http://www.amazon.com/Introduction-Game-Programming-Direct-9-0c/dp/1598220160

He uses shaders exclusively in his examples. He provides source code but I built mine from the ground up using his code as merely a guide so I could be sure it would fit in my project (not to mention, so that I could understand how to manipulate it better).

When I run the app I will setup the graphics, at which stage I create a pointer to the vertex declaration.

When I set up the particle system, in the constructor I initialize the vertex buffer, create the effect from the file, obtain handles to the variables in the .fx file, and perform any other initialization the system needs (set the technique, the texture, etc.).

Here's the steps I take each frame regarding the Particle System, in a nutshell and highly simplified:

-update view and projection matrices for the camera
-Draw terrain, models etc.
-Update the particle system and call its draw method
-Inside draw I set the variables in the .fx to which I obtained handles. I will pass in world*view*projection matrices so that's all taken care of. I then set the stream source to my vertex buffer, set the vertex declaration to the one I created, and take the necessary steps to render (begin pass, render points, end pass, etc.).
End Scene, Present etc.

So I feel like I have a good understanding on how to render using a shader. I'm just completely stumped as to why none of the particles draw when the rest of my scene draws fine using the FFP. Can you spot anything noticeable that I may have missed?

Please let me know if you would like me to expand further.


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!