Simplified Flight Model

The Web GPU version of Ocean module now available. Thanks to the assistance of Attila Schroeder, I was able to convert the WebGL version to a WebGPU version with improvements. You can view the module at my GitHub repository (Ocean4.html in the jsm directory). The fdem_ocean_spu_gh.html file shows the module in action. (You may have to hit reload to get it to display the sky.)

Note that this module is merely an extract of a full-fledged version created by Attila Schroeder. This version is supposed to look decent at varying altitudes and does not provide for extreme settings (since you should not be flying in that kind of weather). However, it should provide programmers with a basic understanding of how to create a WebGPU “daisy chain” operation in three.js. This is a work in process, so any suggestions for improvement are appreciated.

Here is the latest version of my flight simulator demonstrator. This is essentially a WebGPU version of the original WebGL demonstrator, upgraded to work with r167 and which uses NodeMaterials. The source code is available on my GitHub repository.

This version of the flight module includes an autopilot, which allows for fairly steady operations using only the arrow keys.

Many thanks to prisoner849, PavelBoytchev, manthrax and others for help with creating sunflare and the emitters.

3 Likes

This is awesome. (my main request would be to have mousewheel throttle way more sensitive. It took me a long time to get the throttle to max with mousewheel.)
I’ve always wanted to play a modern version of Hellcats over the Pacific, and this is reaaal close!
Very very cool.

Done. Increased throttle speed by 10. (rev. 240829a)
I am still trying to fix some of the small details, like getting the shadows to not create a gap, creating a tsl version of my waving flag routine, fixing the guns and the carrier landing, etc.
But I do have a Blender model of a Zeke Model 52 waiting in the wings and hope to be able to allow you to fly some air combat maneuvers against it. The FM2 and Model 52 were fairly evenly matched, so it should be fun.

1 Like

I updated the airplane WebGPU simulations to r169. With r169, the shadows are now mostly fixed. I added adjustments for decreasing air density as you climb and for the effects of non-standard temperatures.

On the FM2 Wildcat simulation:
The guns are working (press the space key) and you can land on the carrier again (remember to drop the tailhook for auto-braking). Since this demo is in the South Pacific, I set the temperature to 86F. The Airspeed indicator now shows the indicated airspeed (IAS), which drops as you climb.

And, just for fun, the FM2 Wildcat now starts on the moving carrier. Lower the flaps (f) for a shorter take-off run.

Keypad Users
Looking back through the comments, I realized that I had not added keypad commands for power and yaw. I have created 2 sets of commands for right and left handed users:
Right-handed - Power up/down:= and -; Yaw left/right = z and x
Left-handed - Power up/down: w and q; Yaw left/right: . (period) and , (comma)
Sorry for not adding these sooner.

Questions
I will soon remove the WebGL versions with node materials since those cannot be upgraded past r165. Should I continue to upgrade the WebGL2 versions? Should I upgrade versions where the ocean is not animated? Note that the Flight module will work with all the airplane versions.

I have focused mostly on the FM2 Wildcat simulation. I do plan to eventually get back to the Sopwith Pup (perhaps add a cockpit view) and to the Huey helicopter simulation (which is still in WebGL2 r158).

Oct 7 Update

The FM2 Wildcat simulation has now been updated to allow operations on a pitching carrier deck. It’s not quite as extreme as this:


But enough to give you the feeling of motion.

While you are sitting on the carrier deck, you can also enjoy watching the little animations - the waving flag and radar. And don’t take off until the carrier starts pitching up!

1 Like

awesome progress! I did notice my first load was slow because the cdn link was being slow… for some reason the LensFlare.js file was stalling in the network tab, but then eventually loaded. The thing that sucks about CDNs is that your app is limited to the lowest responsiveness between what is local and what is coming from cdn. Might be worth pulling those dependencies locally? (or maybe finding a faster cdn)

The graphics are looking amazing! The flight model is a bit stiff still but I at least got a good touch and go on the carrier. :smiley: the flaps and gear stuff is great, though I had a hard time imagining I could get a slow enough approach to land on the carrier.
does gear and flaps really deploy that slowly IRL?
I love the tracer rounds… very very cool…
Might I suggest adjusting the pitch (detune) of the engine audio, based on the change in airspeed? so the engine pitch would change as you were climbing and the engines were pulling harder in the air? would also help the sense of speed/responsiveness if there was more audio change/feedback.

really digging where this is going. :smiley:

1 Like

Thanks for the feedback!

Are there faster loading cdns? I think you (or someone else) suggested an alternative source.

The flight inputs have a lot of variables - including speed and lag in/out. It would be nice to have some kind of settings screen to allow the user to change and save these variables while in flight. Any ideas as to how I could do that?

I made it so forgiving that you can basically crash on the carrier deck. Perhaps that is another setting that is worth changing - which would require you to touch down within a more demanding set of variables.

I believe I have the correct timing for the gear and flaps. The pilot cranked the gear up and down manually using the crank located below the pilot’s left elbow. It took 29 rotations to crank the gear up or down - which is why these airplanes appeared to wobble after take-off as the pilot cranked up the gear. [CORRECTION: The crank is the one on the right side. See this video.]

That’s a great idea about changing pitch. I currently only change volume and playback rate. I will have to look into detuning. FYI, I use two engine sounds - one for the engine and one for the props. They seem to work pretty well together.

I need to add some crewmen to the ship. From videos I have seen, the officers stood on the island and the crews all stood in the areas alongside the deck. There is currently only 1 guy on the island and you can barely see him.

MORE
I went back and flew it with the sound on (something I usually don’t do) and it sounds pretty correct to me. I have over 500 hours piloting small aircraft so that is one thing I should remember. I can check out some in-cockpit videos of the FM2 (here is one for the Wildcat) and I can also check with a pilot who flies this FM2 for the CAF, But I am always open to suggestions for ways to improve my program and will look into detune. You never know what you are missing until you try something. :smiley:

AND
While watching the flight video above, I realized that the cockpit glass throws an “outline shadow” on the wing. Any idea how to do that little trick?

1 Like

Yeah don’t get me wrong. It’s amazing. r.e. the timing… i believe you. I’m probably just used to more arcadey sims i’ve played before. the realism is awesome.
r.e. the 2 sounds… yeah that’s perfect… I bet if you added some detuning to the 2 sounds as they blend according to throttle, you can it pretty organic/realistic sounding.
Also maybe some lag on the camera? That can emphasize the sense of accel/deceleration.
Cool stuff.

r.e. the outline on the wing… if your cockpit+plane has castShadow/receiveShadow, it might just work? if you have a shadowcasting light following the plane…

1 Like

What is the difference between detuning and playback rate. Don’t both affect the pitch?

There is actually no canopy glass in the cockpit view. And, in the external view, where there is canopy glass, I made sure to turn castShadow off. Otherwise, it would cast a solid shadow on the wing. I think the outline shadow occurs in real life because the sun is trying to pass through a curved area of the glass, which causes some scattering. Kind of like the scattering that causes shadows on the bottom of a pool with waves. I don’t know if three.js is equipped to handle that kind of complex effect. I may be able to come up with a kludge to create the effect - or not. That is not extremely high on my to do list, just something I noticed.

1 Like

UPDATE (23 Jan 2025)

The simulations have now been updated to r172.

To keep things interesting, I have decided to convert the FM2 flight simulation into a combat simulation. This is how I am setting the scene:

While attempting to rejoin their task force, the carrier “Savo Island” and it’s destroyer escort have run across an uncharted island (possibly a newly formed volcano) on which the Japanese have established an air base. While small, this base poses a direct threat to trade routes in the Pacific. Consequently, we have been ordered to “take it out”.

Resistance on the island has been greater than expected. Instead of unskilled rookie pilots, the Japanese planes are manned by a squadron of highly skilled pilots (perhaps originally on R&R) who are willing to fight to the death and have, so far, rebuffed our efforts.

So the island is now a Japanese-held island. So far, I have:

  • Created Japanese anti-aircraft guns (with blue-green tracers) and flak explosions with sound.
  • Added the Fletcher destroyer to our group of ships

Once the Fletcher clears the nearby island, it will start shelling the Japanese base, setting one of the hangars on fire. So I need to create fire trails and modify the volcano smoke.

I also plan to populate the carrier with ship crew with limited animations.

Then it is back to Blender to update my Japanese Zero into a slightly animated opponent aircraft. Later, I can convert the Zero into a fully-animated flyable airplane and give you the option of defending the island.

As I “lock down” these special effects (e.g., AA guns, animated flags, ship wakes, smoke, black out/red out), I can transfer them into a separate module to reduce the size of the main program and make them more easily accessible to programmers who want to create their own combat simulations.

Hopefully, this will be a fun exercise for all.

1 Like

UPDATE (22 Feb 2025)

This past month, we have added a lot of “eye candy” to the FM2 flight simulation. This includes:

  • Adding anti-aircraft effects (both static and from a moving ship). You can see tracers and a puff of smoke when the AA shells explode. The sound from the explosions is delayed based on distance. These are part of a new GunASG module.
  • A Japanese Zero is now circling with our fellow pilot (fly to the AA smoke and you will see them). The Zero is firing his guns and our fellow pilot has been hit and has a smoke trail.
  • We have added a couple of rigged animated characters to the flight deck (the characters are in the new Peeps directory). The plane handler is just waving his arms now - but will soon be going through the whole range of signals, e.g., stop, set brakes, lower flaps, and proceed. There is another individual standing by the side of the deck - but it is hard to see his animation. IRL, the deck crews are all standing in the walkway next to the deck - but it is really hard to see them from your plane.


Here you can see a lot of the items discussed above - the animated people, the AA fire and the waving flag (from an earlier update). I have no idea why the sea is purple in this screen captured image.

ADDITION: It turns out that all my Navy Blue oceans had taken on a violet hue, especially noticeable at altitude. Navy Blue has a red component which can, if emphasized, cause the color to shift to violet. So I have switched to an Ocean Blue - which does not have a red component.

3 Likes