I’ve been playing around with ofxRay, and I was wondering how I could use those to create reflexive surfaces (like mirrors) and surfaces with refraction (like glass).
From what i’ve read online, both those effects are done using raycasting, so it should be possible to do with openframeworks and the ofxRay add-on, but I can’t figure out how to make it work.
I’m mostly looking for an example (where would I do the raycasting in the code, what exactly should the camera “know” about it to render it correctly, which 3D (or 2D?) objects would be the easiest to start with if I want to implement such a feature in my app, etc.
I’m using a ccamera for the rendering, and a bunch of of3dprimitives but it is flexible so I can change some of the structure if it helps.
If nobody has an example, an explanation of the way to go would be great too.
I think that ofxRay is not intended for raycasting. Although you might be able to do something with it it will probably be insanely slow. I´d recommend you to go for something like ray marching using shaders. Check out Iñigo Quilez site. theres a lot explained there
hey! I just came across this addon.
This add-on seems to only reflect/refract a predetermined skybox. I’m looking for a way to reflect/refract other 3d objects (like 3d primitives, box, sphere, etc) in the scene, without any skybox.
Unless I’m misunderstanding, this doesn’t seem possible with that add-on?
Hi, I’m not sure, I havent inspected it, but probably it just works only with the skybox.
Trying to implement a raycasting rendere thing is a bit crazy I would say, as it yo actually have to create the whole renderer pipeline.
Take a look at ofxaddons.com
there are some really good renderer implementations, although I dont know if any of this support reflection and refraction.