Writing a Custom BasicEffect

Tutorial 7

8 Responses to “Writing a Custom BasicEffect”

  1. crazyhor77 says:

    Hi Shawn, good to see you have your blog up and running again. I have worked my way through most of your tutorials in the past and recently needed to implement my own shader, so I followed your BasicEffect tutorial, which explains things very well.

    I have however tried to implement my own shader based upon the BasicEffect shader which includes texture information from my model. Although it works, the textures seem to get washed out from all the lighting colors.

    I am going for a very white, light shader effect, so of cours everything appears white. How can I combine my textures and lighting so the textures are very clear but well lit?

    P.S Sorry about the novel length post.

  2. mikeschuld says:

    Shawn? who’s that? My name’s Mike ;)

    There is a post in the forums about adding textures to the BasicShader. Check it out here:


  3. crazyhor77 says:

    haha, i wrote without even thinking, i must have had shawn hargreaves in my mind for some reason.

    yeah, i found the info in the forums afterwards, the way i was adding the texture color to the lighting was all wrong, ill be sure to ask questions in the forums from now on :)

    btw, is there a link to the forums from your blog?

  4. mikeschuld says:

    There will be now ;)

  5. crazyhor77 says:

    haha, gw :)

  6. derf says:

    When I compile this tutorial to see it in action, it has an error with the LightDirection variable.

    this is the line of the BasicShader.fx that has the error

    LightDirection = normalize(-LightDirection);

    Gives me error code X3025 Global variables are implicitly constant…

    I should point out I opened in VS2010 and updated to VS2010. This is the only problem with the application build.

  7. mikeschuld says:

    I’ll try it out when I get home tonight and see what the problem might be. Are you using code from the repository (git or the old svn) or just pasting from the pdf?

  8. derf says:

    Got it from the svn at revision 162.

Leave a Reply

You must be logged in to post a comment.

Do NOT follow this link or you will be banned from the site!