CMM-22 / a2

CMM Assignment 2 - Kinematic walking controller
1 stars 0 forks source link

[Announcement] Ex.5 Complex terrain for extra 5% point #3

Open eastskykang opened 2 years ago

eastskykang commented 2 years ago

If you are already done with all exercises (and also bored), please try to implement exercise 5 for a more complex terrain loaded from a mesh file. If you manage to successfully implement this, you will get extra 5% point (but your final point cannot exceed 100%)

This could be pretty complicated and may require a lot of code modifications. So please create a new branch called meshterrain and work there while keep your successful implementation of Ex.1~Ex.5 on the master (or main) branch. Again, please make sure your implementation of Ex.1 ~ Ex.5 stays safe in master (or main) branch. It's your responsibility to keep the main branch clean and working.

Successful implementation will looks like this:

image

Click this for demo video

You can download a terrain file you want to use from any internet source, but if it's hard to find one, you can use one in data directory data/terrain/terrain.obj

Note. You may need to read the code base thouroughly and spend quite some time.

Let me give some hints:

  1. You can create a 3D model from a mesh file by
// for instance... let's say we use terrain.obj file.
Model terrain = Model(CRL_DATA_FOLDER "/terrain/terrain.obj");
  1. You can draw a mesh by
// in app.h
virtual void drawObjectsWithShadows() override {
    // TODO: comment this line
    // ground.draw(shadowShader, V3D(0.6, 0.6, 0.8));

    // TODO: and add this
    terrain.draw(shadowShader);
    robot->draw(shadowShader);
}
  1. You can use the following function for getting a ground height
// member function of Model class
bool Model::hitByRay(const P3D &r_o, const V3D &r_v, P3D &hitPoint) const;

the strategy is as follows. From underground e.g. (x, -1.0, z), we will shoot a ray toward the sky (straight up) and then will find a hitPoint. The hitPoint.y is the ground height at (x, z) coordinate.

AnqiaoLi commented 2 years ago

Hi, @eastskykang, do you mean we should put Ex1, Ex2.1, Ex2.2, Ex3, Ex4 in the main branch? Because in the README, we are told to put Ex1-EX4 in the main branch and Ex5 in the "ex5" branch.

eastskykang commented 2 years ago

Yes.

On Sat, 19 Mar 2022 at 23:31, AnqiaoLi @.***> wrote:

Hi, @eastskykang https://github.com/eastskykang, do you mean we should put Ex1, Ex2.1, Ex2.2, Ex3, Ex4 in the main branch? Because in the README, we are told to put Ex1-EX4 in the main branch and Ex5 in the "ex5" branch.

— Reply to this email directly, view it on GitHub https://github.com/CMM-22/a2/issues/3#issuecomment-1073114848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXEFLCOQGLMXCWT5EVMIOTVAZBS7ANCNFSM5QY3BAPA . You are receiving this because you were mentioned.Message ID: @.***>