c++ - Relativistic ray tracing and spheric texture -
question
i need advice on techniques , programming environment use specific problem.
the problem
given heavy object in space static surface above it´s schwarzschild radius, how positioned in space see it´s surface (illumination ignored)? 1 might imagne neutron star example
see: https://en.wikipedia.org/wiki/neutron_star, program should result in picture similiar (but more detailed than) picture on site.
note program should capeable of rendering several frames per second , free view , movement "like" in fps.
i want solve problem ray tracing in non-euclidean relativistic space.
this, need solve ~1000 independend differential equations, determine, ray hit surface.
the ode u´´+ u = 3ru^2/2 initial condition u , u´, r constant. terminates once u leaves defined bound. solving wont complicated.
after routines each pixel:
- transform spere coordinates respect direction (no if branches)
- apply special relativistic angle correction (possibly easy function without branching)
- transform 1 part of angle angle on surface applying interpolated function defined differential equations. pixels don´t hit surface should black now.
- transforming angles canonical sphere coordinates (no branching).
- not sure point: surface graphics sperical delaunay triangulation has been calculated , each ray colour determined weighting colours of corresponding triangles corners. glad if came better idea.
i appreciate in c/c++/c# environment
questions:
- what framework suitable problem?
open gl appears focused on euclidean ray tracing, useless in setup.
cuda restrict me nvidea gpus
open cl right thing? - are operations described executeable on gpu?
i´m worried accesing interpolated function data in parallel various processors. locating (o(log(#vertices) , branching) lot of rays in parallel on delaunay trianglulation seems problem me. open question - do have better ideas representing graphic on surface , deciding colour position should have?
- could worth trouble calculate differnetial equations on gpu? solved runge kutta methods , terminate after arbitrary times.
about level of knowledge:
i´m student of mathematics , problems above involved in bac. theses.
have experience c++ , learned guis in c# , gtk. coding not everyday activity, don´t have troubles standard stuff.
once theses finished, share results.
here suggestions respect presented problem:
this odes independent (suitable parallel execution) , can use fixed-step integration (no thread divergence), because makes problem suitable gpu.
one of libraries may helpful here boost::odeint, provides implementations of popular odes integrators (runge-kutta included). supports gpu accelerated computations, in case have use device_vector state type , have use thrust::for_each transformation equation (which may difficult achieve in case). seems thrust libraries support not nvidia gpus, not sure.
if thrust library functions not suitable problem, may provide own runge-kutta implementation (not complicated anyway) , odes definitions using cuda or opencl. if decide use cuda, , able use device compute capability 3.5 or higher, can take advantage of called "dynamic parallelism", allows call kernel function (in cuda, function runs on gpu) kernel function, allows create threads other thread. can example call rungekutta method 5 threads (5-point runge-kutta) , each thread can call 1000 threads ode calculation (each thread computes 1 equation). modern gpus have on 10 sm (streaming multiprocessor) , each sm able handle 2048 threads, can perform each integration step 1 calculation split on 5000 threads. not sure capability if decide use opencl.
your next steps (coordinates transformation, etc.) quite suitable thrust::for_each function, if turns out not, can use cuda/opencl interface again.
as final graphical representation, can't give advice, suppose can use graphical library (including opengl) , put pixels in places manually.
finally, in project time performance important. remember use profiler (for example nvidia visual profiler) investigate code , find out part slowest. should write unit tests, not test code potential bugs, test performance of each part of project separately.
you can in c++ of course.
Comments
Post a Comment