Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

johnnyBravo

How to use materials on my mesh?

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

Hey I want to use materials on my mesh. Like the materials that you use with lighting to colour a surface. It just won''t work with meshes. I heard something about setting the right texture stages?

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Pipo DeClown
I think it''s

D3DTSS_COLOROP, D3DTOP_MODULATE // combine 1 & 2
D3DTSS_COLORARG1, D3DTA_TEXTURE // 1 texture
D3DTSS_COLORARG2, D3DTA_DIFFUSE // 2 material




I see.. somehow you need to add D3DTA_CURRENT to it I''m not very smart:

1) What does this do?
D3DTSS_COLOROP, D3DTOP_MODULATE // combine 1 & 2
D3DTSS_COLORARG1, D3DTA_TEXTURE // 1 texture
D3DTSS_COLORARG2, D3DTA_CURRENT // 2 light

2) This won''t work, will it?
0, D3DTSS_COLOROP, D3DTOP_MODULATE // combine 1 & 2
0, D3DTSS_COLORARG1, D3DTA_TEXTURE // 1 texture
0, D3DTSS_COLORARG2, D3DTA_CURRENT // 2 light
1, D3DTSS_COLOROP, D3DTOP_SELECTARG1
1, D3DTSS_COLORARG1, D3DTA_DIFFUSE // 3 diffuse

I really don''t have a clue..

.lick

Share this post


Link to post
Share on other sites
first this is what i use on my loaded mesh so my point light works on it. Sets the normals or something

DWORD fvf = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_SPECULAR | D3DFVF_TEX1 );
myMesh[index]->CloneMeshFVF( D3DXMESH_MANAGED, fvf, myDevice, &myMesh[index]);
D3DXComputeNormals( myMesh[index], 0);

and about "2) This won''t work, will it?"

it sent all my meshes white. Which had nothing to do with the materials i had on it.

Share this post


Link to post
Share on other sites
hmmm i just realised that the materials i was setting on my normal surfaces could only set a max of red blue or green.

like no 200,10,200

only 1,1,1

etc

i wanted to be able to set the diffuse colour.....

Share this post


Link to post
Share on other sites
You can specify the diffuse colour for each vertex by adding a colour variable e.g. D3DXCOLOR Colour(255,255,255,255) to your vertex structure and then adding D3DFVF_DIFFUSE to your FVF decleration.

Share this post


Link to post
Share on other sites

  • 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!