opengl - Per-vertex reflection and intersection calculation, OpenCL vs GLSL -
i have calculate visibility field of mirror on plane (i.e: floor).
the mirror surface composed of several triangles (up fewer thousands).
each vertex define mirror point, each mirror point may correspond 6 triangle vertices , has normal.
in order should calculate line between specific point, representing driver head (where blue lines come from), , each of mirror points lying on mirror surface (in image on right side). each of these points, should calculate reflections (yellow lines) based on direction of i-th blue line , i-th normal , therefore intersection between i-th yellow line , floor. both blue , yellow lines need tested intersection vehicle geometry during process..
right whole process run on cpu, approximations in order make faster, original idea move calculation part on opencl..
i came cuda environment (and know opencl similar), learnt opengl, , starting discovering glsl..
given read glsl has limitations compared cuda/opencl, faster , has wider compatibility, possible implement need in glsl? , if yes, have problems/limitations strong might not worth?
for algorithm work gpgpu (general-purpose computing on graphics processing units) need able express need calculate in terms of matrices or vectors simd. here's agood article gpu gems.
after having quick @ description of calculation seems me should able this. transfer input data (like mirror points) textures , transfer output data textures well. single points or vectors can sent glsl uniform vector.
however since glsl isn't intended gpgpu take quite lot of effort , time. getting texture coordinates right can tricky. if you're in hurry implement this, glsl not way go.
one limitation can run when trying general purpose calculations in glsl on platforms don't have access floating point textures, can store integer values. (to data glsl shader store vectors or matrices textures). i've run in iphone 3gs, don't know later versions.
Comments
Post a Comment