ROAM Planet rendering

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
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

http://www.ogre3d.org/forums/download/f ... &mode=view

Oh... on this picture you uploaded for JabberWocky... I can see so many things at the same time...

A domed colony at the valley up ahead to the left of the highest mountain, clad in metallic plates and windows, with a road coming out from it to the position of the one taking the picture...

A lush dark brown forest with alien vegetation and a single rudimentary stone road cutting it like a serpent following the hills...

A battlefield, with explosions and atmospheric fighters racing each other while a huge invasion ship is descending from the sky..

Heck, even a Roman city or a part of the Great Wall....

So much potential at the tips of our fingers!
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

That's the plan !

Complete freedom for the masses.

Alex
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: ROAM Planet rendering

Post by Zonder »

Yes you will need to use the atmospheric lighting on everything else it will look odd hope you get the other shaders updated soon :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

Yeah G'day guys,

I'm having a little fun with the ocean shader at the moment, The thing that's giving me grief is the reflections, I have it reflecting the sky, but it's always a little off, where the reflection of the sun is in relation to the actual sun, it always seems to be too close to the camera. When the sun is on the horizon, the sun reflection is almost at my feet, not where the sun meets the horizon. I would say it has something to do with the camera relative rendering, and figuring out the position on the atmosphere sphere that I would be looking at.....

Here's the problem ...
What's the easiest way to figure this one out ?
What's the easiest way to figure this one out ?
C = Planet Center (Known)
R = Radius of Planet (Known)
AR = Radius of Atmosphere Limit (Known)
E = Eye Vector to Fragment (known)
RV = Reflection Vector Based on E and the Fragment Normal (known)

The Angle at (C) is NOT KNOWN.
The reflection vector (RV) can be ANY ANGLE inside the 180 degrees range.

This is probably kids stuff to some of you, but I can't find anything out there, I know I can do it itteratively , but I hope to steer clear of that approach.

Just wondering if anybody has had this problem before and figured out a good simple way of calculating this out.

Alex
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 114

Re: ROAM Planet rendering

Post by mkultra333 »

I'm not that great at trig, but if you're trying to get that length, perhaps you just need a ray-circle or ray-sphere intersection point, for where E (or RV, since RV is just a mirror image of E) hits both the green circle and the blue circle. The difference between the two is the length. Code for ray-circle collision here, http://paulbourke.net/geometry/sphereline/, C link at top of page, code looks reasonably simple.

Edit: If you already know the location where lines E and R meet, call it RE, then you only need to do one ray test, down E to the outer circle. Then you've got the line segment from that collision point to RE. (Ah, noticed RV might be jiggled by some normal map, in which case just do the above but for RV instead of E.)
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: ROAM Planet rendering

Post by bstone »

Here's my solution to your equation:
Image
where Image is the vector from the sphere center to the fragment and Image is the dot product.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: ROAM Planet rendering

Post by bstone »

Actually, one correction. I assumed that RV is normalized to derive that so the answer is a bit simpler:
Image
But don't forget that RV should be normalized when you use the formula.
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,

Thank you for the advice mkultra, and thank you for the solution bstone, that formula worked a treat.
My only hitch now is that my ocean normals are playing up, I wanted to create from my water surface tiles, a complete mirror ball, so that I can be assured that the reflections I am getting are spot on, but I'm getting inconsistencies in the normals between tiles, something I didn't notice when I was using normal maps for the ripple effects on the surface of my old ocean shader....
Normals Glitch on the ocean tiles.
Normals Glitch on the ocean tiles.
If you look closely, you can see the sharp edges of the tiles all over the ocean sphere, I have a few ideas of what I need to do, so bare with me for a little, I have some major optimization's in mind for this planetary ocean simulation.

I'll keep you informed, OH, and thanks again for the help guys, much appreciated.

Alex
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,

Just something to make your mind boggle ...

My son asked me what the total surface area of this current planet is, as it stands now, and what resolution is the terrain mesh running at now, I nearly fell over myself when I worked it out.

The radius of the planet is ... 1,738.4 kilometers ,the same as our moon at a 1:1 ratio ( meaning that 1.0 in ogre units is 1.0 in floating point numbers).

So I used the formula .... (4 * PI) * (Radius * Radius)

And it came up with .... 37,976,006.290361852919553718292904 square km without ocean, take out 60% for ocean say, and it's still ... 15,190,402.516144741167821487317162 square km to populate.

And the mesh itself is coming in at in between 4 - 7 meters resolution depending on error metric close up, that's a hell of allot of vertices if you wanted to store that.

Just food for thought.

Alex
Last edited by DavlexDesign on Wed Apr 25, 2012 10:11 pm, edited 1 time in total.
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

http://en.wikipedia.org/wiki/Wargame:_E ... Escalation have 150 square kilometers maps and they think those are huge... they don't know the meaning of the word.. :P
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day LordBaal,

Don't be too critical of them, they've done a pretty good job to get that far out.

OK, I've fixed my normals and reflection issue with the sky on the ocean, from way out in space and also close to the ground, now I'll try for terrain reflections and then I'll add in the wave simulation and Fresnel stuff.
The fun part is trying to keep it all fast and efficient enough as to not overload things with trivial details, this piece is not as fast as it can be, and now that I have it pretty close, I can start hacking it back to something reasonably optimized. Here's the results so far ....
From pretty high orbit.
From pretty high orbit.
And down on the ground.
And down on the ground.
You'll notice on the first picture that there are no visible seams any more, and the reflection of the sun shows no sheering effects across tile borders.

EDIT: OOPS !!! nearly forgot, here's the planet in Earth like mode, so you can see it still works.
And here it is in Green Earth like mode.
And here it is in Green Earth like mode.
Alex
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

Don't be too critical of them, they've done a pretty good job to get that far out.
Oh no, the game is a true jewel! I was just comparing what people think about scales and what is considered big now and what will be considered big in the future. Sometimes I assume people have my same process of though, that's a fatal flaw of my part, since every one's head is a world... :oops: :)

Nice work removing the seams! I can't imagine how nice it will look with proper textures! :wink:
Ilidd
Gnoblar
Posts: 1
Joined: Wed Apr 25, 2012 9:51 pm
Location: Southern California

Re: ROAM Planet rendering

Post by Ilidd »

Alex,

That's some amazing work. I would love to see some of the code behind this.

(Edited because I thought I saw the last post date was 2011. Teaches me to lurk multiple forum threads at once...)
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: ROAM Planet rendering

Post by Zonder »

Ilidd wrote:
(Edited because I thought I saw the last post date was 2011. Teaches me to lurk multiple forum threads at once...)
He does updates quite often to this thread :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

Hello gentlemen, I hope you are all ok!
I know you are busy not only with this engine but with real life, but I kind of wondered about what are you up to now and how is that planet shaping? My weekend starts a lot better whenever I see a few new pics of this wonderful project

Also I was remembering about the grant you plan to ask your government and even when I'm not even in the same continent I wonder if I could help on that in anyway.

Besides this I was thinking about how dwarf fortress is being made up, it's programmer making a living only of contributions. Of course Toady have no children and his responsibilities are limited to his cat, himself and creating an amazing game. I know you, at least mr. Alex, don't know if mr. Sovaka too, have the responsibilities of a family.

However I was thinking if after a first release of the engine (with a game to attract more people of course) how much would you be able to do on monthly contributions, not to make a living, bu only to help the project by allowing to buy better hardware or hire some assistance.

Of course all of this depends on:
1) If all that would be legal, I certainly don't know it.
2) And more important, what you are planing to do with the engine once it reach maturity. If you are going to make it free-ware or proprietary, paid or free, if you get a government grant then some conditions would apply from them (I guess) and so on.

Well, my best regards!
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day LordBaal,

Thank's for the nice feedback, I'm still working away on this thing, so doesn't matter about the money at the moment, I do have an issue with the engine at the moment though.
It's the mappings of the cube faces that the pages are derived from, I tend to get seems along the borders of the faces (not the pages that make up the faces). It's all to do with the tangent space calculations, it really shows up with the new water shader I'm implementing, so now I have to redo the whole mapping of pages into a different setup, so that I can more easily line up the tangents across the whole planets surface. I know this sounds like a nightmare, but it will make the whole shader system fall in line with more conventional shader systems, and ease the plugin-ability of this thing with other engines too.

The main crux of the system will not change at all, just the breakup of the geometry, so it's not a real big problem at all, just time consuming, nutting out a nice breakup that doesn't involve oversampling of textures at the poles, and keeping the tangent alignments in alignment across the whole surface of the planet. This problem is actually a blessing in disguise, because it gives me a real chance to actually go through some of the older code in this thing, and optimize it more. As it stands I've actually found a ton of stuff in there that really was quite redundant with all the new stuff I've implemented, and managed to squeeze out allot more frames per second (would you believe), even with the reflections, waves, volumetrics and stuff in there, I'm still pulling around 300 - 500 fps consistently while on the ground, and with the tangents aligned properly at the face edges, I can cheapen my shaders even further, which will lessen the burden of the cloud shader on the GPU systems., reducing the chance of shader bound problems, if I just pip the shader processing time to more that the time it takes to render one frame on the screen, I instantly halve the update rate on screen, and that won't do when this thing goes true 3D.

Another thing I'm toying with is, horizon culling, so even the pages themselves get broken up into an octree, and actually cull sub pages that are occluded by terrain and occluders (buildings and larger props) in the foreground, reducing further the bandwidth burden between the CPU and GPU, I have an early implementation working of this already, and it looks promising, it's all done on the cpu at the moment, and doesn't look like I will have to go to GPU with this. The speed of calculating this stuff, is no problem at all, I thought it would be more difficult, but, it was pretty easy really. I don't know if it will make the cut for the final release, I will just have to see if I can get it to deal with other stuff too (foliage and props and stuff), if it can, and it's quick enough and proves to be a real benefit , I will probably leave it in there.

It's all coming along ok, and I hope to have some real updates for you guys to look at shortly, maybe even another downloadable demo maybe, so you guys can fly around and actually see this thing running.

Alex
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

DavlexDesign wrote: It's all coming along ok, and I hope to have some real updates for you guys to look at shortly, maybe even another downloadable demo maybe, so you guys can fly around and actually see this thing running.
Alex
Good to know about it! And can't wait to test it on my pc. I know a lot of people would like that too perhaps you two could get more active feedback and promotion like this! :D
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,

Been tinkering with the mappings and stuff, and seem to have come up with a reasonable solution, didn't have to make much of a change to the mappings much after all. Once I saw the stupidity of my ways, it was quite an easy fix. Here's how it sort of maps out now.....
Takes on a more Cube mapped style.
Takes on a more Cube mapped style.
In this picture the front face of the unit cube is the one on the lower right, broken up into pages, and each page of the face has a 1024x1024 texture mapped onto it to show the uv windings.
As you can see, ti is more like the cube mapping style now, the uvs point in the correct directions, so that if I wanted to project a cube map onto this thing, it would be allot easier now, I don't know what I was thinking years ago when I first generated this thing, but I'm glad I went back to sort it out.

Here is the water close up, with just atmosphere reflections in place, I know it's nothing special, but it is really just a matter of adding in my waves routines, and this water should look pretty mickey mouse.....
Earth like coloring.
Earth like coloring.
Mars-ish type coloring
Mars-ish type coloring
I'm going to get the terrain reflections in next and then the water depth and wave simulation in I think, I'll see how it all pans out in the next few days.

p.s. Thes shots are rendered on my own PC, not my sons, If I ran these on my sons PC, the frames per second would be in the high 800 - 1000 fps, so I still have plenty of cycles left to really pretty this thing up.

Alex
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,

Bit more on the water shader, sorry, it's just got a bit of life in it now, still have to setup the depth and wave simulation, but it's getting there.....
This shot with a bit of life in it.
This shot with a bit of life in it.
now for the fun and games, wish me luck !!!

Alex
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,

OK, this time I've got the shallow water effect in place, keeping the whole thing right for close up transparency and far away aesthetics, was an interesting solve, but it is looking ok, my next thing is the wave simulation I think, here's what it looks like so far .....
Showing the shallow water effect.
Showing the shallow water effect.
This is starting to take shape, I already have in place the data for cloud reflections too, so the calculations are already done, and being fed to the GPU, it's just a matter of accessing the right stuff now with only a fetch and a blend, so it shouldn't hurt much at all, including cloud shadows.

EDIT: I had to do an interesting thing in the shader for this all to work, I had to figure out how to take the Tangent Space normal from the normal map for the ripples, and convert it to a World Space normal for addition to the world space normal of the ocean geometry, I had to do this so that the accuracy was there for the reflections created from the screwing of the normals from the normal map, for some reason, the numbers I'm running here lost their accuracy when run through a matrix to get the TBN rotation, I also had to come up with a better solution to generate an accurate tangent from the world space normal. So I went the other way, by not using a matrix at all, worked allot quicker and gave me the correct normals.
I found that if I went to the other side of the planet,while using the matrix solution, and checked the normals there, the ripples where upside down, meaning the ripples were digging into the surface, and not the other way around, also the reflection of the sun would be off, as the sun went down to the horizon, the reflection would reach the horizon too early, and in some places, too late, plus the sun wasn't always in a direct line to the eye. Needless to say, I was glad I checked the far side of the planet this afternoon, otherwise I could have made a demo for you guys later on, and been a laughing stock.

Alex
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

HMM ! , needs terrain reflections too I think ....
Terrain reflections are missing.
Terrain reflections are missing.
What do you guys recon ?

Alex
LordBaal
Halfling
Posts: 55
Joined: Thu Mar 31, 2011 9:43 pm
x 2

Re: ROAM Planet rendering

Post by LordBaal »

Indeed, terrain reflections would make it look a lot nicer, breaking the smooth blue line at the bottom of the hills.

Really nice work, specially with the new mapping. But I have to ask, this new mapping replaces the old pages (it seem like they are a lot bigger). Can they get divided into smaller zones?

Really can't wait to have a demo :)
palaslet
Halfling
Posts: 61
Joined: Tue May 25, 2010 7:52 am
Location: Fredrikstad, Norway

Re: ROAM Planet rendering

Post by palaslet »

This water really brings life to the planet.

As usual I'll provide some reference material :)

Image
Water meeting land

Image
Some calm water with reflections
"It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away"
User avatar
DavlexDesign
Orc
Posts: 400
Joined: Thu Apr 23, 2009 7:23 am
Location: Australia
x 19
Contact:

Re: ROAM Planet rendering

Post by DavlexDesign »

G'day guys,
LordBaal wrote:But I have to ask, this new mapping replaces the old pages (it seem like they are a lot bigger). Can they get divided into smaller zones?
Those pages are just the base initial breakup pages of the planetary body, they can be any number you like up to 32x32 per face of the unit cube, sticking with even numbers works best because of the pole handling if you are mapping a Lat Long aligned texture (like the Blue Marble Earth textures from Nasa) onto it though. It handles odd numbered breakups as well, but that is really just for completeness, I want complete aesthetic freedom for the artist. One warning though, when you go up to 32x32 pages per face, you are dealing with 1024 pages per face, and 6 faces creates 1024x6 pages, that's allot, and each page being it's own batch can lead to slowdowns while out in space, on the ground it's fine, it actually works ok because the culling kicks in hard and brutal, reducing batch counts quite allot. With the nature of this Hybrid ROAM algorithm, it really doesn't matter about this initial breakup stuff, the pages are really the diamonds in the mesh, each diamond can have it's own unique uvs if you want, and you can pull them out for page zones on the fly, like I'm doing for the flora, tell the system at what split you would like the zones stored, and it pulls them out on the fly as it builds the mesh, so theoretically my pages are being broken down to diamond level, which is at most 3 base triangles of the mesh in resolution, because when the fourth triangle in the diamond is created, it creates two new diamonds with two base triangles in each, ready for the next split.
So, after all that waffle, The pages you see are really not the page resolution at all, they are the base pages, and it's the diamond resolution you should be worried about, which breaks down to 4-7 meters at the moment.
palaslet wrote:This water really brings life to the planet.

As usual I'll provide some reference material
Thanks mate, it surely does, and as usual, those photos are excellent sources for reference.
I will be en-devouring to re create those looks, but my limited shader math skills are getting a workout already, I'll figure it out though, just takes me longer.
I tend to steer clear of all the fancy trigonometric maths out there (mainly because I really don't understand allot of the higher functions) and stick with simple math, seems to produce similar results, but at a lesser GPU cycle penalty, so I can add in more instructions but keep the time cost to a minimum. I don't know if my thinking is flawed here, but I can keep pumping stuff into this thing, and it just seems to not matter, as you can see with the frames per second stuff.

Alex
ultramedia
Halfling
Posts: 62
Joined: Thu Dec 07, 2006 3:02 pm
Location: QLD, Australia
x 2
Contact:

Re: ROAM Planet rendering

Post by ultramedia »

lol, limited shader skills, simple math... if you say so ;)
Post Reply