3d Surface illumination + shadow using Opengl or other ray tracer?
I'm working on a program to measure the sound reaching a surface
(i'll call this the receiver surface) from point sources. I've
modeled it similar to rays of light; inverse square of the distance
from the source & shadows created by obscuring surfaces.
What I understand of OpenGL, it could do this for me. Is possible to
access OpenGL directly in Matlab, esp as I have obscuring surfaces
blocking the path of light.
Unfortunately I'm not sure what I'm looking for, all the things I've
found googling Matlab and OpenGL mostly as to do with Matlab's
inbuilt graphing functions for 3d objects (like the Matlab logo)
_My current method _
Essentially i've traced a ray to from source to grid of receivers
testing for shadowing.
The way I've done it is to create a meshgrid which represents the
receiver surface, then create a vector from the meshgrid point, to
each source then checks for intersection with each obscuring surface,
it accumulates level using an inverse square -20*log10(distance) for
each visible point source. Finally plotting the result as a surf.
All my surface data is stored as 3d polygons in structured arrays.
surface(i).x = [0 0 1 1 0];
surface(i).y = [0 1 1 0 0];
surface(i).z = [0 0 0 0 0];
It seems a bit cumbersome, as I have several embedded loops, having
to check each vector for intersection with an obscuring surface
Is it possible to use the OpenGL (or another render/ray trace)
libraries in matlab to do this without the need for a meshgrid? By
creating the a light source that illuminates a surface then measuring
the total illumination on receiver plane.
Currently I'm only interested in the level and if another object is
obscuring and causing a shadow, but later features may include the
ability know which source the ray has come from and lit my surface.
Any ideas or suggestion very much appreciated.