Archived

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

How to use materials on my mesh?

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

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
ok, i think my point lights setup wrong.

When i turned the point light off, and just set ambient light on, the materials worked properly, like 0.5 for red worked, u could see the difference.

anyway could you have a look at this point light and see if there is any reason it won''t show anything but the max colour for the rgb


void PointLight(int index, float x, float y, float z, float range, float r , float g, float b, float a0=0, float a2=0)
{
D3DXVECTOR3 vecDir;
D3DLIGHT9 light;
ZeroMemory( &light, sizeof(D3DLIGHT9) );
light.Type = D3DLIGHT_POINT ;
light.Diffuse.r = r;
light.Diffuse.g = g;
light.Diffuse.b = b;
light.Attenuation0 =a0;
light.Attenuation2 =a2;
light.Position= D3DXVECTOR3( x, y, z );
light.Range = range;
myDevice->SetLight( 0, &light );
}



Share this post


Link to post
Share on other sites