Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

hlsl shaders and colours

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

colour:
DIFFUSE
AMBIENT
SPECULAR
EMISSIVE


textures

DIFFUSSE
SPECULAR
AMBIENT
EMISSIVE
NORMAL
TEXTURE_HEIGHT


and i right in thinking that if you have a texture , say diffuse texture then you do not use the diffuse colour from a materail

and when calcualting the final colour , EMISSIVE colour or texture just gets added to the final colour

Share this post


Link to post
Share on other sites
Advertisement
That depends on what you're trying to do... What are you trying to do?

If you're making a HLSL shader that is supposed to only fetch diffuse colour from a texture, then that shader won't have a diffuse variable as well.
If you're making a HLSL shader that is supposed to fetch diffuse colour from a texture and multiply it with a diffuse variable, then it will have a diffuse variable.

Share this post


Link to post
Share on other sites
As Hodgeman says, there's no 'right' way of doing this, the beauty of programmable shaders is that you can do whatever you want to get the right effect.

I think though what you're aiming at is "for a 'normal' scene, do I need to use the Diffuse property of the vertex when I'm also using a texture?" The answer is 'if you want'. Having a per-vertex diffuse is a handy way of altering the surface colour per-vertex, letting you tint the texture a different colour for each vertex. For example, you could write an object exporter that fakes a shadow by having certain vertices darker than the rest - in your shader you them multiply the vertex's diffuse by the texture and it will darken the texture by that amount, meaning you don't have to calculate the shadow in real-time.

If however, all you want to do is show the surface texture at the same intensity for every vertex then you don't have to include the Diffuse for the material.

Best advice is just have a play combining different attributes together and see what happens. It's your shader after all :)

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!