Inlägg

Visar inlägg från juli, 2019

Skybox

Bild
Altough this is not needed for the project, I decided to implement a skybox for the background. In the end, it wasn't that complicated. However, many tutorials online don't tell you all the details needed for implementing it. So I took out pieces of information from different tutorials and used a bit of trial and error. One thing that was confusing is that some sites refer to the model matrix as the "world matrix", but once I learned that these are the same it became much simpler. I also found some good free cubemaps online, but these are in the form of tga-files, and my texture loader only acceps png-files. I suppose that is something to consider for potential future work. Fox object with a cloudy skybox

Code Update

Today I have been working on re-structuring the code by adding more classes. This will help later on in the project. I also made a "Shape class" which I plan to use to instantiate many rigid bodies for the simulation. Each rigidbody has it's own shader reference and model matrix. I have been researching online about how to best handle 3D rotation along any axis. I am not 100% clear on how this will work out when I will want to have sudden rotations to the objects in any direction. I believe that by following tutorials and reading papers about rigid body simulations, this will eventually solve itself. I noted that I will need to save the orientation of each individual rigid body, and for this I will use a quaternion that represents that. Supposedly this will affect how some physics calculations are done in the code. I found an interesting powerpoint online which at least mentions this briefly which can be found here . Something I plan to fix next is the "game loop&q

Loading OBJ-files

Bild
I have currently managed to setup the code to load OBJ-files by which I use to render shapes. This will be necessary later on for colliding different objects. Technically one of the labs contained code for loading these files, however that code seems outdated. Also, I want to be able to load any type of OBJ-files, not just old ones. I took another course in computer graphics 1-2 years ago, there we were provided with code to load OBJ-files as well. This loader was good, but it seems to not be completely generic or contain bugs. It might be the case that I fixed a certain bug in that code, but I believe I saved that code on an external HDD which is far away from where I am at the moment. In any event, this code can be found here . So I continued my search online for finished C++ OBJ-file loading code, and found this header . I have right now a mix of the first and secondly mentioned codes. The first one provides a better quality but crashes if it doesn't load very specific OBJ-fil

Camera Done

I have setup a camera system by looking for guides online. By using W,A,S,D it's possible to move the camera forward, backward, left and right. E and Q rotates the camera. The look-at direction is determined by the mouse position on the screen. This is not strictly necessary for the project, but it's always useful to have a camera. Also, something that is different from the labs is that in modern OpenGL you create a model-view-projection matrix or a model matrix, view matrix and a projection matrix. The MVP matrix is then sent to the shader code and used there to multiply vertex positions with. In the animation lab track the matrices are stack-based and probably calculated on the CPU which is deprecated. The camera code was taken from "LearnOpengl" here . Next I am planning to do something that isn't needed for the project either, namely implementing a skybox, or a cubemap. I don't think it will be too difficult and wont take that long either. When that is

Initial Plan

So I have a plan for how I want to do this project. The goal is to be at least 90% done by the 1st of august 2019. The first thing to do is to setup a scene by which I can demonstrate my solution. None of the scene setup is that relevant to the project per se, but having good visuals are impressive for both graders and potential employers in the future. So what needs to be done is to setup my work environent using Visual Studio and GLFW. I have done this earlier so there may already be such a work environment readily available on my PC somewhere. I think that I also have Lua setup on that environment, which may be useful for making real-time changes to the code, instead of having to recompile a lot of times. I believe it was a good thing to try to create a rigid body simulation first. I will also do the course "Advanced Graphics and Interaction" as well as a master thesis later on related to graphics and interaction. To me this topic seems like it can provide a solid founda

Project type decided

I read about topics on GPU gems and found something similar to what I had planned in regards to collision. What I found is called "rigid body simulation". It seems like there are a lot of recourses about this topic online and it includes simulating physics which I find interesting. If this turns out to be too easy however, I may extend this project into a fluid simulation instead. According to GPU gems, the techniques used for rigid body simulation can also be used in fluid simulation. So by playing the safe cards first I can decide later if I want to put in more work.

Introduction

This is going to be my blog for the project part in the course DH2323. I will probably make a project involving collision detection between a shape and an uneven surface, perhaps best described as a set of connected triangles. I have not figured out the details of what I plan to do exactly, but besides solving a general problem statement, I also want to create a program that enables me to demonstrate it properly. I will probably use C++ and GLFW as well as GLM.