 Planetary engine, part IV ( volumetric fog/haze ) |
Posted - 10/22/2006 4:40:57 PM | I have added a simple "tide" effect to the water: a set of cosinus functions modify the water level by +- 20 meters depending on time. At the moment it's a "fixed" effect, but i intend to make it dependent on the presence of a moon.
I still have lots of things to fix on the water, for example the underwater patches are rendered even if the camera is above water ( and vice versa ), which wastes some polycount/cpu. The tiling is still not fixed yet, and i still have to implement a good foam texture based on cellular procedural textures.
To have a break from the terrain engine, i started to code an A-star algorithm to handle A.I., the goal being to experiment NPC traffic in stations in the coming weeks. A-star is a graph algorithm that allows one to implement pathfinding and to associate some "costs" to each segment of the paths graph. That way the A.I. can select the shortest path to go from a point A to a point B, depending on the costs assigned to the graph. A-star is a very fast algorithm, but still too slow IMO to run on thousands of NPCs at the same time, so i'm planning to precompute for each station a 2D table that give, for a current control point and a destination control point, the ID of the "next" control point to go to. This shouldn't waste too much memory either, for example if there are 500 control points in a single station, that'd use 500 * 500 * 2 bytes ( you need 2 bytes to store a control point ID ) = 500 KB of memory to store the table. There would be one of this table per "station type", and not per instance of the station in the universe. Anyway, that's my plan, and time will tell if it works or not.
In other news i have implemented a simple form of volumetric fog / haze for the planetary engine. It is almost 95% vertex shader based, and works by generating a fog sphere of a constant thickness around the planetary sphere. The vertex shader then casts a ray from the vertex to the camera through this fog sphere and calculates the density of fog along this ray. This value is then used to LERP the diffuse color with the fog color. It is an over-simplification, and i've hit a lot of complex issues with this ( particularly with how to handle the case where the ray doesn't intersect the fog sphere at all, or of the atmosphere's fog color not matching the terrain's fog color due to altitude differences ), but the latest version is looking okay.
Some pics:


| |
| Thursday, October 19, 2006 |
 Planetary engine, part IV ( water ) |
Posted - 10/19/2006 9:00:23 AM | Not that many news since yesterday, but a new set of 4 screenshots that i thought were looking pretty nice :)
I got ride of the semi-transparency effect on the shores. It was a quick trick, it didn't look so good, and it'll eventually be replaced by a true refraction / fresnel effect.
Instead i decided to give a try to foam, blending between an animated foam texture and a pure white texture, then modulated by the waves, then modulated by the ocean depth ( basically the distance between the underwater surface, and the ocean level ), modulated by the sun color, etc.. That's a lot of modulations :)
I'm also now modifying the ocean base color by a small amount depending on this ocean depth too. The ocean color is dark blue-ish for deep ocean, and gets closer to green-ish near coastlines ( since most screenshots are near coastlines, you won't notice it in screens ).
I added back the high dynamic range pipe; it's looking pretty nice at ground level, but horribly saturated at high altitudes / orbital views. Still a lot of tweaking in perspective.
The foam texture is a "static" texture ( it's not procedurally generated ) and it's only 256^2, which is why it's obviously tiling. Will be fixed later once i generate a foam texture procedurally ( in 1024^2 ).
The waves patterns haven't been fixed yet ( if they can be fixed, that is, which is easier said than done ).
Those screens are in HDRI, it's slowing down quite a bit with everything on ( especially the x4 supersampling anti-aliasing ), i "only" get around 50-60 fps:




| |
| Wednesday, October 18, 2006 |
 Planetary engine, part III ( water ) |
Posted - 10/18/2006 11:35:50 AM | I continued to work on the atmospheric shaders / sunsets, as well as water / ocean rendering.
Nothing special to say about the atmospheric shaders. Lots of tweaking and testing.
More interesting is the water topic. It's some early work, but i got ride most of the Z-Fighting by adjusting the Z-Near clipping plane distance to as far as possible. I still have to study how it's going to interact with close objects ( like a flying spaceship ), since to render close objects like ships the Z-Near has to be pretty close ( a few meters only ). I'm not worrying too much, as i believe it's just a matter of selecting appropriately which frustum to use ( i have a serie of frustums, increasing in Z distance: frustum #0 is for close objects and ships, frustum #1 for the close planet, frustum #2 for distant planets, etc.. ). The main problems start when frustum #0 and #1 overlap, ie. you've got a flying spaceship, but behind a mountain for example.
The rendering of water is extremely basic so far, i've only created a simple shader that generates a per-pixel water normal by blending together 4 normal maps coming from perlin noise fBm. This normal is then used to do all sort of "magic" calculations: specular effect with the half-angle vector to the sun, sun color, water color depending on waves, and of course waves animations by applying translations to each of the noise textures. The water surface is still flat though, it's a pure shader effect.
Later on i shall implement true reflections / refractions, shadows from clouds, underwater "fogging", etc..
Mandatory screenshots ( click for 1024x768 ):



| |
 Planetary engine, the return ( part II ) |
Posted - 10/13/2006 5:49:00 PM | Yey, it's the week end !
This week i worked on improving the planetary shaders and especially the sunsets. They're now looking pretty nice ( one reason i didn't show them much in the old version, was that their lighting wasn't very good ). The sun color is now calculated by applying on the CPU the scattering equations, meaning that the sun's reddening through a typical Earth-like atmosphere is no longer hard-coded, but depending on the atmosphere properties / density.
I've also added an ambient term that is dependent on the atmosphere diffusion color, too. So, at zenith, this ambient color is slightly blue, while at sunset it's slightly orange-ish. Subtle but nice effect.
The terrain surface shaders are now working with bump mapping and specular mapping. It's really looking like the night & day ( no pun intended ) compared to the lighting in the old version of the engine, where lighting effects on the terrain were really subtle, if visible at all.
The atmospheric scattering shaders are now longer saturating to white ( well, unless the HDR exposure is too high, of course ), so it looks a bit better than the old shaders.
I started to work ( and will continue this week end, and probably next week ) on my experiments with water. As expected, Z-Fighting is pretty bad for altitudes higher than 50 KM. But i'm pretty sure it can be solved by using some tricks. I'm generating procedural heightmaps under sea level now, too ( ie. the heightmaps are not "flattened" at 0 ).
Juan finished to texture Ammonra's Stargazer. I made a short video of it in the engine with HDRI effects. 4.7 MB ( Divx4 ) only. The shadows are unfortunately flickering, which does not happen at higher framerates ( real-time recording slows down fps ), so i have to investigate what happens:
Clicky
| |
| Saturday, October 7, 2006 |
 Planetary engine, the return ( part I ) |
Posted - 10/7/2006 7:49:00 AM | Sorry, no screenie today.
Since the last week i've resumed work on the planetary engine. Chances are, i'm going to be busy on it for the next 3 months, so this dev update is only the first of a long serie.
The planetary engine as it was, although certainly not bad technically / visually, suffered from a few design / quality problems. In those 3 months i'm going to fix those issues, improve it, and of course implement the missing features ( water, clouds, vegetation, to name a few.. ).
Last week:
- cleaned up the interface and removed some of the hard-coded parameters for the surface / atmosphere
- renamed many classes whose names didn't fit. I was calling "flat terrain" a surface patch that wasn't deformed by a heightmap ( ex.: the clouds or the atmosphere ), and i was calling "curved terrain" a surface patch that was defomed by a heightmap. I'm now speaking of "surfaces" instead of "terrain" ( doesn't make sense to call "terrain" the atmosphere ), and of "spherical" the mapping from a cube to a sphere.
- experimented a new way to deforme the cube into a sphere, that has less deformations. Trading a bit of quality for a bit of performance, but i'm not sure yet i'll use it in the end.
- updated the vertex shaders for tangent space calculations. That was hardcore :) I'm still not sure if it'll behave correctly on a real heightmap, but for the global planetary shaders, i now have a per-pixel lit sphere ( planet ) instead of per-vertex lighting as it was before.
- added bump-mapping and the sun specular effect to planet seen from space. Looking rather nice, but the bump must not be over-done.
- started to rework the atmospheric scattering shaders: performance optimizations, more realistic sunsets quality, and later handling of HDRI.
- the planet isn't static anymore and can rotate / move, meaning that at surface level you can now see the sun move in the sky, and the atmosphere colors update in real-time.
- added some keys to make the planet rotation for or less fast, mostly for debugging purposes. But it's fun to see the planet spinning very quickly :)
| |
|
| S | M | T | W | T | F | S | 1 | 2 | 3 | 4 | 5 | 6 | | 8 | 9 | 10 | 11 | 12 | | 14 | 15 | 16 | 17 | | | 20 | 21 | | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | |
OPTIONS
Track this Journal
ARCHIVES
October, 2009
August, 2009
July, 2009
May, 2009
April, 2009
March, 2009
February, 2009
January, 2009
November, 2008
October, 2008
July, 2008
June, 2008
May, 2008
April, 2008
March, 2008
January, 2008
December, 2007
November, 2007
October, 2007
September, 2007
August, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
January, 2007
December, 2006
November, 2006
October, 2006
September, 2006
August, 2006
July, 2006
June, 2006
May, 2006
April, 2006
March, 2006
February, 2006
January, 2006
December, 2005
November, 2005
October, 2005
September, 2005
August, 2005
July, 2005
June, 2005
May, 2005
April, 2005
March, 2005
February, 2005
January, 2005
December, 2004
October, 2004
September, 2004
August, 2004
|