Recent

Author Topic: World map on a sphere.  (Read 16636 times)

RWC

  • Jr. Member
  • **
  • Posts: 92
Re: World map on a sphere.
« Reply #15 on: September 02, 2016, 10:45:37 pm »
Quote
Well here it is, anyone can dowload in Sketchfab or here, no annoying PM :)
https://mega.nz/#!6F8jRDjI!McHcRboueCF6n41fVEkzG54z9-NIhOolNUa_X-dMVt8
@Lainz: Brilliant! And a very generous gift for everyone too, thank you Lainz.

I’ve got it running in lainzmixer demo. As you say it is very slow: 1 step/second on this PC (GeForce GT610) & 1 step/ 7 seconds on the laptop (Intel HD Graphics).
 
At first I assumed ‘earth displace.png’ was only for Blender because its not in the mtl file & is so much larger than ‘earth.png’, i.e. 21600x10800 & 8192x4096 respectively. I did try smaller displacement maps & a completely black one to see if that affected the speed but they were all much the same.
Quote
…it has the .blend model that you can tune and set a different amount of subdivisions with the subsurf modifier.
Is that the subdivisions of the wire-frame sphere? Ok, I’ve now got Blender installed but when I opened the ‘earth.blend’ file the subsurf modifier shows 2 options: View is set to 3 & Render is 5. View does not accept 0 so I set Render to 0 & it rendered ok but the exported obj file was bigger than the original & ran at the same slow speed. I’ll have to learn Blender some more & maybe try a flat surface with ambient lighting. Blender & Sketchfab look very impressive & good resources for game/graphics programmer– so thanks for those pointers too Lainz (&Eugene) – best regards, RWC.

@Phil: WOW! All you guys are just so awesome I can’t keep up. Now I’m spoilt for choice. I’m looking forward to trying the QGIS with OpenLayers and QuickMapServices plugins & especially the P4G GIS controls in Lazarus. Thanks again Phil, great links & information.

And thanks to avra & Graeme for those links too.

@PaulFMichell: ‘Grid InQuest II’ is fantastic & very professional (& Free Pascal!). I was considering adding a GB OS option for the UK plotting so now I can do Ireland too. I’m looking forward to trying the text file conversion & digging into your math code if you don’t mind? A very good & flexible application. Thanks a lot for your input too Paul & best regard.

BTW I need to take my boy for a short holiday before school starts again so I’ll have to wait a few days to try out all these new options & get back to you all later.

p.s. My boy (now 15) is giving all his soft toy animals to charity but I’m keeping the baby Leopard?? (might make a good splash screen for ‘Built with Lazarus & Free Pascal’ or is that a Cheetah?).
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: World map on a sphere.
« Reply #16 on: September 02, 2016, 10:51:08 pm »
View must accept 0, is like no using subsurf :)
The view one is used to export.

Attached a copy with no subsurf, or the same subsurf at level 0 of the exported obj. It's really fast.

And yes, the displace file is only for blender.

RWC

  • Jr. Member
  • **
  • Posts: 92
Re: World map on a sphere.
« Reply #17 on: September 08, 2016, 03:18:45 pm »
Quote
Attached a copy with no subsurf, or the same subsurf at level 0 of the exported obj. It's really fast.
@Lainz: Fast! – Even on the Intel HD graphics it’s a wonder it doesn’t fly apart – better not add physics – or will that give us a pancake earth? :) - just joking.

I did get a shade stepping effects between segments with the ‘no subsurf’ version but since I only need ambient lighting I’ve turned the spotlight off to remove them (I commented out ‘add directional light’ in your code). That now looks surprisingly good for such a small obj file.
Quote
And yes, the displace file is only for blender.
The very 1st time I ran your original project with no displace map I got just a white sphere. When I added the map to the folder the “earth.png” then displayed correctly – so that’s what confused me but now all is good. I just need a BGRA layer for the DrawLineAntialias path plotting – maybe circular knows if that’s possible? ;)

@Phil: I’ve got QGIS & your recommended plugins installed ok – I’m still learning the program, buttons & view options etc. It looks good & very comprehensive. I’ve taken note of your comment regarding TmapViewer – thanks for that.
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: World map on a sphere.
« Reply #18 on: September 08, 2016, 03:26:01 pm »
Just ask him.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: World map on a sphere.
« Reply #19 on: September 10, 2016, 08:55:32 pm »
I just need a BGRA layer for the DrawLineAntialias path plotting – maybe circular knows if that’s possible? ;)
I am not sure what you would like. Can you expand on that?
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: World map on a sphere.
« Reply #20 on: September 10, 2016, 08:57:12 pm »
I just need a BGRA layer for the DrawLineAntialias path plotting – maybe circular knows if that’s possible? ;)
I am not sure what you would like. Can you expand on that?

He wants to draw in the sphere in a "new layer" for example to draw lines over it in specific places of the world map.

Maybe he can draw in the textured picture or draw in another bitmap and then show both in the sphere.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: World map on a sphere.
« Reply #21 on: September 10, 2016, 09:07:51 pm »
Hmmm... yes the simplest is probably to store a copy of the world map and create a texture of the same size and create a layer of the same size. Then to update the texture, to do a putimage of the worldmap and a putimage of the layer.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: World map on a sphere.
« Reply #22 on: September 10, 2016, 11:19:31 pm »
Maybe a sample code can help him to do this, usually drawing to OpenGL texture and showing it in a 3D model is something different that drawing with the normal canvas.

RWC

  • Jr. Member
  • **
  • Posts: 92
Re: World map on a sphere.
« Reply #23 on: September 21, 2016, 09:36:10 pm »
@Lainz: Sorry for the long delay – progress on my project is now very slow but my illness did give me an opportunity to try LazPaint.

@circular: It’s good to see you here too – LazPaint is brilliant – I’m really impressed how quick it starts up - no more twiddling me thumbs waiting for PhotoShop or Gimp to initialise! I also love the way the spline tool can be used at the same time as zooming with the mouse wheel. 

Anyway back to topic. Fisrtly I need to decide whether to go the GL route or continue using BGRA Layers.

Lainz is correct, if I do decide to go the GL route then I’ll need to draw dots & lines over your sphere.
I don’t think drawing on a bitmap will give me the accuracy needed when zoomed in. I’ve only had a brief look at the OpenGL tutorial & see I already generate x,y,z vectors in the same orientation as GL so I was thinking of using an array of GL_POINTS in GL_MODELVIEW & GL_PROJECTION should translate them to screen x,y’s onto your globe. Similarly GL_LINES, GL_LINE_STRIP, & GL_LINE_LOOP could possibly do the same for my lines & polygons. Also I want the view to be orthographic not perspective.

In the mean time I’ll be testing the speed of drawing a png heightmap tile onto the 2d base layer using maybe DrawPixel or FastBlendPixel. (I want to avoid using assembler in case someone wants an OSX or Linux version). 

All the best to both of you & thanks a lot for your help and interest - RWC.  :)
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

RWC

  • Jr. Member
  • **
  • Posts: 92
Re: World map on a sphere.
« Reply #24 on: October 10, 2016, 06:40:21 pm »
The speed test to draw the globe was excellent with BGRABitmap using GetPixel & SetPixel. The slowest part is my own routine to calculate Lat/Lon values from the screen xy’s.
I’m happy to stick with BGRABitmap for now because it makes it so easy – here’s screen shots of 3 zoom levels.

@Graeme: I’ve adopted your line segment method for drawing vector shorelines & it works great. Thank you, that will add a nice option to my view menu. :)
LAZARUS  : Lazarus-1.4.2-fpc-2.6.4-win32. OS   : Windows Vista 32bit Home Premium SP2.
CPU  : Intel Core2 Quad CPU Q6600 2.4GHz. RAM : 3GB. PCIE : NVIDIA GeForce GT610. Audo : NVIDIA HD Audio.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: World map on a sphere.
« Reply #25 on: October 10, 2016, 07:01:33 pm »
Looking good, well done :)

 

TinyPortal © 2005-2018