Jump to content
  • Advertisement
Sign in to follow this  
sanosuke001

Textures and Lighting

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

Hello, I created a TriangleStrip terrain and am trying to apply a texture to it. Before, I was using a CustomVertex.PositionNormalColored and it was fine. I then changed it to CustomVertex.PositionNormalTextured and with lights off I can see the texture fine but turning lights back on, the lights that worked fine with the Colored terrain, now displays as straight black. Is there anything else that needs to be done other than setting the texture to the device?

Share this post


Link to post
Share on other sites
Advertisement
You need to set a material to tell directx how to reflect the light off of the surface. I've not totally mastered how setting a material works but I've successfully made one by setting Ambient/Diffuse/Specular and Emissive Coloring values along with an Intensity Power level.

Hopefully someone else can offer more knowledgeable advice on setting up materials especially in light of a terrain system which obviously will not have pink or orange material (laughs).

edit: Although I just tried this on my latest demo project and the only section that successfully utilises the light are the mesh demo objects. Whether or not I add Normals to my PosTex objects they ignore the lighting but then I am also using effect files which I am currently having problems working with lighting with so could be the cause in my case.

Share this post


Link to post
Share on other sites
Yeah, you have to set a material first and make sure your renderstate modulates between CURRENT and TEXTURE.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!