Starting from:
$35

$29

Solved:Programming Assignment #6 Solution

Description

Your task is to write some shaders in GLSL; specifically a pairs of shaders – a fragment shader and an associated vertex shader.

This used to require building an application, getting some geometry, attaching the shader to it … but in the modern era, we can use the web! There are a few “shader sandbox” websites out there. Both are cool websites where you can type in shader code and see it applied to a model in real time. They let you try writing shaders with a minimum of fuss – just focus on writing the shader! They even helps you by giving you sample fragments of code.

http://shdr.bkcore.com/ 0(http://shdr.bkcore.com/) is a simpler one that we have used over the years in CS559, with reasonable success and a small number of hickups (that seem to change from year to year, but typically not particularly problematic – this year it appears that the only issue is that the URL “Shorten” utility in the “Share” button doesn’t work anymore, since it depended on Google’s URL shortener that is no longer operational). But it should be perfectly sufficient for your purposes.

The intent of this assignment is to make it relatively easy to get a “3”, i.e.

a satisfactory grade. In particular, to meet that standard your shaders need to meet the following requirements:
     Programming Assignment #6

Requirement #1. At least some of the shading/lighting computations need to happen in the fragment shader. That’s to say, you should do something different than computing a per-vertex color and simply interpolating the color itself across each triangle by assigning it to a varying and directly using it in gl_FragColor as this shader 0 (http://goo.gl/ORVZrq) does (again, to avoid confusion, this is what you should not do; perform some of the shading calculations in the fragment shader, like this example 0 (http://goo.gl/ooE6NL) instead).

Requirement #2. Implement a shading model that includes at least diffuse reflection or specular reflection (ideally both, but at least one of them).

Requirement #3. Use the “time” uniform provided by shdr.bkcore.com to


have some element of your scene change dynamically over time. You have many options how to do this … you can change the shape of the geometry being drawn, you can change the location of the light source (see this example 0(http://goo.gl/2qVk59) ), you can change the color of the object or the color of the light, you can change the fragments being discarded, etc … this example 0(http://goo.gl/gMWgIO) does several of these things at once!

As always, you are encouraged to try and exceed these requirements, and if you do well, you can compete for a “4” above-and-beyond grade. Here are some ideas (you should try multiple of these, to be more competitive for this grade!)

Use multiple lights, maybe with changing colors, or changing locations.


Make sure to incorporate both diffuse and specular reflection.


Make the color of the object (the underlying “intrinsic color” of the object, that is, not just the apparent color due to lighting) vary across the spatial extent of the object. Here 0

(http://goo.gl/36jtDv) are 0(http://goo.gl/1tVj5D) some 0(http://tinyurl.com/y2y5sd8v)

examples.

Make the geometry of the model being shown “stretch” or otherwise deform. You can do it by applying transforms to the vertex positions in the vertex shader. This example 0 (http://goo.gl/gMWgIO) takes this principle to the extreme!

Use the “discard” functionality to create interesting/artistic transparency.



 

More products