Hoimar / Planet-Generator

A procedural planet generator addon for Godot with terrain LOD.
Other
201 stars 23 forks source link

Applying custom visual shader to the planet? #8

Open Valinakova opened 3 years ago

Valinakova commented 3 years ago

An idea: A feature which allows users to apply their custom shader to the planet, and allow height map based on that shader. Is something like this possible? I tried changing the material but it doesn't override what was there before as seen in the test below.

image

Below is example of a texture I may try to apply: image

Hoimar commented 3 years ago

That should be possible actually. Did you click "Do Generate" in the inspector after you set the new material? Do you get errors in the output? You can create a heightmap shader, but currently the actual geometry is generated on the CPU frome the noise generators. The generator only stores UV values in the mesh which are then usable on the GPU (e.g. shader).

Valinakova commented 3 years ago

Ok, it works now! As for heightmaps,

Ability to mix height map geometry with the noise generated ones. Is this something that you are/will work on? It could be quite useful. I could probably adjust the height map based on the ocean moon above so even when zoomed out and the "water" sphere fades out, the oceans are still visible and remain the same shape. The benefit of the noise generated texture is the LOD effect which, if combined with a height map adds more detail.

Hoimar commented 3 years ago

So you're talking about a heightmap that would be usead either instead or together with the procedural noise? The former is on the roadmap but could be a bit complex to implement. Can't promise anything yet but I'm committed to improving the addon :) You may want to try the new changes I pushed, I fixed some terrain seam issues (but the water sphere is still off, it will need replacement as well). But yeah, it's all in an early state, I didn't dare to introduce versioning yet :smile:

Valinakova commented 3 years ago

I'm quite excited to see the future of this addon. I tested it out, yeah the frame rates are noticeably higher. Getting consistently 20 FPS w/ RX 550 and its consistent. I also don't see seams issues so far. I do notice, though that for some of the smaller details, they can take a while to load. Like I would glide down to the planet, hang around for 10-20 seconds before the higher levels of detail pop up. Are you experiencing that?

As for height maps, I do wonder if it's possible to also get those small details on the vertexes in addition to a height map. It be cool to be able to have a height map that is many KM wide while being able to produce vertex features < meter in size.

Hoimar commented 3 years ago

Nice, so am I :wink: Your performance still seems to be quite low, I'm consistently getting 60 FPS even if cruising around planets at surface level with max. speed (using an RX 580). This is a basic "benchmark" because it queues lots of terrain jobs, and indeed, all 12 cores of my Ryzen 5 1600X (12) @ 3.600GHz are pretty busy with the latest optimizations (some of which are not upstream yet, I'll push them soon).

Let's see if we can fix that, please run a few tests.

You can also use the Godot Profiler and the Monitors tab to gain more insights.

That would for sure be nice to have, heightmaps combined with procedural noise. I'll see if I come up with something.

Edit: Your general performance issue actually looks like the GPU bottlenecks it, consistent 20FPS say that the GPU is under heavy load. And I tried gliding down to the planet very quickly and it takes about 2 seconds until I have full detail. What does the little HUD in the upper left say for queue size in these 10-20 seconds? Is it busy?