Discussion:
Point Light Diffuse Color Issue
(too old to reply)
DJTN
2009-06-12 20:27:01 UTC
Permalink
I have a light set up as a Point Light and I can change the color to basic
colors only (i.e red, black, white, blue) but when I try to change the
deffuse color to like orange or a custom color it reverts to white or some
weird color thats not even close. If I switch the light type to a spot light
or directional type I can change it to what ever color I want. My code is
pretty basic:


//begin code

ColorDialog cd = new ColorDialog();
cd.AllowFullOpen = true;
cd.FullOpen = true;
cd.ShowHelp = false;
cd.ShowDialog();

device.Lights[0].Diffuse = cd.Color;
device.Lights[0].Update();

cd.Dispose();


//end code

For example, if I select the top left color (salmonish color) in the color
picker dialog, the light reverts back to white. But if I open it again and
choose red or blue or green or black, it changes it to the selected color.

Is this how the point light functions or am I implementing the light
incorrectly?


Todd
legalize+ (Richard [Microsoft Direct3D MVP])
2009-06-12 22:18:37 UTC
Permalink
[Please do not mail me a copy of your followup]

Are you testing this against a white surface? Lights by themselves
don't render anything, you can only see the effect of changing a
light's color by observing how a surface is colored in response.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
DJTN
2009-06-14 17:21:01 UTC
Permalink
Post by legalize+ (Richard [Microsoft Direct3D MVP])
[Please do not mail me a copy of your followup]
Are you testing this against a white surface? Lights by themselves
don't render anything, you can only see the effect of changing a
light's color by observing how a surface is colored in response.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
Yes, I can change the diffuse color of the material in the mesh to
color.white and the light still only works with primary colors. Does the
ambient light work the same way as you described above? The reason I ask is
that the ambient light will change the mesh to any color I choose, only the
point light has this issue.

Thanks for your reply Richard,
Todd
legalize+ (Richard [Microsoft Direct3D MVP])
2009-06-14 19:50:47 UTC
Permalink
[Please do not mail me a copy of your followup]
Post by DJTN
Yes, I can change the diffuse color of the material in the mesh to
color.white and the light still only works with primary colors. Does the
ambient light work the same way as you described above? The reason I ask is
that the ambient light will change the mesh to any color I choose, only the
point light has this issue.
The lighting model and how it computes the final color is covered in
Chapter 8. Lighting and Materials from my book:
<http://www.xmission.com/~legalize/book/download/08-Lighting%20and%20Materials.pdf>
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
legalize+ (Richard [Microsoft Direct3D MVP])
2009-06-14 19:50:47 UTC
Permalink
[Please do not mail me a copy of your followup]
Post by DJTN
Yes, I can change the diffuse color of the material in the mesh to
color.white and the light still only works with primary colors. Does the
ambient light work the same way as you described above? The reason I ask is
that the ambient light will change the mesh to any color I choose, only the
point light has this issue.
The lighting model and how it computes the final color is covered in
Chapter 8. Lighting and Materials from my book:
<http://www.xmission.com/~legalize/book/download/08-Lighting%20and%20Materials.pdf>
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
Loading...