Skip to main content
GameDev.net gamedev.net
🔒 Locked

Textures and Lighting

Started by sanosuke001 Apr 9, 2007 at 9:57 PM 2 replies 600+ views
Original Post
sanosuke001
sanosuke001
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?
sano
Xrystal
Xrystal
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.
Byron
Byron
Yeah, you have to set a material first and make sure your renderstate modulates between CURRENT and TEXTURE.
ByronBoxes
sanosuke001
sanosuke001
yah, I just set the device.Material to something and it worked fine. Thanks for the help, guys.
sano

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.