GPU terrain

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

GPU terrain

Post by cloud » Thu Nov 06, 2008 9:16 am

Hi all.

These screenshots are from my (not so good) version of procedural terrain with marching cubes as as written about in GPU GEMS 3 ch 1. I tried to follow their code as much as possible, but using cg rather than HLSL and not having the gp4vp profile on me 8800GT caused me so much trouble; The biggest problem tho is that the ambo has to be calculated in geometry shader which makes it oh so slow, vp40 didn't have enough instructions for the density function which is needed for the long range ambo. I did do a faster method2 sort of version which just does short range ambo it created blocks in a more reasonable time frame about 1 every 0.1 of a second but looked ugly.

Image
Image
Image
Last edited by cloud on Mon Mar 23, 2009 12:43 pm, edited 4 times in total.
0 x

beaugard
OGRE Contributor
OGRE Contributor
Posts: 265
Joined: Sun Mar 25, 2007 1:48 pm

Post by beaugard » Thu Nov 06, 2008 10:39 am

Hey, that's interesting. I am doing almost exactly the same thing on the CPU (without ao, although I am thinking of adding it), and had some thoughts about migrating to the GPU. I didn't try yet bc of physics and some performance concerns (ok, mostly because I am lazy).

What is the size of your volume?

0.1 second is a bit much for doing it in-between frames, did you try to split up the work over several frames?
0 x

cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

Post by cloud » Thu Nov 06, 2008 1:16 pm

For now each volumes is 32^3 voxels and in those shots theres 4^3 blocks, I'm sort of scrolling the blocks as the camera moves, I did write a lod system where there are multiple BlockScrolls as I call them but my shaders are too slow for it... you could break it up into multiple steps and call render on the RenderToVertexBuffer at different frames, in the book their 3rd method has about 6 steps don't know if their doing them cross frames but you could, but then again its probably so much faster they don't need to worry about it. I think the chapter said there method 2 was 22 times fast than method 1 and method 3 was another 5 times faster.
0 x

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
Contact:

Post by Jabberwocky » Thu Nov 06, 2008 2:21 pm

Very cool. Some of the terrain in that GPU Gems article was really neat looking. Your terrain is just missing a texture and it'll be right there. AO issues aside, you look like you're getting pretty good frame rate on short range stuff.

I have no idea how you'd do physics for this kind of terrain. Now that the current trend is that physics is migrating to the GPU, maybe this will be a more easily solvable problem in the near future.
0 x
Image

JeDi
Gnome
Posts: 351
Joined: Thu Oct 21, 2004 1:34 pm
Location: Diepenbeek, Belgium
Contact:

Post by JeDi » Thu Nov 06, 2008 3:46 pm

Is this the same technique as used in this nvidia demo?
http://www.nzone.com/object/nzone_cascades_videos.html

In my opinion, terrain was always a very good application for geometry shaders, because often there is no interaction with it at the CPU side, apart from collisions which you could handle differently (using the heightmap or whatever).

Cool!

Greetz,
JeDi
0 x

User avatar
Nauk
Gnoll
Posts: 647
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
Contact:

Post by Nauk » Thu Nov 06, 2008 7:16 pm

That's an impressive framerate you get with it, very interesting and also very stimulating for me to finally look into shaders. Good work :)
0 x

User avatar
PolyVox
OGRE Contributor
OGRE Contributor
Posts: 1316
Joined: Tue Nov 21, 2006 11:28 am
Location: Groningen, The Netherlands
Contact:

Post by PolyVox » Thu Nov 06, 2008 8:48 pm

Excellent work! I read that GPU gems article with great interest, and have been pondering about the possibility of porting some of my project to the GPU. I didn't know whether Ogre had the necessary functionality yet, but it looks like it does :D

You might also want to check out the NVidia Cascades demo that JeDi mentioned, you can get some useful tips on texturing.

Once again, good work!
0 x

Jackson3113
Gnoblar
Posts: 9
Joined: Fri Nov 07, 2008 3:42 am

Post by Jackson3113 » Fri Nov 07, 2008 7:27 am

those pics are looking sweet, love the AO
0 x

User avatar
lonewolff
Ogre Magi
Posts: 1207
Joined: Wed Dec 28, 2005 12:58 am
x 5

Post by lonewolff » Sat Nov 08, 2008 1:19 am

Nice effort! 8)
0 x

mr. iknoweverything
Halfling
Posts: 72
Joined: Thu Jul 12, 2007 5:39 pm
Location: berlin

Post by mr. iknoweverything » Sat Nov 08, 2008 2:47 am

you know, i cant help it, but those marching cubes terrains always make me think that with a little bit of ambient occlusion, perlin noise and subsurface scattering they would make incredible cloud systems.
0 x

Nudel
Halfling
Posts: 79
Joined: Thu Mar 23, 2006 4:14 pm
Location: Vienna

Post by Nudel » Sat Nov 08, 2008 12:03 pm

Nice work, I love terrains like that. :)
mr. iknoweverything wrote:you know, i cant help it, but those marching cubes terrains always make me think that with a little bit of ambient occlusion, perlin noise and subsurface scattering they would make incredible cloud systems.
You might want to look into this paper: http://evasion.inrialpes.fr/Publications/2008/BNMBC08/
They use Perlin Noise to add cloud details.
0 x

User avatar
lonewolff
Ogre Magi
Posts: 1207
Joined: Wed Dec 28, 2005 12:58 am
x 5

Post by lonewolff » Sat Nov 08, 2008 12:22 pm

Every time I look at those screen shots it gets better and better. 8)
Very glacial looking.
0 x

cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

Post by cloud » Sun Nov 09, 2008 9:47 am

@JeDi Its not the same technique they used in cascades its the first of three they gave, the simplest and slowest. I tried to go further but couldn't because of vp40 limit of 2048 instructions.

I spent both yesterday and the day before playing around with noise and making it somewhat dependent on things like surface normal to world up, midday sun angle, exposure, altitude, truly a black art ... but speaking of glacial.

Image

The above noise applied with 2 triplanar textures.

Image

I've found that using 2 textures looks good, 3 is ok if you have to and 4 oh dear god no.

So what I want is to come up with some notion of regions where the textures vary but the number sampled is limited to no more than 3, no idea how to do that though :wink:
0 x

cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

Post by cloud » Mon Nov 17, 2008 7:22 pm

Lately I've been trying to manipulate the "density function" so that I could carve tunnels and create paths, and other game type things. But more importantly I wanted to put three ogre heads into the side of a cliff.

Image

Done by rendering all meshes on a certain render queue into the slices of a 3D render volume and moving the orthographic cameras near clipping plane for each slice, the density is then just attenuated by the texture. Unfortunately it will mess up long range ambo where the mesh is relatively big and it does mean render sections of the scene an awful many times... still I'm happy.

I've just noticed I've posted the wrong image and I no long have the right one
•sniffle•

Edit: This one shows it better

Image
Last edited by cloud on Thu Nov 20, 2008 2:07 pm, edited 1 time in total.
0 x

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
Contact:

Post by metaldev » Mon Nov 17, 2008 8:23 pm

Sweet! Mount Ogremore.
Thats 4 all you pun aficionados out there :wink:

awesome work man!
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Tue Nov 18, 2008 5:32 pm

Totally loving mount Ogre :)
0 x

User avatar
iloseall
Gremlin
Posts: 156
Joined: Sun Sep 14, 2003 3:54 am
Location: Beijing China
Contact:

Post by iloseall » Wed Nov 19, 2008 3:31 pm

Great :lol: .
What's profile can do this?
Is vs3.0,ps3.0 enough?
0 x

Post Reply