Writing a Custom BasicEffect
Tutorial 7
This entry was posted
on Wednesday, September 17th, 2008 at 1:00 pm and is filed under XNA Tutorials.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
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.
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:
http://www.thehazymind.com/smf/index.php?topic=271.0
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?
There will be now
haha, gw
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.
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?
Got it from the svn at revision 162.