3D Fractal Mountains

Just a first attempt to animate a 3D mesh.

At the beginning of “Main” there are options for choosing Gouroud shading and Colorization (v.s. Flat shading and B&W).
You can move with the standard dual sticks.

I’m having random problems with @Nat’s controller library; from time to time I receive “nan” values. Maybe it’s my fault, I have to work more on it.


You can download the code here: https://github.com/pepinganos/3D-Fractal-Mountains-in-Codea-for-iPad

That looks pretty neat, @pepinganos, I will be dissecting that code a bit to try and learn how you did it. Thanks for sharing.

That’s extremely impressive, @pepinganos.

You know, when Codea first came out, I really didn’t think it could handle much beyond the kind of simple arcade game I was cranking out circa 1980. Turns out, that’s just me. I’m blown away by where you guys keep pushing this tool.

Finally I’ve found the bug in Nat’s Controller library. When it detected a mouvement of 0 pixels, it returned “nan”. I’ve just added a line that corrects this.
In the function clampLen, I’ve added in the first line:

    if(vec == vec2(0, 0)) then return vec end

@Nat, were you aware of this?

I’ll correct the bug in my program later today.

In fact, I’ve found that the error is (I think) in the normalize function. When it receives a vector (0, 0), it returns a vector (nan, nan).
Try this:


What do you think of it, @Simeon?

That’s not a bug, that’s a feature. Simeon is trying to protect you from the Chrono-Synclastic Infundibulum that happens if you try to divide a zero vector by its length.

Nice video. But how can I paste this project to codea?
Copy-paste one by one files?

@geb, I think the best option is to transfer the files using iExplorer. You can also copy and paste, because there aren’t a lot of files in this project.

@Andrew_Stacey, I think you’re right. It’s the controller library that has to be fixed. The solution I proposed above would do it.

Good catch with the normalisation bug. I’ll fix it in the way you suggest and push a new version to GitHub as soon as I can.

This is superb. Thanks for sharing.

This would be really cool if it was combined with @KMEB’s FPS. I love this thing so much!