This assignment makes use of the files contained in this zip file and the files from a new version of the renderer, Java renderer (ver 3). This assignment is due Tuesday, April 22.
The new version of the renderer is a "programmable renderer" (much like a modern graphics card). It lets you add new stages to the rendering pipeline. These new stages are usually called "shaders". In this assignment you will write a few "shader programs". This gives you practice in using the ideas that we covered in class when we talked about the lighting stage of the renderer.
In the zip file there is code for two demonstration shaders called ColorShader.java
and DropShader.java
. There are also two client programs that use these shaders, ColorShaderClient.java
and DropShaderClient.java
. These programs give you an idea of how to write a pipeline shader program and how to build a custom rendering pipeline that uses the shader.
For the first part of this assignment, you need to write a shader called FlyApartShader.java
and a client program that uses the shader, FlyApartShaderClient.java
. The FlyApart shader makes every triangle in model move a small amount in a direction perpendicular to the triangle. For each triangle, you will need to compute its normal vector, and then move each vertex of the triangle in the direction of the normal vector to create a new triangle. How much a vertex is moved is a parameter to the constructor of the shader. In the zip file there is a compiled version of this part of the assignment so that you can watch it execute.
For the second part of this assignment, you need to write a shader called TiltShader.java
. (Its client program, TiltShaderClient.java
, is provided for you.) This shader tilts every triangle slightly in the direction of the Light vector. The effect is not all that interesting, but this is a good way for you to write a piece of code that makes use of the Light vector. In the zip file there is a compiled version of this part of the assignment so that you can watch it execute.
For the third part of this assignment, try to come up with a shader idea and implement it. Some sample ideas are in the file Ideas for shaders.txt
(you can implement any one of those ideas or come up with your own idea). Provide a client program that demonstrates your shader. Call your shader and its client MyShader.java
and MyShaderClient.java
.
Turn in a zip file called CS590Hw2Surname.zip
(where Surname
is your last name) containing your versions of FlyApartShader.java
, FlyApartShaderClient.java
, TiltShader.java
and MyShader.java
, MyShaderClient.java
.
This assignment is due Tuesday, April 22.