Geometry Shader
The geometry shader is a programmable shader located after the vertex shader and before the rasterization stage. Where the vertex shader processes vertices, and the fragment shader fragments/pixels, the geometry shader processes primitives. Depending on what the input is set to, the geometry shader takes in a single triangle, point, quad, etc… and can perform operations such as removing/adding or even changing them. The geometry shader can output a completely different primitive from the input.
The geometry shader can be used to create particles by receiving a point and outputting a quad representing the sprite of the particle. With this, all that is needed are the locations of where each particle should be located.
Another use for the geometry shader is for tessellation – increasing the number of polygons thereby making the model more detailed. With tessellation, a low-poly model can be loaded and altered into a high-poly model using just the geometry shader; saving on the costly overheads of complex models. With OpenGL 4, this can be done using the new shaders – the tessellation control shader and the tessellation evaluation shader.
Development Progress
It’s been a while since I gave an update on out game. Let just say things are progressing bit by bit. Loading in the island map and performing collision detection against it to determine player y position was more troublesome than anticipated; from implementing ray-triangle intersection to finding a way to interpolate between triangles without the jitter moving between triangles. The terrain collision is performed by using the Möller–Trumbore intersection algorithm to cast a ray from the player straight down and checking if the ray has hit a triangle of the terrain. If the ray hits a triangle, the weighing of the vertices of the triangle need to be determined to calculate the y value of where the ray hit. This is done by using Barycentric interpolation which essentially uses the areas created by the triangle and the point of intersection to determine weighing.
Terrain Collision |
With the new
island level, and celshading applied to it, things are really coming together from
a graphics point of view. Post-processing motion blur has also been
implemented, but requires some tweaking. Gameplay however is an issue; at the
moment there isn’t much to do other than to run around to reach the end. There
are plans to have a stream of lava creeping behind the player and another
possibility is having randomly falling debris from the eruption.
Screen Space Motion Blur |
As we’re
only about 2 weeks away from gamecon, there are still many features
that should be implemented in game such as shadows, fluid effects for the
ocean, etc... If there is one lesson to take away from the Monday lecture is that
we need particles. From the screenshot, it is clear that the sky is lacking detail,
not to mention that there should be dust clouds and smoke from the volcano
erupting. The past lesson to take away is to try adding some of the Brutal
Legend VFX. What would also be interesting is to have cartoony particle effects
similar to Wind Waker.
Geometry Shader. (n.d).
In OpenGL Wiki. Retrieved from https://www.opengl.org/wiki/Geometry_Shader
Hardgrit, R. (2011).
Legend of Zelda: Wind Waker. [Screenshot] Retrieved from http://superadventuresingaming.blogspot.ca/2011/08/legend-of-zelda-wind-waker-game-cube.html
Rideout, P. (2010,
September 10). Triangle Tesselation
with OpenGL 4.0. [Web log post] Retrieved from http://prideout.net/blog/?p=48
No comments:
Post a Comment