Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualMedo3337

Posted 23 July 2013 - 10:49 AM

@Anddos: I'm just creating a single directional light:

pEffect->SetMatrix("View", &view);
pEffect->SetMatrix("Projection", &proj);

// Light
float lightDiffuse[4] = {0.9f, 0.9f, 0.9f, 1.0f};
float lightSpecular[4] = {1.0f, 1.0f, 1.0f, 1.0f};
pEffect->SetValue("lightDiffuse", &lightDiffuse, sizeof(lightDiffuse));
pEffect->SetValue("lightSpecular", &lightSpecular, sizeof(lightSpecular));

// Material
float materialDiffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float materialAmbient[4] = {0.15f, 0.15f, 0.15f, 1.0f};
float materialSpecular[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float materialPower = 1.0f; // *** Here I'm setting the value to 1.0f and getting high specular light, I'm expecting the specular light to be low since the value is low number ***

pEffect->SetValue("materialDiffuse", &materialDiffuse, sizeof(materialDiffuse));
pEffect->SetValue("materialAmbient", &materialAmbient, sizeof(materialAmbient));
pEffect->SetValue("materialSpecular", &materialSpecular, sizeof(materialSpecular));
pEffect->SetFloat("materialPower", materialPower);

float gAmbient[4] = { 0.2f, 0.2f, 0.2f, 0.0f };
pEffect->SetValue("globalAmbient", &gAmbient, sizeof(gAmbient));

// Directional light
D3DXVECTOR3 lightDirection(-1.0f, 0.0f, -1.0f);
pEffect->SetValue("lightDirection", &lightDirection, sizeof(lightDirection));

pEffect->SetValue("cameraPos", &camera->position(), sizeof(camera->position()));
pEffect->SetTexture("colorMapTexture", texture);

#1Medo3337

Posted 23 July 2013 - 10:48 AM

@Anddos: I'm just creating a single directional light:

pEffect->SetMatrix("View", &view);
pEffect->SetMatrix("Projection", &proj);

// Light
float lightDiffuse[4] = {0.9f, 0.9f, 0.9f, 1.0f};
float lightSpecular[4] = {1.0f, 1.0f, 1.0f, 1.0f};
pEffect->SetValue("lightDiffuse", &lightDiffuse, sizeof(lightDiffuse));
pEffect->SetValue("lightSpecular", &lightSpecular, sizeof(lightSpecular));

// Material
float materialDiffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float materialAmbient[4] = {0.15f, 0.15f, 0.15f, 1.0f};
float materialSpecular[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float materialPower = 1.0f; // *** Here I'm setting the value to 1.0f and getting high specular light ***

pEffect->SetValue("materialDiffuse", &materialDiffuse, sizeof(materialDiffuse));
pEffect->SetValue("materialAmbient", &materialAmbient, sizeof(materialAmbient));
pEffect->SetValue("materialSpecular", &materialSpecular, sizeof(materialSpecular));
pEffect->SetFloat("materialPower", materialPower);

float gAmbient[4] = { 0.2f, 0.2f, 0.2f, 0.0f };
pEffect->SetValue("globalAmbient", &gAmbient, sizeof(gAmbient));

// Directional light
D3DXVECTOR3 lightDirection(-1.0f, 0.0f, -1.0f);
pEffect->SetValue("lightDirection", &lightDirection, sizeof(lightDirection));

pEffect->SetValue("cameraPos", &camera->position(), sizeof(camera->position()));
pEffect->SetTexture("colorMapTexture", texture);

PARTNERS