Interactive WebGL Fractal terrains project

Project URL: https://simple-fractal-terrain.glitch.me

I’ll try to move (and remake) here my old Fractal terrains pages (https://www.ibiblio.org/e-notes/Splines/terra/diam.htm) with animations, “games”, “gardens”, WebVR/XR. Raw WebGL is used.

I’m not a JS expert (just too curious). I will be glad of any help (if you like this project). Any suggestions (e.g. about controls)?

Evgeny

2 Likes

Can you add a camera movement? Guess, for mobiles it won’t really work, but on PC it should be possible.

Also, looking through your code, it will be a real pain to read it because of it’s awkward code style and no comments at all. If you’re doing something interesting, try to explain most of the lines to not to get puzzled after a month.

Not sure what do you mean. You can move terrain by mouse or touches.

As for comments:

  1. not sure one need it :slight_smile:
  2. 1/2 of the script are controls. Shall I use them or something else more useful?

Sorry, I’ve meant camera movements like the player can move around the world (I was able only to rotate and zoom the scene)

About the comments: can you tell me what does this function do:

function rand(){
  r1 = r1*r1 - 2;  r2 = r2*r2 - 2;  r3 = r3*r3 - 2;
  return r1 + r2 + r3 - a;
}

By name, I could think it is a ‘random’ function which should return a random number. Well, in this case, I can hardly say what it might return!

Another good reason to comment your code is that the visitors would not able to understand what you’ve done there and what is it supposed to be, resulting to an ignorance and no support.

Anyway, great work!

Yes, I get but it is just the next step (scene) in the project: sail by sea, river, ride by mountain serpentine. Just look at www.ibiblio.org.
Rand is chaotic logistic map :slight_smile: Now I like algorithm “xor128” from Marsaglia, “Xorshift RNGs”.
Thank you for support. I’ll add comments but

what about controls (React?..) and

how to add 0DOF controls for e.g. VR BOX 2 controller in WebVR/XR? :slight_smile:
I have old WebVR Gardens at https://www.ibiblio.org/e-notes/webvr/samples.htm. To add them?

“Water racing” new demo at https://glitch.com/~water-racing.

Any idea how to add 0DOF controls (e.g. for my VR BOX 2 controller in WebVR/XR)? I’ll try A-frame for tests.

‘deviceorientation’ event handling is corrected (maybe due to horizontal landscape device orientation?). Tested on my Xiaomi phone with Android 10 (can’t get these events on my old tablet with Windows 10). You need to use ‘https’ in address string to use device orientation.