Code inspiration and rendering resource

FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

I think it follows on nicely from the link above about simulation, function and planning generation techniques. Combining them all.

It's a bit like we use heightmaps, bare with me whilst I maul an analogy.
They're like a planned approach, a fixed chunk of data that was defined elsewhere manually.
Then we apply the functional stages noise over the top.

Something I started but wasn't quite smart enough to figure out was a simulation process like Experilous World Builder.
I wanted to use it as an input to our noise system, like the heightmaps, to apply it over the top for better refinement and detail giving us a physical process underlying things.

Finally there's two approaches we could/should consider using which is applying planned features like:
  • Hand made features such as craters (with peaks/slope/etc), crevices, steppe, volcanoes, etc applied before the noise.
  • The overriding terrain flattening around stations applied after the noise.
Honestly I wish I was smarter at figuring these things out :D I get things done not by being smart but by having a very solid head to butt against them for long enough!
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

Online book about pcg techniques over at http://pcgbook.com/
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Code inspiration and rendering resource

Post by impaktor »

And what does my eye spy in chapter 6? LISP! Ahhh. I really should finish SICP, (wiki), (MIT), it's an amazing book, and Scheme is so beutiful.
(It's litterally lying on my coffee-table gathering dust, since I haven't touched it in +1 y)
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

I've been meaning to post this article about SoA's terrain generation because it is "complete", it covers seemingly every step you might be interested at first.
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Code inspiration and rendering resource

Post by impaktor »

FluffyFreak wrote:I've been meaning to post this article about SoA's terrain generation because it is "complete", it covers seemingly every step you might be interested at first.
Interesting article. I didn't know / hadn't really thought about, how all the noise functions separate and are combined. And he does it using a (seemingly) simple YAML-script. Is the idea to have one for each planet type? One Terra.yaml, and one Luna.Yaml for instance? We have this hard coded in pioneer, as some 20-ish different terrain types, I've heard?

I'm curious about the terrain generation branch that you have been playing with over the years for pioneer. Although I've never attempted to understand pioneer's current terrain code, I've heard it leaves a lot to be desired when it comes to code sanity, so I assume your terrain code is saner? Apart from not suffering from the spiky asteroids (I assume), does the result look better than pioneer's current terrain? Any nifty features to teas us with?

(See what I did there, now, it's like now I'm poking you :))
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

Since this is a rendering resources thread here's GTA-V Graphics Study!
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Code inspiration and rendering resource

Post by impaktor »

You beat me to it. Although that article is too long for me to read in its entirely and all details are beyond my understanding, I find hard optimizations very interesting. Just like the Retro City Rampage video, and also, I saw a 40-ish minute talk by David Braben (not on youtube, somewhere else), on all the insane stuff they did to get Elite running.

Also, in the book "Surely you're joking Mr Feynman" there's a long chapter on the Manhattan project, and how they optimized the crap out of the mechanical/punch-card IBM computers they had.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

impaktor wrote:Interesting article. I didn't know / hadn't really thought about, how all the noise functions separate and are combined. And he does it using a (seemingly) simple YAML-script. Is the idea to have one for each planet type? One Terra.yaml, and one Luna.Yaml for instance? We have this hard coded in pioneer, as some 20-ish different terrain types, I've heard?

I'm curious about the terrain generation branch that you have been playing with over the years for pioneer. Although I've never attempted to understand pioneer's current terrain code, I've heard it leaves a lot to be desired when it comes to code sanity, so I assume your terrain code is saner? Apart from not suffering from the spiky asteroids (I assume), does the result look better than pioneer's current terrain? Any nifty features to teas us with?
Yes, I see what you did there :)

I guess they just have another YAML file per-planetary-type. Or maybe a selection for each type. For example we have a bunch of different options for instance we have 8 combinations of noise and colours for asteroids (Terrain.cpp, Line 115). They might have 8 YAML files. I'm not sure how many combinations we have in total but it doesn't seem to produce that great an amount of variation, they're hardcoded, difficult to iterate for developing etc.

I've tried writing a few experimental branches, doing that kind of stuff within Pioneer is time consuming so in the end I wrote an entire separate project just for trying things out. That successfully used noise but the shaders were custom written. I've learn't a lot doing stuff like that but there's still big obstacles that I need to figure out and work around.

There are different parts to Pioneers terrain code. There's the rendering part which has gotten a lot saner since I started hacking at it, that uses a lot less memory nowadays for example. There are still a lot of things that I would like to do to this part and the terrain texturing is just one example of that.

Then there's the generation _parts_ which are comprised of the terrain jobs and the terrain generators.
The terrain jobs are an asynchronous job system which can run on any thread in a multithreaded system, so my home PC runs 6 cores, 12 threads, Pioneer launches 11 threads and terrain generation is quite speedy since it will use all 11.
The insane, hardcoded and difficult part are those terrain generators. Essentially everything isolated within the "Terrain" project. That's the part that I would replace with a shader based system, where the shaders would need to be generated at runtime from a JSON (instead of YAML) based system.

Not 100% sure how it'd work yet, I guess you'd build up a shader from the JSON description, and then set random values based on the JSON files ranges and the RNG using the planets seed. Generate the planet and then texture it at runtime using my terrain texturing work... or something.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Code inspiration and rendering resource

Post by FluffyFreak »

Looking at that SoA link a bit more I think it's even simpler than I thought, the devil will be in the details of course, like constructing the shader itself.
impaktor
Posts: 994
Joined: Fri Dec 20, 2013 9:54 am
Location: Tellus
Contact:

Re: Code inspiration and rendering resource

Post by impaktor »

How efficient are shaders? Maybe it's just due to my antique computer, but just trying to do a "Hello World" shader melts it.
Post Reply