Skip to main content
gamedev.net
🔒 Locked

Very basic lighting [Resolved]

Started by Mythics Apr 10, 2007 at 4:24 PM 0 replies 450+ views
Original Post
Mythics
Mythics
I'm trying to do just a simplistic ambient lighting effect, and I'm apparently baffled. I'm assuming I'm just lacking the information needed for going to doing my own lighting vs letting D3D handle it all. I'm enabling lighting. I'm setting the ambient light to an RGB value of (100,100,100). (although I've tried several different values to no effect. I'm using
FVF_VERTEX / (D3DFVF_XYZ Or D3DFVF_NORMAL Or D3DFVF_TEX1)

I'm using this as the vertex type:

Public Type VERTEX
    P As D3DVECTOR
    N As D3DVECTOR
    T As D3DVECTOR2
End Type


I'm setting the normals with a function I've seen multiple times throughout the web in my searching, so I'm kind of at a dead end. Everything seems to work fine if I don't enable lighting, but when I enable it, I just get pure blackness. It's rendering everything properly, it's just as if the light isn't actually affecting anything. Edit: I wasn't setting up a material...lol. It's the little bugs that bite the hardest.
Armadon
Armadon
As mentioned in a previous post,
Remember that a light cannot work on its own really. It needs to know what colors to reflect and this is what a material is used for.

From the DirectX SDK Documentation:
"Materials describe how polygons reflect light or appear to emit light in a 3D scene. Material properties detail a material's diffuse reflection, ambient reflection, light emission, and specular highlight characteristics. Direct3D uses the D3DMATERIAL9 structure to carry all material property information. With the exception of the specular property, each property is described as an RGBA color that represents how much of the red, green, and blue parts of a given type of light it reflects, and an alpha blending factor."

I hope this helps.
Take care.

Topic Locked

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

Sign in to reply to this topic.