Original Post
Another day, another issue.
Currently I am rendering a red point light in the world, but seemingly one point light is being applied independently for each object. Obviously I want one point light in the world to effect all objects (objects to share the same lighting). This issue was also apparent with my directional light.
I think it might be an issue either in my shader transforming into clip space and maybe then I need to do a new transformation
Or the issue is in my baseObject render method, whereby I am rendering something per-object as opposed to globally, or there is a transformation I am missing to incorporate at this level
Here's an image of the scene to illustrate the issue at hand.
Thanks
Currently I am rendering a red point light in the world, but seemingly one point light is being applied independently for each object. Obviously I want one point light in the world to effect all objects (objects to share the same lighting). This issue was also apparent with my directional light.
I think it might be an issue either in my shader transforming into clip space and maybe then I need to do a new transformation
input.p = mul( input.p, World );
output.p = mul( input.p, View );
output.p = mul( output.p, Projection );
Or the issue is in my baseObject render method, whereby I am rendering something per-object as opposed to globally, or there is a transformation I am missing to incorporate at this level
void dxBaseModel::render()
{
D3DXMatrixIdentity(&posMatrix);
D3DXMatrixIdentity(&rotMatrix);
D3DXMatrixIdentity(&meshWorld);
D3DXMatrixRotationYawPitchRoll(&rotMatrix, rotation.y, rotation.x, rotation.z);
D3DXMatrixTranslation(&posMatrix, position.x, position.y, position.z);
D3DXMatrixMultiply(&meshWorld, &rotMatrix, &posMatrix);
pViewMatrixEffectVariable->SetMatrix(viewMatrix);
pProjectionMatrixEffectVariable->SetMatrix(projectionMatrix);
myTexture.pTextureSR->SetResource( myTexture.textureSRV[0] );
myTexture.pBumSR->SetResource(myTexture.textureSRV[1]);
myTexture.pSpecSR->SetResource(myTexture.textureSRV[2]);
D3D10_TECHNIQUE_DESC TechDesc;
pBasicTechnique->GetDesc(&TechDesc);
for( UINT p = 0; p < TechDesc.Passes; p++ )
{
WVP = meshWorld*viewMatrix*projectionMatrix;
pWVPMatrixEffectVariable->SetMatrix((float*)&WVP);
pWorldMatrixEffectVariable->SetMatrix((float*)&meshWorld);
pBasicTechnique->GetPassByIndex( p )->Apply( 0 );
pMesh->DrawSubset(0);
}
}
Here's an image of the scene to illustrate the issue at hand.
Thanks
