static class Renderer

Do you need to draw something? Well, you’re probably in the right place! This static class includes a variety of different drawing methods, from rendering Models and Meshes, to setting rendering options and drawing to offscreen surfaces! Even better, it’s entirely a static class, so you can call it from anywhere :)

Static Fields and Properties

   
Matrix CameraRoot Sets and gets the root transform of the camera! This will be the identity matrix by default. The user’s head location will then be relative to this point. This is great to use if you’re trying to do teleportation, redirected walking, or just shifting the floor around.
RenderLayer CaptureFilter This is the current render layer mask for Mixed Reality Capture, or 2nd person observer rendering. By default, this is directly linked to Renderer.LayerFilter, but this behavior can be overridden via Renderer.OverrideCaptureFilter.
Color ClearColor This is the gamma space color the renderer will clear the screen to when beginning to draw a new frame.
bool EnableSky Enables or disables rendering of the skybox texture! It’s enabled by default on Opaque displays, and completely unavailable for transparent displays.
bool HasCaptureFilter This tells if CaptureFilter has been overridden to a specific value via Renderer.OverrideCaptureFilter.
RenderLayer LayerFilter By default, StereoKit renders all first-person layers. This is a bit flag that allows you to change which layers StereoKit renders for the primary viewpoint. To change what layers a visual is on, use a Draw method that includes a RenderLayer as a parameter.
int Multisample Allows you to set the multisample (MSAA) level of the render surface. Valid values are 1, 2, 4, 8, 16, though some OpenXR runtimes may clamp this to lower values. Note that while this can greatly smooth out edges, it also greatly increases RAM usage and fill rate, so use it sparingly. Only works in XR mode. If known in advance, set this via SKSettings in initialization. This is a very costly change to make.
Projection Projection For flatscreen applications only! This allows you to change the camera projection between perspective and orthographic projection. This may be of interest for some category of UI work, but is generally a niche piece of functionality. Swapping between perspective and orthographic will also switch the clipping planes and field of view to the values associated with that mode. See SetClip/SetFov for perspective, and SetOrthoClip/SetOrthoSize for orthographic.
float Scaling OpenXR has a recommended default for the main render surface, this variable allows you to set SK’s surface to a multiple of the recommended size. Note that the final resolution may also be clamped or quantized. Only works in XR mode. If known in advance, set this via SKSettings in initialization. This is a very costly change to make.
SphericalHarmonics SkyLight Sets the lighting information for the scene! You can build one through SphericalHarmonics.FromLights, or grab one from Tex.FromEquirectangular or Tex.GenCubemap
Material SkyMaterial This is the Material that StereoKit is currently using to draw the skybox! It needs a special shader that’s tuned for a full-screen quad. If you just want to change the skybox image, try setting Renderer.SkyTex instead. This value will never be null! If you try setting this to null, it will assign SK’s built-in default sky material. If you want to turn off the skybox, see Renderer.EnableSky instead. Recommended Material settings would be: - DepthWrite: false - DepthTest: LessOrEq - QueueOffset: 100
Tex SkyTex Set a cubemap skybox texture for rendering a background! This is only visible on Opaque displays, since transparent displays have the real world behind them already! StereoKit has a a default procedurally generated skybox. You can load one with Tex.FromEquirectangular, Tex.GenCubemap. If you’re trying to affect the lighting, see Renderer.SkyLight.

Static Methods

   
Add Adds a mesh to the render queue for this frame! If the Hierarchy has a transform on it, that transform is combined with the Matrix provided here.
Blit Renders a Material onto a rendertarget texture! StereoKit uses a 4 vert quad stretched over the surface of the texture, and renders the material onto it to the texture.
OverrideCaptureFilter The CaptureFilter is a layer mask for Mixed Reality Capture, or 2nd person observer rendering. On HoloLens and WMR, this is the video rendering feature. This allows you to hide, or reveal certain draw calls when rendering video output. By default, the CaptureFilter will always be the same as Render.LayerFilter, overriding this will mean this filter no longer updates with LayerFilter.
RenderTo This renders the current scene to the indicated rendertarget texture, from the specified viewpoint. This call enqueues a render that occurs immediately before the screen itself is rendered.
Screenshot Schedules a screenshot for the end of the frame! The view will be rendered from the given position at the given point, with a resolution the same size as the screen’s surface. It’ll be saved as a JPEG or PNG file depending on the filename extension provided.
SetClip Set the near and far clipping planes of the camera! These are important to z-buffer quality, especially when using low bit depth z-buffers as recommended for devices like the HoloLens. The smaller the range between the near and far planes, the better your z-buffer will look! If you see flickering on objects that are overlapping, try making the range smaller. These values only affect perspective mode projection, which is the default projection mode.
SetFOV Only works for flatscreen! This updates the camera’s projection matrix with a new field of view. This value only affects perspective mode projection, which is the default projection mode.
SetOrthoClip Set the near and far clipping planes of the camera! These are important to z-buffer quality, especially when using low bit depth z-buffers as recommended for devices like the HoloLens. The smaller the range between the near and far planes, the better your z-buffer will look! If you see flickering on objects that are overlapping, try making the range smaller. These values only affect orthographic mode projection, which is only available in flatscreen.
SetOrthoSize This sets the size of the orthographic projection’s viewport. You can use this feature to zoom in and out of the scene. This value only affects orthographic mode projection, which is only available in flatscreen.




Found an issue with these docs, or have some additional questions? Create an Issue on Github!