Shaders In XVR

From VRwiki
Jump to: navigation, search
Shaders tutorial 2009.png

This tutorial shows a number of different scenarios, displaying how to use shaders in XVR:

  • the difference between independent shaders and embedded shaders
  • how to pass textures to shaders
  • how to pass custom values (uniforms) to shaders
  • how to load meshes containing vertex attributes

You will also find ideas on what you can do with shaders in your applications.


  • classic shading
  • simple independent shader
  • how shaders affect OpenGL code
  • simple embedded shader
  • per pixel lighting
  • passing uniforms
  • passing uniforms to embedded shaders
  • multitexturing
  • passing textures to embedded shaders
  • effect with multitexturing
  • multipass example (fur)
  • normal mapping
  • parallax mapping
  • using framebuffer objects (FBOs)
  • postprocessing example
  • shadowmapping example
  • environment mapping example
  • fbo cubemap example
  • vertex attributes example (morphing)
  • combined vertex and fragment shader animation
  • bonus effect (spawn animation)

How to interact

  • page down: go to next scenario
  • page up: go to previous scenario
  • r: default camera view
  • t: top camera view

Drag the mouse with left button or right button to rotate or pan the view respectively.

Tutorial application

You can use the skeleton of this application also to write your own tests, enjoying a very easy interface to create sliders, color sliders, keyboard toggles.

  • subclass the scenario class
  • add it to the "scenarios" global variable, like this: ui.process_ui(your_class_name())


Download from here.

See Also