A quick update on what I've been working on recently.
For one of my modules Simulations and 3D Graphics, we were set a task to learn lighting and materials. So far I have implemented a single light, using ADS and blinn-phong (again).
The camera can rotate, move forward/backward. The armadillo can be rotated on it's pedestal and the whole scene can be rotated.
Thursday, 25 February 2016
Sunday, 7 February 2016
This dragon is one of the many models which the Stanford University Computer Graphics Laboratory scanned. More info http://graphics.stanford.edu/data/3Dscanrep/. I used this to practice for an upcoming module, it is made in OpenTK and uses OpenGL 4.5.
Work for this included:
- Loading vertex and normal data from .OBJ.
- Parsing material file for Blinn-Phong attributes.
- Blinn-Phong glsl shaders.
- Setting model/view/projection matrices.
- Configuring camera and light positions.
Tuesday, 2 February 2016
Implementing this using one of my favorite frameworks (https://love2d.org/) in Lua was a lot of fun!
This is heavily inspired by Wolfenstein 3D.
It involved simple trigonometry, calculating ray/shape intersections, figuring out how to map textures and lighting effects.
A problem I encountered was a fisheye lens effect, because for each ray projected into the world, I would map the intersection distance directly to the height a wall (which is a group of line slices). However what I needed to do was calculate the perpendicular distance of the intersection using the projection plane as a reference.
Here's a great image which helped me understand the problem a lot, originally my raycasting method resembled the one of the far right.
Here are the resources I used:
- http://permadi.com/1996/05/ray-casting-tutorial-table-of-contents/ - Help with the projection plane/intersection distance calculation.
- https://en.wikipedia.org/wiki/Linear_interpolation - How I map the texture coordinates onto the side of a shape given a set of intersections with it.
Taken from Jakob Nielsen in his book `Usability Engineering`. Use simple and natural dialog/language. Since every additional feature or i...
Programming Tricks 1 PHP When creating PHP scripts, there is a funny error that if there are spaces before the first <?php tag, the s...
Programming Adventures 2 - Unity3D Translate When moving objects using gameObject.transform.translate(x,y,z) , its direction is based on t...