I am making a portal and I want to make it so you can only see objects through the Portal, like in Picture 1.Picture 1
-
$\begingroup$ +1, I'm sure someone will explain how to do that with a lightpath node or something. Great question :) You might want to change your title to something a little more descriptive, though. $\endgroup$ – Millard Oct 20 '19 at 17:07
-
$\begingroup$ I think that my answer here is what you are looking for: blender.stackexchange.com/questions/107927/… and version for EEVEE: blender.stackexchange.com/questions/137679/… $\endgroup$ – cgslav Oct 21 '19 at 20:07
As Millad already pointed out, this would be done with the Light Path node.
Material for the portal is just a refraction shader with an index of refraction set to 1 (so it doesnt actually refract the objects behind it).
The "magic" happens in the material you want to see through your portal. use a mix shader to mix a transparent node (be sure the color of the node is pure white. its often a bit grey per default) and the actual material of your object. I used an emission shader just for an easier demonstration but pretty much everything works here. THere could be some problems with refration materials making objects visible that are not supposed to be visible. If you stumble across this problem, let me know.
for the factor input use the boferementioned light path node > transmission depth.