The task is to implement light refraction in a crystal (glass) sphere using only fragment shader programming. Crystal ball will move on a horizontal surface (table) covered by a color texture, so refraction effects should be visible.
You can start with the sample09 project from the ogl repository (C++) or with the 086shader project from the grcis repository (C#).
Use precise sphere implementation (a la ray-tracing), "ray-sphere" intersection will be computed in fragment shader together with all optics (refractions, reflections, shadows..). Scene could be reduced to one quad (two triangles), there is no need to draw anything outside of the quad's projection.
Horizontal surface (table) must be covered by appropriate texture in order to see the optical effects. Simple procedural texture (checkerboard) is sufficient.
You must implement at least the first effect, other ones are optional:
You must add at least some interactivity using keyboard and/or mouse.
Ball should be able to move (roll) on the table surface, there is no need to lift it.
Momentum (slowing down) would be nice.
Camera movement is optional but recommended, as well as light source animation.
Be inspired by default mouse-handling and keyboard-handling functions present
in pilot projects. You can adopt some techniques from your 004 solution.
Don't forget to add your new functionality to the F1 key help.
Send all your modifications (C#/C++ main and shader file) or complete Visual Studio project. Write a brief document about your ideas and operating manual.
Hand in before: 10. 6. 2018
Basis: 18 points for basic optics (two refractions) and necessary interactivity,
bonuses: up to 8 additional points for ball and camera movement,
4 to 8 points for shadows (visible through the sphere or not),
up to 6 more points for another effects (more light sources, interactive
change of ball size, index of refraction, ..).
Recommended starting point: Visual Studio project 086shader from the grcis repository or project sample09 from the ogl repository.
Copyright (C) 2013-2018 J. Pelikán, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)