Advertisement
Guest User

fog.inc

a guest
Jun 17th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. // ======================================================================
  2. // inputs:
  3. //
  4. // r11.w = distance squared from vertex to camera
  5. //
  6. // outputs:
  7. //
  8. // oFog
  9. //
  10. // ======================================================================
  11.  
  12. // ----------------------------------------------------------------------
  13. // calculate fog
  14.  
  15. // (distance)^2 * (density)^2 = (distance * density)^2
  16. mul r0.w, r11.w, cFog.w
  17. // log2(e) * (distance * density)^2
  18. mul r0.w, cLog2e, r0.w
  19. // 2^(log2(e) * (distance * density)^2) = (2^log2(e))^((distance * density)^2) = e^((distance * density)^2)
  20. exp r0.w, r0.w
  21. // 1 / (e^((distance * density)^2))
  22. rcp oFog, r0.w
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement