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

You are not logged in.

## #1 2007-12-14 04:05:12

luca-deltodesco
Super Member

Offline

### 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-16 01:21:56)

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

## #2 2007-12-15 09:51:40

Ricky
Moderator

Offline

### 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..."

## #3 2007-12-15 21:46:04

luca-deltodesco
Super Member

Offline

### 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.

## #4 2007-12-15 22:51:37

MathsIsFun

Offline

### 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

Devantè
Real Member

Offline

Very nice image.

## #6 2007-12-16 00:08:34

JohnnyReinB
Power Member

Offline

### 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

## #7 2007-12-16 01:04:34

luca-deltodesco
Super Member

Offline

### 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-16 01:25:42)

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

vxmaster
Novice

Offline

hi guys

## #9 2007-12-16 04:53:36

luca-deltodesco
Super Member

Offline

### 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.

## #10 2007-12-16 05:21:56

Identity
Power Member

Offline

### Re: randomly generated planet

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

## #11 2007-12-16 08:29:03

MathsIsFun

Offline

### 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

## #12 2007-12-16 10:30:35

luca-deltodesco
Super Member

Offline

### 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.

## #13 2008-01-06 10:23:49

Kargoneth
Member

Offline

### 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)

## #14 2008-01-07 05:48:00

MasterofDisguise
Full Member

Offline

### 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!)]