Skip to content

Hw3 Virtual World

Andrea edited this page Oct 24, 2016 · 1 revision

teaser

You will use procedural methods to generate a virtual world. This goal can be subdivided into three parts:

  • geometry (procedural generation on either CPU or GPU)
  • rendering (terrain shading, texturing, deferred rendering)
  • animation (camera animation, particle systems, etc..)

The sub-tasks in these three parts are subdivided into two categories: basic and advanced. Tasks in the Basic category will allow you to obtain a B-. The advanced tasks can be used to improve your grade and difficulty is annotated in parenthesis beside each item. A real time world having a visual quality as shown in the teaser image above will award you an A+.

Geometry

geometry

  • create a triangular mesh for a quad on z=0 (compute a float[] on CPU, then upload vertex array to GPU). You cannot reuse what I gave you to load a mesh from file. Create the vertex and index buffer manually, and use GL_PRIMITIVE_RESTART to create strips of triangles (one per row).
  • generate perlin noise on CPU and upload it to a texture (in the upcoming lab session)
  • generate a fBm texture (read this tutorial on fractional Brownian motion)
  • setup ModelViewProjection matrices (C++) to display your 3D scene
  • use your fBm texture as a displacement map for your mesh (vshader)
  • color terrain according to height (fshader, use a 1D texture)

Be cautious about how you set up your textures and what texture formats you use. Default OpenGL textures are also clamped to [0, 1]. You likely want to use unbounded floating point textures, e.g., GLR32F for our height-map. Make sure to pick the right format with the correct number of parameters!

Advanced

  • (very easy) use ImGUI to control the parameters of your program
  • (easy) use other combinations of noise functions to get more interesting terrains (see these examples for hybrid multifractal and ridged multifractal) SUGGESTED
  • (easy) implement and experiment variations like Simplex Noise or Worley Noise
  • (medium) use noise functions to generate clouds (and integrate participating media in fshader)
  • (medium-hard) compute the fBm noise on the GPU (fshader + framebuffer) and show how you can interactively change the parameters of the random generation SUGGESTED
  • (hard) use tessellation shaders to render in a LOD fashion (requires OpenGL4)
  • (hard) use L-systems to add trees to your terrain
  • (hard++) make an infinite terrain (generate new tiles on demand, require GPU noise)
  • (extreme) rather than using a flat domain, do everything on a sphere (solid noise)
  • (???) let the instructor know if there is something different you'd like to try!

For these advanced tasks, this textbook might also come useful to you: Texturing and Modeling, Third Edition: A Procedural Approach (The Morgan Kaufmann Series in Computer Graphics) 3rd Edition by David S. Ebert (Author), F. Kenton Musgrave (Author), Darwyn Peachey (Author), Ken Perlin (Author), Steve Worley (Author)

Rendering

rendering

  • add diffuse shading to your terrain (you have to compute per fragment normal by finite differences on the texture that displaced the terrain)
  • use the tile-able textures (shown above) to texture your terrain. In the fshader you can use the normal of a fragment (slope of terrain) and its height to decide which textures to blend. For example, snow does not deposit on very steep slopes, and happens only at a certain height. (Download *.tga: grass, rock, sand, snow, water)
  • surround your scene with a cube, and texture this cube to color the sky of your scene. Here you can download a texture map (note it's a jpg to be converted to targa, you can find others online). You will have to write UV texture coordinates in your C++ code so to map faces of the cube to the correct portion of the image/texture.

Advanced

  • (easy) use an OpenGL CubeMap to texture the sky and get rid of artifacts caused by discontinuities in the UV parameterization.
  • (easy) use a normal map texture to represent waves on your water; see this texture. You can overlap multiple scaled copies of this texture and translated them over time to emulate a water effect (see video). SUGGESTED
  • (medium) add the mirroring effect of water (screen-space reflections) to your scene; this is achieved by mirroring the camera position with respect to the water plane, render your scene in a framebuffer, and placing the texture back in a second step. You can also simulate refraction by blending the mirrored and non-mirrored images according to the incidence angle of your camera w.r.t. water. SUGGESTED
  • (medium) simulate the fact that reflections are affected by water movement by distorting the reflected image with a noise function (see example); this is achieved with dudv-maps, also called uv displacement maps.

Animation

  • implement a flymode camera (WASD control forward/back and strafe, while mouse controls direction) using keyboard and mouse

Advanced

  • (very easy) draw a 3D bezier curve in your scene
  • (easy) use a bezier curve to animate the camera path (in the lookAt function, evaluate one bezier curve to know the position of your camera, and another to know what you are looking at) SUGGESTED
  • (easy) implement an FPS camera (Z-position of camera is determined by local terrain height) SUGGESTED
  • (medium) parametrize your camera path with arc-length (i.e. uniform speed) and use ease in/out to avoid abrupt starts/stops; concatenate multiple curves to show off your virtual world.
  • (medium) use a displacement map to offset the position of vertices for the water plane (over time). The displacement can be computed numerically, as waves are nothing but a summation of periodic functions; see this chapter from GPU Gems 2.
  • (medium) implement and arcball camera controller (double click to center scene about the mouse)
  • (medium) make it snow! use particles and billboards to animate 3D snow
  • (hard++) camera motion causes motion blur! implement screen-space motion blur
Clone this wiki locally