Best way to calculate reflections off some walls?
I am working on a reverb visualizer and need to send straight lines off a certain coordinate (currently trying this in lcd) at a certain angle and have them know, when they hit a wall (currently a linesegment draw between two corners)
So far I am doing this in lcd, by checking the pixels along the way for one that is RGB 1 1 1 (the color of the walls on the lcd).
But that seems like a very inefficient process, and since lcd always uses anti-aliasing the walls sometimes don't contain any RGB 1 1 1 pixels at all, when they are not perfectly horizontal or vertical.
Is there an object or a way to calculate this more simply? I'd probably still use lcd for visualization, but the calculating itself should maybe take place somewehere else.
Here's the subpatch, that does the "checking every pixel on the lcd for a wall"-method:
i dont know of any "simple" method for raytracing a large(r) amount of beams ... except maybe calculating a bunch of beams together as list of floats.
there are also a few things in your patch which could be optimized for CPU, for example use [expr] instead of [if] for that bool, and remove the gui objects (but i think you are aware of that and they are only there while you are still working on the patch)
Thanks for the tips, but how would I go about substituting [if] with [expr].
I thought [expr] was only for evaluating a mathematical expression. How would I check the values of 3 integers with it?
Here's an interesting thought. If you model the sound source in OpenGL, with a point light light source with linear falloff, can you use the resulting shade on a surface point to determine the distance? Some fog might provide visualization.
>>How would I check the values of 3 integers with it?
sum´em up, do [route 0]. :)
abusing a preexisting lightning app is a great idea btw.
What preexisting lightning app do you mean?
whatever ernest had in mind when he is suggesting to use point light source in open GL.
of course you could do it the other way round and build the walls of a room by creating an array of combfilters with constant factors.
but as you need a graphic representation of the room anyway to control the audio dsp, why not start from there to find the delay times?
i am just not sure how to find the (audio) phase offset this way.
The Phase offset is calculated using the total distance traveled before a certain amount of reflections has ocurred (Can't keep it going forever).
The filters and delays are then set accordingly. Only for the rays which have hit the listener obviously.
But I must admit, I'll probably be at a different concept in a week, since this patch is requiring me to constantly rethink it.
right, so you just had to accumulate the single distances.