specular lighting refraction demo

Hi I was trying to add specular lighting to my project however as I was reading through your refraction demo code I came across this



vLightDirModel = mModelView.inverse() * PVRTVec4(0.57735f, 0.57735f, 0.57735f, 0);



and was wondering how you got the values within the PVRTVec4?

the light diffuse color can be set in PVR SHAMAN or you can take the color of the diffuse Omni in 3ds max

the model inverse matrix enable to get back the vector in world pos

so the PVRTVec4 is for colour? rather than the position or direction of the light?

R,G,B,ALPHA ( OPACITY)

what represente the mModelView from your point of view ?

I see thanks, I tried to put that code into my project however I get nothing. I shall take another look at my code

are you asking what my mModelView is in my project? or asking my from my perspective what mModelView is in general?

in your project

oh right



PVRTMat4 model;

model = PVRTMat4::RotationX(-90);

PVRTMat4 mMVP, modelView;

modelView = view_Mat * model;

mMVP = proj_Mat * modelView;




and my view matrix is manually defined



view_Mat = PVRTMat4::LookAtRH(PVRTVec3(0, 0.5, 3), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));

Hi I was trying to add specular lighting to my project however as I was reading through your refraction demo code I came across this

vLightDirModel = mModelView.inverse() * PVRTVec4(0.57735f, 0.57735f, 0.57735f, 0);

and was wondering how you got the values within the PVRTVec4?


the direction is calculated by taking the normal of the light position

ahhh I see now thanks :slight_smile: