Pi3D used in GUI for WorldEngine

251 views
Skip to first unread message

Shando

unread,
Mar 1, 2017, 2:35:18 AM3/1/17
to pi3d
Hi All,

Just a quick note to let you know that I have almost finished my GUI for WorldEngine (http://world-engine.org) a World Generator using Plate Tectonics (see announcement here http://groups.google.com/forum/#!forum/worldengine).

As a part of this GUI I have integrated Pi3D to display the generated world in 3D with the ability to move/fly around.

It does have a few issues:

1)    Not sure how to generate textures based on type of terrain - I'm currently just using a Map that is generated by WorldEngine itself.
2)    Heightmap seems to be too small - I think this needs changing in WorldEngine, but if it can be changed in Pi3D, great!

My code for the 3D part is attached.

Any help would be greatly appreciated.

Thanks in advance

Shando
world3d.py
Message has been deleted

Shando

unread,
Mar 1, 2017, 2:39:37 AM3/1/17
to pi3d
Sorry, should have said it is for a Windows application :(

Paddy

unread,
Mar 2, 2017, 6:10:45 AM3/2/17
to pi3d
Hi, I installed worldbuilder and your repo on my linux partition (as I ran into so many issues installing worldbuilder on windows) As I was using python3.5 I had to tweak a few bits but not too bad. The gui came up and it generated a new world but didn't save any images and didn't think it had a world loaded when one was. This was probably because I didn't bother installing some of the requirements (OpenGL for instance)!

I'm not entirely sure what you mean by the height map being too small. You can scale the vertical displacement by altering the height argument to ElevationMap. As one unit in the pi3d view represents tens of km the value of height probably needs to be quite a low number.

There are two issues with the texturing. The first is that the resolution of the mesh is limited to 200x200 but the height map texture is 1024x1024 which means that the faces of the mesh loose some detail that is still there on the texture. It would be possible to alter the resolution of the mesh depending on the curvature of the surface as in the blender decimate modifier (below) but this is non-trivial coding!

None of the standard pi3d shaders cope with multiple Textures to be selected depending on the vertex properties. i.e. so you could have grass, rock, bushy, swamp, water vertex groups. In fact there isn't really any capacity in the vertex array data sent to the shader and you would need to squeeze it into the uv coordinate used for texture mapping. These use the range 0.0 to 0.9999 so you could use 0.xxx to mean texture 0 1.xxx for texture 1 2.xxx for texture 2 etc. However in the absence of this it is possible to get a reasonable effect by making multiple ElevationMaps that poke through each other and apply a different texture and/or normal map to each. This is what I have done in this video

https://youtu.be/mraZr6MsFoQ
code attached

blender decimate

world3d.py

Shando

unread,
Mar 2, 2017, 6:34:36 AM3/2/17
to pi3d
Hi Paddy,

Wow, you're vid looks so much better than I was getting (interesting idea about using multiple Elevation Maps - does it have much impact on performance??) :) I'll give your code a spin tomorrow (bit late here now to be trying to code!)

I think your problem with not saving images may be to do with the fact that you can only work with PNG files natively, otherwise you have to do some fiddling with PyQt plugins and image formats :( I probably should change the default from JPEG to PNG.

With regards to it not detecting a world, hmm haven't come across that before, but, as you probably know, being a one-man team you get so used to using all the possible shortcuts whilst testing that you tend to miss a few edge cases!!

Finally, wrt the heightmap being too small, I just meant that when travelling around the world, the mountains/hills just don't look high enough (probably because I'm used to a game engine where the camera is set to 1.8m from the ground).

Thanks for all your help.

I'll let you know how I get on.

Regards

Shando
Message has been deleted

Paddy

unread,
Mar 21, 2017, 6:54:45 PM3/21/17
to pi3d


On Tuesday, 21 March 2017 22:48:34 UTC, Paddy wrote:

I've modified the EnvironmentMap to take a map to allocate four textures and four normal maps to different areas. See: youtube video

Shando

unread,
Mar 21, 2017, 9:21:49 PM3/21/17
to pi3d
Hi Paddy,

Wow! Excellent stuff!!!

I must apologise for not getting back to you before now, but the Pi3D part of my WorldEngine GUI is now working great (thanks to your code of course!!) :)

I don't know if I'll have time to play with your recent changes as I start a new job on Monday and I doubt I'll have as much free time as I have had recently :(

Thanks again for all your help.

Regards

Shando
Reply all
Reply to author
Forward
0 new messages