Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2007-12-13 05:05:12

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### randomly generated planet

Someone in newgrounds proframming forum was asking about how to go about applying a terrain to a sphere for generating a planet mesh in otherwords.

So i thought i would have a go at it

Heres the application:

press space to generate new planet
press espace to exit

:

It generates a sphere, and displaces the vertices from centre with a 3D perlin noise function, it then runs through triangles incrementing vertex normals with normal of triangle, then normalises all vertex normals (so smooth shading) and then runs through triangles again, this time with information and renders it to a display list in OpenGL (vertex colours are equal to the normals here)

It also renders a nice semi-transparent sphere through it for water;

Heres what it can look like if i make the displacement larger

Last edited by luca-deltodesco (2007-12-15 02:21:56)

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #2 2007-12-14 10:51:40

Ricky
Moderator
Registered: 2005-12-04
Posts: 3,791

### Re: randomly generated planet

Can you post a picture of the nicer planet?

"In the real world, this would be a problem.  But in mathematics, we can just define a place where this problem doesn't exist.  So we'll go ahead and do that now..."

Offline

## #3 2007-12-14 22:46:04

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### Re: randomly generated planet

i would have posted the picture in here instead of a link, but the option for adding pictures is not appearing in this forum i havn't checked whether thats a global thing or not.

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #4 2007-12-14 23:51:37

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: randomly generated planet

Looks like an asteroid!

You can post images now

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #5 2007-12-15 00:49:49

Devantè
Real Member
Registered: 2006-07-14
Posts: 6,400

### Re: randomly generated planet

What's with the first link? It just says 'I know your IP address, prepare to get hacked! Your IP is: [My IP Address]'. Perhaps this is one of your jokes.

Very nice image.

Offline

## #6 2007-12-15 01:08:34

JohnnyReinB
Member
Registered: 2007-10-08
Posts: 453

### Re: randomly generated planet

Is that planet stable?

"There is not a difference between an in-law and an outlaw, except maybe that an outlaw is wanted"

Nisi Quam Primum, Nequequam

Offline

## #7 2007-12-15 02:04:34

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### Re: randomly generated planet

devant'e i just tried the link, and that is rather weird yeh, but it is a just a joke there, its what it gives when you dont give it a valid file link, the reason is the space in the address, if you remove the space and do it its fine ;P

As an update, ive now re-programmed it, much neater and incoperated my algorithm for generating a geodesic sphere mesh into it so its much nicer now in terms of consistency i.e. all triangles are pretty much same size, rather than being smaller at poles and larger at equator so the detail around the mesh is consistent.

here you see 3 couples of images (mesh + solid/water) from less detailed - to most detailed is 3,5,7 iterations respectively in the tesselation for the geodesic sphere each with respectively (for terrain) 1,280. 20,480. 327,680. triangles respectively

these are all done with very high displacements to show off the algorithm a bit more than if it was very spherical, but you can ofcourse like in the .exe  in the first link, with the non geodesic's have a much more spherical planet generated

Last edited by luca-deltodesco (2007-12-15 02:25:42)

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #8 2007-12-15 02:32:05

vxmaster
Member
Registered: 2007-12-14
Posts: 2

hi guys

Offline

## #9 2007-12-15 05:53:36

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### Re: randomly generated planet

Added texturing to it, had to work out the problem of seams at edges of texture in the mesh when i have time tomorrow im going to work on adding multiple textures depending on height and slope. Atm its just using a martian landscape texture and darkening it with respect to how sloped the ground is at that point.

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #10 2007-12-15 06:21:56

Identity
Member
Registered: 2007-04-18
Posts: 934

### Re: randomly generated planet

Wow so can you like, zoom in and glide over it and go through it?

Offline

## #11 2007-12-15 09:29:03

MathsIsFun
Registered: 2005-01-21
Posts: 7,659

### Re: randomly generated planet

That planet is so good, I want to name its continents!

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

## #12 2007-12-15 11:30:35

luca-deltodesco
Member
Registered: 2006-05-05
Posts: 1,470

### Re: randomly generated planet

Identity wrote:

Wow so can you like, zoom in and glide over it and go through it?

the way i have it at the moment, is you have a free-camera you can control.

The Beginning Of All Things To End.
The End Of All Things To Come.

Offline

## #13 2008-01-05 11:23:49

Kargoneth
Member
Registered: 2007-08-11
Posts: 33

### Re: randomly generated planet

I have always been fascinated by artificially generated worlds. Your example is very nice. I like it a lot (the fact that it can be viewed in real-time is a great bonus. Most of the worlds I have looked at are just rendered images)

Offline

## #14 2008-01-06 06:48:00

MasterofDisguise
Member
Registered: 2008-01-05
Posts: 68

### Re: randomly generated planet

wow that planet looks cool
but its kinda weird a perfect circle?

(im an ALIEN ) im kool (WHAT You cant steal my fridge!)]

Offline