Jump to content

  • Log In with Google      Sign In   
  • Create Account


per pixel math.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 laeuchli   Members   -  Reputation: 336

Like
Likes
Like

Posted 26 October 2001 - 08:42 AM

Hey all, I''m trying to do per pixel lighting in opengl. I''ve been reading the AGDC pdf on per pixel shading, and they claim I need to mode the light vector into texture space. They say I need to create plane equations of the form Ax + Bs + Ct + D = 0 Ay + Bs + Ct + D = 0 Az + Bs + Ct + D = 0 and then solve for dsdx, dsdy, dsdz. Ok, here are my questions. When they say dsdx, etc do they mean ds/dx(ie. derivate of x with respect to s)? If so, as far as I can see the form of the problem becomes: Ax/B + Ct/B + D/B = S etc... do I do a partial derivtaion with respect to x, and treat the Ct/B + D/B as a constant(in which case it disappers I belive)? If I did that, then the answer to every one of those plane equations is A/B, an answer I''m fairly sure is not right :-). But I''m really not sure what I''m doing wrong. could anyone help me? Thanks, Jesse Jesse Laeuchli www.laeuchli.com/jesse/

Sponsor:

#2 v71   Banned   -  Reputation: 100

Like
Likes
Like

Posted 26 October 2001 - 10:12 PM

when you do per pixel lighting you have to calculate the angle beetween the normal found at that pixel and the ray coming from the light source, so you have to find the equation of the plane and then solve for x, or y in your main rasterizer loop you don''t have to derivate the plane equation ( since to my knowledge it has not any sense ).Hope it helps , i think that dsdx is the slope of the bilinear interpolator when you find the correct textel position.
Sorry for my english
(stl sucks)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS