Second 'portal view' that is attached to the view. A portal is a special surface of a level or map entity where this portal view is mapped onto. This way windows into different areas of the level, as well as realtime mirrors can be created.If the mirror flag (only available in WED 5, emulated by flag8 in WED 4) is set for a surface, the portal view is blended onto that surface. Only one portal can be visible at a time. If several portals are in the view, only the first one will be displayed properly.The blending percentage is given by the albedo parameter of the surface (0..100 %). If the surface is part of a map entity, then its albedo value modulates the surface value, allowing for soft blending in/out of mirrors.As soon as a portal surface is visible in the view, the view's portal_x, portal_y and portal_z parameters are set to the position of the first vertex of that surface. The view's pnormal_x, pnormal_y and pnormal_z parameters are set to the normal of the portal surface. Those parameters can be used to emulate a realtime mirror by setting the portal view parameters accordingly.


Note that despite it looks like a real mirror, it is just a second imaginary camera view. The imaginary camera must have no obstacles in the way, and must look through a 'hole' in the wall where the mirror is attached. The mirror itself should be an unrotated map entity for being invisible to the imaginary camera. The side walls of the mirror hole must be set to the none rendering mode for being invisible too when the camera swings around its imaginary position.






// Code to emulate a horizontal mirror by generating a vertically flipped camera view
view mirror { }
function init_mirror_z()
  camera.portal = mirror;
 	mirror.noshadow = on; // suppress shadows in the mirror
 	mirror.portalclip = on;
 	while (1)
	  proc_late();   // place it at the end of the function list - the camera must be moved before
 	  mirror.genius = camera.genius;
 	  mirror.aspect = -camera.aspect;    // flip the image upside down
 	  mirror.arc = camera.arc;
 	  mirror.fog = camera.fog;
 	  mirror.x = camera.x;
 	  mirror.y = camera.y;
 	  mirror.z = 2*camera.portal_z-camera.z; //move the camera downwards by twice the portal distance
    mirror.pan = camera.pan;
 	  mirror.tilt = -camera.tilt; // flip the vertical camera angle
 	  mirror.roll = -camera.roll;

See also:

layer, pos_x, pos_y, size_x, size_y, x, y, z, pan, tilt, roll, arc, aspect, offset_x, offset_y, ambient, fog, fog_start, fog_end, alpha, genius, flags