davidson16807 / tectonics.js

3d plate tectonics in your web browser
http://davidson16807.github.io/tectonics.js/
Creative Commons Attribution 4.0 International
200 stars 28 forks source link

refactorings #25

Closed davidson16807 closed 6 years ago

davidson16807 commented 6 years ago

Bunch of stuff happened in my random wanderings across code, now I have to make sense of it all

astrographer commented 6 years ago

A lot of good clarifying refactors, more stuff that I’m sure is terribly useful, but is well outside of my wheelhouse, but that 16 bit depth rendering is what jumped out at me. 32 bit float may be better, but 16 bit makes these elevations directly usable for 3D rendering and maps. Huzzah! And also: thank you, thank you, thank you!!!

On Apr 6, 2018, at 2:44 PM, Carl Davidson notifications@github.com wrote:

Merged #25.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

davidson16807 commented 6 years ago

Major improvements, as I see them:

davidson16807 commented 6 years ago

16 bit depth rendering is probably not what you think it does. It allows you to create ScalarDisplays using functions that return Uint16Rasters. Uint16Rasters are used to track cell ids within a grid. It previously generated an error when you tried to do this, which was hindering development efforts.

What do you have in mind for 16 bit rendering? I think that might be something we could add in the issue tracker.

astrographer commented 6 years ago

What I’m looking for with 16 bit depth rendering is to return a grayscale raster I can use for bumpmapping. 8 bit bumpmaps tend to produce steps or terraces that aren’t always desirable(there are particular places where terracing is desirable and realistic, but not everywhere). This is because we’re limiting elevations in a roughly 0 to 8-9000 meter interval to 256 discrete steps. With 65,536 steps, any terracing effects tend to be imperceptible. This would allow use of elevation rasters directly in more precise or artistic renderings. The actual slope details might still be on too gross of a spatial resolution due to limitations of computer power. I suspect a global sim with even a 7-km cell size would set my computer on fire and probably even bog down a high end gaming machine. Seven kilometers is a bit of a magic number as that’s what Carl at ME-dem measured as a typical extent for individual mountain peaks. I haven’t measured that myself, so consider that third-person hearsay from memory, but it seems sane.

I already have a workflow that works, but the details generated are entirely imaginary. It’s also slow, but that could just be me. I’m a slow child. An oooolllllldddd slow child…🤪🦆

On Apr 9, 2018, at 9:58 AM, Carl Davidson notifications@github.com wrote:

16 bit depth rendering is probably not what you think it does. It allows you to create ScalarDisplays using functions that return Uint16Rasters. It previously generated an error when you tried to do this, which was hindering development efforts.

What do you have in mind for 16 bit rendering? I think that might be something we could add in the issue tracker.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

davidson16807 commented 6 years ago

As I understand it, bump maps are color maps where RGB encodes the xyz coordinates of a unit vector representing a surface normal.

Correct?

Sounds like something we could do easy.

Do you know the math required to implement bump mapping? After proper atmospheric models are implemented, I've wanted to improve the shaders used by the model. Specifically, I want to contact the people behind this KSP mod and import the ones they've created: https://github.com/WazWaz/EnvironmentalVisualEnhancements. But if you're a good point of contact then I figure that's a great place to start.

astrographer commented 6 years ago

That’s normal maps. A bump map does essentially the same thing, but the normal vectors are calculated based on elevations.

On Apr 16, 2018, at 3:35 PM, Carl Davidson notifications@github.com wrote:

As I understand it, bump maps are color maps where RGB encodes the xyz coordinates of a unit vector representing a surface normal.

Correct?

Sounds like something we could do easy.

Do you know the math required to implement bump mapping? After proper atmospheric models are implemented, I've wanted to improve the shaders used by the model. Specifically, I want to contact the people behind this KSP mod and import the ones they've created: https://github.com/WazWaz/EnvironmentalVisualEnhancements. But if you're a good point of contact then I figure that's a great place to start.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

davidson16807 commented 6 years ago

OK, just read up on the distinction. Wouldn't normal maps be easier to work with though, assuming they're pre-generated by the model? We could easily generate tangent space normal maps from local changes in elevation