项目作者: HouPoc

项目描述 :
Using GLSL shaders to rendered scratched shield
高级语言: GLSL
项目地址: git://github.com/HouPoc/Rendering-Shield.git
创建时间: 2017-05-19T06:31:51Z
项目社区:https://github.com/HouPoc/Rendering-Shield

开源协议:

下载


Rendering Shield

Final Project of CS457 (Computer Graphic Shaders) at Oregon State University.

Project Description

This project was inspired by movie, Captain America: Civil War (2016). In this fight scene, Black Panther made a huge scratch on Captain America’s shield known as its indestructible. It was the first time I saw that the shield was scratched. I decided to reproduce that effect with shaders in OpenGL to commemorate that moment.

The whole project contains three parts: Build Shield, Made Scratches, and Add Lighting.

  1. Build Shield

    The raw shield object was imported from external obj file without any color on it. The first thing I did was to paint color on the shield in fragment shader. I used radius of the shield as parameters to paint the red color and math equations to draw the center star.

  2. Made Scratches

    The scratches on the shield was generated with noise functions and trigonometric functions. The core idea was modifying surface normal vectors to bump mapped the shadow on the shield without change the overall topology.

  3. Add Lighting

    After computing the normal, I added a light source into the scene and use BRDF equation to compute color for each fragment based on generated surface normal. There are four more parameters used here: Ambient Coefficient, Diffuse Coefficient, Secular Coefficient, and Shininess. The lighting source’s position can be adjusted, either.

    Rendered Result


render result
render result
render result

  • GLSL
  • Computer Graphic
  • Trigonometric Function
  • Vector Calculus

How To

This project can only work with Windows. To demo this project, you firest need to run glman/glman.exe and load the main GILB file src/Shield.glib. glman is a teaching-ware developed by Professor Mike Bailey and Steve Cunningham in 2006, and it is totally no-harm. After loading src/Shield.glib, glman will create a main display window and an user interface with several sidebars that control parameters in this program. You can play with them to see different effects. Note that src/Shield.vert and src/Shield.frag are vertex shader and fragment shader used in this program, be free to make some changes.

GLMAN Documentation

GLSL Documentation