Let me describe what I need to do: in a very *simplified* form!

In a 2d software that I have I can divide the space in boxes and I can check the inter-visibility between the boxes. The boxes represent the open space and the "black/empty" are solid walls. "Red" means that this box can "see" more boxes, "blue" is less.
Now, I want to do a similar thing in 3d and I wanted to use a collision world with raycasts to test visibility.

Do you think this is possible? I need to be able to mark objects as transparent and solid. (the marked big box in the middle should be the solid one)
Any example to read? or something else?
Thanks a lot!
If something is not clear, let me know!
Tasos