Jump to content
  • Advertisement
Sign in to follow this  
arri

light reflections when color is given by vertex??!

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

Moin, I've one question: If I use the material to set the color properties of the surfacae there is the power option to affect the surface reflection behaviour. And when I now want to render a multi-colored surface by setting the surface color in the vertex how can I now affect the power option? The material setting has no effect! Do somebody have any suggestion?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure if I understand your question, but just to clarify -- Power specifies the sharpness of specular highlights on a surface. The higher the value, the sharper the highlights. So if you don't have a visible specular color being reflected, specular lighting isn't enabled (D3DRS_SPECULARENABLE must be true), or your light doesn't emmit the appropriate specular color, it won't work. Other than that, I'm not sure if I understand what you're asking :)

EDIT: Also, this may have been what you were asking: you cannot use diffuse vertex colors along with D3D Lighting. When using the fixed function pipeline lights, D3D computes a color for every vertex based on the materials, light sources set, and orientation of the surface.

But, I think you can specify where to get the different material colors from if you want to use lighting. You can set some render states like DIFFUSEMATERIALSOURCE, SPECULARMATERIALSOURCE, etc. You can use it to override the material colors with vertex diffuse colors. For example, try setting the DIFFUSEMATERIALSOURCE render state to D3DMCS_COLOR1 -- the diffuse color should now be the first vertex color in your vertices. Remember to set the specular material source as well if you want to make use of the power option.

Share this post


Link to post
Share on other sites
What I want to do is, the the surface color not by the material but by the vertex:

private type d3dvertex
pos as d3dvector
normal as d3dvector
diffuseColor as long
specularColor as long
end type

end no I want to effect something like a power option, the material options have no effects. Or is that not possible?

Share this post


Link to post
Share on other sites
The material specular power settings should still be working. If you want to specify power per vertex however, you're going to have to use a shader, but I don't think that's what you're after.

LIGHTING, true
COLORVERTEX, true
DIFFUSEMATERIALSOURCE, COLOR1
SPECULARMATERIALSOURCE, MATERIAL
AMBIENTMATERIALSOURCE, MATERIAL
EMISSIVEMATERIALSOURCE, MATERIAL

Setting the above render states will tell D3D to use vertex diffuse for the diffuse portion of lighting, and keep using the material values for the remainder of lighting. Specular power always comes from materials.

Share this post


Link to post
Share on other sites
Hi Arri,
Further to kosmon_x' and Namethatnobodyelsetook's replys, "Power" affects specular refection. It needs to be used in conjunction with a specular color (in the material you are using)
AFAIK the material is only used if lighting is enabled (and you have lights).
if lighting is disabled the specular data is taken from the vertex data if available (again AFAIK).
if using lighting and materials the specular reflection is dependent on the specular color in the material and the power in the material (D3DMATERIAL9.Specular and D3DMATERIAL9.Power) and the lights position in relation to the vertex position/normal.
AFAIK if lighting is disabled, any material settings will not be used and a specular color in your vertex relates to "precomputed" specular lighting.

Also see this newsgroup archive

HTH,
Cambo_frog

[Edited by - Cambo_frog on July 20, 2005 5:16:20 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!