*******************************************************************************************************************************************
Day 4, 5 august 2022, Fixed advanced earth demo for software rendering. Massive fails: Tried to download/load better 3D Earth + Google maps
*******************************************************************************************************************************************
Video log of my activities of Day 4:
https://youtu.be/pIKpmfasAec
4.0 Even though day 4 ended in a massive fail, it was still an important day. This day I discovered how to fix the software rendering for GLScene.
This is especially handy for the advanced demo: Earth.
In folder:
..\GLScene\AdvDemos\Earth
4.1 Fixing the Advanced Earth Demo for software rendering:
4.1.1. Change GLSceneViewer.Buffer.ContextOptions.roSoftwareMode to true.
4.1.2. Change GLSceneViewer.Buffer.AccumBufferBits from 0 to 8, 16, 24 or 32.
4.1.3. Deleting the flare component from the sun component:
GLScene(right click)->Show Scene Editor->LSSun->GLLensFlare1
Right click->delete object
4.1.4. Disable following two lines in GLScene library unit: GLS.Graphics.pas
for slice := 0 to d - 1 do
begin
// Skybuck: disabled, buggy in software mode
// Build2DMipmap(GetLevelAddress(0), LAddresses, fColorFormat, fDataType,
// AFilter, GetWidth, GetHeight);
for level := 1 to fLevelCount - 1 do
Inc(PByte(LAddresses[level - 1]), GetLevelSizeInByte(level) div d);
end;
4.1.5. Disable the following line in fEarthd.pas:
procedure TForm1.GLSceneViewerBeforeRender(Sender: TObject);
begin
// GLLensFlare1.PreRender(Sender as TGLSceneBuffer);
4.2 A bigger/more detailed Earth 3D model was tried. However it sucked, the 3D model itself was just a sphere with triangles the texture maps
where weird. Most 3D Model sites found with google suck and require payment of money.
https://sketchfab.com/3d-models/earth-globe-98d2b04d46474bafb4250cc75dc583b3
4.2.1 Conversion from FBX to OBJ was done:
https://www.autodesk.com/developer-network/platform-technologies/fbx-converter-archives
4.2.2 Difficulty loading MTL into GLScene, FAILED, undocumented, unknown.
4.2.3 Difficulty loading Texture maps into GLScene, not even tried, because of 4.2.2
4.3 Google Earth library 1.5.3 for Delphi was tried. However it cannot be used because Delphi's TWebBrowser component relies on Internet Explorer and
Internet Explorer does not support the javascript api of google earth. Very maybe chromium browser could be used by changing some include file.
Howebver chromium is a different browser than chrome from google. Chromium requires some kind of building of files, way too much work for nothing most likely
so this was not tried.
https://sourceforge.net/projects/gmlibrary/
***************************************************************************************************************************************************
Day 5, 6 august 2022, Loading JSON file with country coordinates/lines and visualized/converted them to X,Y,Z coordinates on globe, quite awesome !
***************************************************************************************************************************************************
(Forgot to post this link in day 3 log so for those that missed it here it is):
Video log of my activities of Day 3:
https://youtu.be/nD6g7APLhMY
Video log of my activities of Day 5:
https://youtu.be/OVv7J6YfM0o
5.1 This day was an awesome day, it made me so happy I played the starwars theme song as I completed the mission for this day:
Load the country borders of earth, try to visualize them in GLScene and added bonus, try and convert the coordinates from latitude, longitude to X,Y,Z
3d coordinates on a sphere. Big Success ! JSON was parsed using a library I already had installed and used before:
For easy to use, very powerfull, very fast JSON parser !:
5.1.1 JSON data download for earth country lines:
https://github.com/martynafford/natural-earth-geojson
5.1.2 JSON Parser used:
https://github.com/ahausladen/JsonDataObjects
5.1.3 Explanation of Earth X,Y,Z coordinate system:
https://en.wikipedia.org/wiki/Earth-centered,_Earth-fixed_coordinate_system
5.1.4. Explanation of lat/long to x,y,z conversion formula:
https://en.wikipedia.org/wiki/Geographic_coordinate_conversion
5.1.5 Converted this python code to Delphi to convert Latitude, Longitude coordinates to X,Y,Z:
https://gist.github.com/mpkuse/d7e2f29952b507921e3da2d7a26d1d93
5.2 Scaled Earth in Y direction (important to visualize lines better).
I also played a bit with earth scaling options, this is kinda cool, now earth can be a bit more realistic by scaling it in the Y direction slightly,
this also helps to render the lines for the countries better.
5.3 Playing with atmosphere.
I also played a bit with the atmospheric rendering/constants to try and make it look a bit better, using real earth radius and such in km:
https://en.wikipedia.org/wiki/Earth_radius
5.4 High detail of country lines (10m a little bit slow on software rendering)
I also managed to load a more high detail version of the lines to show the country lines better, this does slow down the renderer a little bit, a slightly
less accurate version could also be tried. So far the 10m seems to be the most accurate. A 50m version could be tried to speed it up a little bit.
(Same link as above, mentioned one more time here ;))
https://github.com/martynafford/natural-earth-geojson
5.5.1 Huge Visible Earth Map (failed to load, too big)
I then proceed to try and download and load a VisibleEarth High Resolution Map (43200x21600) assuming it would simply display and load in glscene.
https://www.h-schmidt.net/map/
5.5.2 Windows 7 System Crash, and Image/Photo/Graphics Software Failures
Boy was I in for a surprise: Not only did windows 7 completely crash and restart, GLScene/Delphi also fails to load it because TBitmap cannot handle this size,
All other software I tried also failed: paint,
mspaint.net, glassimage, gimp and photoviewer. All for different reasons, mostly out of memory reasons or 3D issues.
So unfortunately the day ended in another mass fail, but good progress was made ! ;)
(I didn't see the crash of windows 7 because I bailed to my bed to rest lol, but when I came back the system had rebooted and I checked the system log):
Bugcheck: 0x00000018 (0x0000000000000000, 0xfffffa8005fe0570, 0x0000000000000002, 0xffffffffffffffff)
There were some other peculiar thing in the system log, like the firmware limitting certain processors, possibly system getting to hot.
Main cause of crash seems to be failure of system to respond in time, possibly caused by out of memory situation.
I checked the youtube stream nothing is visible on it concerning the crash lol. It would be diserably to have a seperate system for live streaming
to catch these crashes lol, not that it matters that much, just a funny thing to see/notice, but could also be used to attack windows systems !