Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. HEMISPHERE_METHOD:
  2.  
  3. Okay. For each vertex you have you simply shoot a ray inside a hemisphere about the normal, Then for each ray that does not intersect the object will be a contributing factor for the amount of ambient light that a vertex recieves. Then you set the occulsion value for the vertex to the normalized sum of all your rays that you shot from your hemisphere that make it to the enviroment. Then store the median ray that did not intersect the object as the bent normal; This will ensure that the diffuse light lookup in the enviroment map comes from a direction of the highest exposure to ambient light. To sample inside the hemisphere is pretty simple just use a uniform sampiling unit disc, project each sample on the disc all the way up to the hemisphere which will give you cos(r) where r is the angle between the normal and your sample ray. This however involves raytracing and is not exactly OpenGL friendly.
  4.  
  5. HEMICUBE_METHOD DERIVING HEMISPHERE TRAITS:
  6. So my proposal is use a hemicube: #1 You have the advantage of easily rendering each face to OpenGL. #2 You still need to the use hemisphere but you do not have to do any raytracing inside it. Infact all that has to be done is some weighting of your pixel contribution. You just weight it by the amount of projected area associated with that pixel. As an example you can use a weighting function defined as follows:
  7. w(x,u,z) = y / M_PI * (x^2 + u^2 + x^2) ^ 2 where the 'u' is your up vector.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement