Inferrer of Types and β-Reducer of β-Redexes
- Sep 13, 2016
Pi Day is stupid and people who memorise many base ten digits of π are idiots.
i'm not super familiar with the standard way to do it, but this goes through some of the ideas/options: https://torinmr.github.io/cs148/. still seems like ray tracing (mentioned first) is the easiest. you're already tracking rays of light. right now i have a Scene.cast_ray(LightBeam&) method, which uses the Geometry.intersect(LightBeam&) method; i think i'd just have to allow the PortalGeometry access to the Scene as well (PortalGeometry.intersect(LightBeam&, Scene*)), which would internally cast another ray if the portal was hit by the first beam (i.e., create another LightBeam based on the transform to be put into another Scene.cast_ray).Making portal graphics in the more common vertex based engines is quite easy anyway; just render the scene twice, once from the PoV of the player character and one from the output of the portal, then render the one from the portal inside the input portal. Of course in the game portals are bi-directional and you might be able to see both portals in which case you'd need to render three PoVs, and I dare say you could limit the screen area you need to render for at least half of the scenes with a very minimal number of spottable differences (maybe shadows would be borked for example). In a ray tracing scheme you'd need to implement a magic wormhole that takes rays heading into the input portal and translate them over to the output portal for every ray that goes there, and I'm not completely sure whether that's more or less easy to implement in practice.