Imagination PowerVR SDK Blog

specular lighting refraction demo


#1

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?


#2

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


#3

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


#4

R,G,B,ALPHA ( OPACITY)

what represente the mModelView from your point of view ?


#5

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


#6

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


#7

in your project


#8

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));


#9
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

#10

ahhh I see now thanks :slight_smile: