Jump to content
  • Advertisement
  • entries
    2
  • comments
    5
  • views
    717

I've been noisy ...

Sign in to follow this  
Green_Baron

1073 views

As a first step to generate height maps on my own i started incorporating the algorithms of libnoise (c) by Jason Bevins, under the LGPL v2.1 or higher. It has never been easier to get noisy. Mapping a texture to a sphere or near spherical body is trivial, But when it comes to 'Oumuamua shaped objects things get distorted:

Screenshot_2019-07-17_00-46-46.png.5f5987506b7b587b95e0318d4a3772ef.png

Surface normals computed in two different ways, geocentric

vec3 centricSurfaceNormal( const vec3 pos ) {
	return normalize( pos );
}

and geodetic

vec3 geodeticSurfaceNormal( const vec3 pos ) {
	return normalize( pos * u_oneOverRadiiSquared );
}

Normals combined

vec3 normalG = geodeticSurfaceNormal( position );
vec3 normalC = centricSurfaceNormal( position );
vec3 normal = ( normalG + normalC ) / 2.0f;
vec2 texCoord = computeTexCoord( normal );

and height values looked up from a spherical height map

vec2 computeTexCoord( const vec3 normal ) {
	return vec2( atan( normal.y, normal.x ) * c_oneOverTwoPi + 0.5f, asin( normal.z ) * c_oneOverPi + 0.5f );
}

and then

float height = texture( s_texture, texCoord ).r * u_heightFactor;
displacedPosition = position + ( normal * height );

Still, between the two methods, there are vast open plains, so to say, only the centre area and the east- and west-poles are noisy.

I'll probably have to generate the height maps specifically for the assumed ellipsoidal shape of the bodies that will use it as clothing.

And what about two- or multi-lobed objects ? 🤔

Tricky terrain ahead ...

 

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!