Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-24 Thread Erik Hofman
Frederic Bouvier wrote:
 Fixed. What do you think of the night lighting ?

It's not entirely what I hoped for, for example the park is completely 
lit now. Maybe it would be an idea to use the light value as a contrast 
enhancer for the lit areas?

Erik

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-24 Thread Frederic Bouvier
- Erik Hofman a écrit :
 Frederic Bouvier wrote:
  Fixed. What do you think of the night lighting ?
 
 It's not entirely what I hoped for, for example the park is 
 completely lit now. Maybe it would be an idea to use the 
 light value as a contrast enhancer for the lit areas?

The lit areas are in the blue channel of the relief map texture (the z 
component of the normal is reconstructed from the x and y components locates in 
the red and green channels), so a better designer/artist could do a better job 
than me. For the moment, I only took the floor of the height map with a small 
decay at the border. The emissive color is also hard-coded in the shader.

What do you mean by contrast enhancer ?

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://www.youtube.com/user/fgfred64   Videos


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-24 Thread Erik Hofman
Frederic Bouvier wrote:
 What do you mean by contrast enhancer ?

Now all lit pixels are lit equally. What I was suggesting would lit 
lighter pixels more than darker pixels (I expect multiplying by the 
gray-scaled pixel color would suffice).

Erik

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-24 Thread Frederic Bouvier
- Erik Hofman a écrit :
 Frederic Bouvier wrote:
  What do you mean by contrast enhancer ?
 
 Now all lit pixels are lit equally. 

Not exactly. 

 What I was suggesting would lit 
 lighter pixels more than darker pixels (I expect multiplying by the 
 gray-scaled pixel color would suffice).

The blue channel has the emission factor. One can redo the map to achieve the 
effect you are suggesting.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://www.youtube.com/user/fgfred64   Videos


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-24 Thread Erik Hofman

Frederic Bouvier wrote:


The blue channel has the emission factor. One can redo the map to achieve the 
effect you are suggesting.


I think I was thinking more something in the line of this patch.

Erik
Index: urban.frag
===
RCS file: /var/cvs/FlightGear-0.9/data/Shaders/urban.frag,v
retrieving revision 1.3
diff -p -u -r1.3 urban.frag
--- urban.frag	23 Mar 2010 22:20:24 -	1.3
+++ urban.frag	24 Mar 2010 12:31:13 -
@@ -92,6 +92,8 @@ void main (void)
 	if ( shadow_factor  1.0 )
 		ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0);
 	float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis;
+vec4 tc = texture2D(BaseTex, uv);
+emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2) -0.2;
 	ambient_light += (emission_factor * vec4(0.75, 0.59, 0.05, 0.0));
 
 	vec4 finalColor = texture2D(BaseTex, uv) * ambient_light;
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-23 Thread Erik Hofman
Frederic Bouvier wrote:
 visible. Now I think I managed to get it right with 3d objects. See :
 http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg

Even more impressive!

Erik

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-23 Thread Erik Hofman
Erik Hofman wrote:
 Frederic Bouvier wrote:
 visible. Now I think I managed to get it right with 3d objects. See :
 http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg
 
 Even more impressive!

There's just one thing, the wrong side of the buildings seem to be lit 
with this update?

Erik

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-23 Thread Frederic Bouvier
- Erik Hofman a écrit :
 Erik Hofman wrote:
  Frederic Bouvier wrote:
  visible. Now I think I managed to get it right with 3d objects. See
 :
  http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg
  
  Even more impressive!
 
 There's just one thing, the wrong side of the buildings seem to be lit
 with this update?

It's probable the normals in the normal map are inverted. I'll check that 
tonight.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://fgsd.sourceforge.net/   FlightGear Scenery Designer


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-23 Thread David Megginson
Looks fantastic!


David

On Tue, Mar 23, 2010 at 4:22 AM, Erik Hofman e...@ehofman.com wrote:
 Frederic Bouvier wrote:
 visible. Now I think I managed to get it right with 3d objects. See :
 http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg

 Even more impressive!

 Erik

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-23 Thread Frederic Bouvier
- Frederic Bouviera écrit :
 - Erik Hofman a écrit :
  Erik Hofman wrote:
   Frederic Bouvier wrote:
   visible. Now I think I managed to get it right with 3d objects.
 See
  :
   http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg
  
   Even more impressive!
 
  There's just one thing, the wrong side of the buildings seem to be
 lit
  with this update?
 
 It's probable the normals in the normal map are inverted. I'll check
 that tonight.

Fixed. What do you think of the night lighting ?

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://www.youtube.com/user/fgfred64   Videos


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-22 Thread Frederic Bouvier
Le 18/03/2010 23:45, David Megginson a écrit :
 On Thu, Mar 18, 2010 at 5:56 PM, Frederic Bouvier wrote:

   
 I noticed the same problem with roads and 3d buildings -- they're
 floating above the city.  Is it possible to make the bump maps go up
 instead of down?
   
 In Shaders/urban.frag, change line 57 :

vec2 dp = gl_TexCoord[0].st;

 into :

vec2 dp = gl_TexCoord[0].st - ds;

 Tell me what do you think. Try to land in the city.
 
 I didn't seem to make any difference -- 3D buildings, trees, etc. were
 still floating above the roofs of the bump-map buildings.  I also
 tried

 vec2 dp = gl_TexCoord[0].st + ds;

 and

 vec2 dp = gl_TexCoord[0].st - 2 * ds;
   

vec2 dp = gl_TexCoord[0].st - ds;
was indeed correct, but without depth information, the effect was barely
visible. Now I think I managed to get it right with 3d objects. See :
http://frbouvi.free.fr/flightsim/fgfs-city-relief-4.jpg
As already specified, the boundary with other types of terrain will not
improve because of the parallax trickery.

-Fred


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-19 Thread Erik Hofman
David Megginson wrote:
 I didn't seem to make any difference -- 3D buildings, trees, etc. were
 still floating above the roofs of the bump-map buildings.  I also
 tried

Keep in mind that relief mapping is just trickery to make something look 
like it is standing out from the scenery. In fact everything is rendered 
in the same 2d plane. That might be the main cause of this effect.

Erik

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-19 Thread Anders Gidenstam
On Fri, 19 Mar 2010, Erik Hofman wrote:

 David Megginson wrote:
 I didn't seem to make any difference -- 3D buildings, trees, etc. were
 still floating above the roofs of the bump-map buildings.  I also
 tried

 Keep in mind that relief mapping is just trickery to make something look
 like it is standing out from the scenery. In fact everything is rendered
 in the same 2d plane. That might be the main cause of this effect.

Yes, indeed. It is (or ought to be) possible to adjust the Z-buffer value 
for fragments to reflect their new position as determined by the relief 
computation. This would solve depth problems between the ground 
triangles and objects on them but will not help for the problems along 
the edges of the urban area since the urban shader is not run for the 
fragments of the adjacent ground triangles and consequently a relief 
building cannot occlude those fragments.

There might be other tricks to make the transition to other ground types 
more pleasing, though.

Cheers,

Anders
-- 
---
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-19 Thread Frederic Bouvier
- Erik Hofman a écrit :
 David Megginson wrote:
  I didn't seem to make any difference -- 3D buildings, trees, etc.
  were still floating above the roofs of the bump-map buildings.  I also
  tried
 
 Keep in mind that relief mapping is just trickery to make something
 look like it is standing out from the scenery. In fact everything is
 rendered in the same 2d plane. That might be the main cause of this effect.

Exactly. If you want real silhouettes, you need to add geometry to the 
current terrain. It should be possible to alter depth information to 
have realistic intersections with 3d objects, but I didn't manage so far.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://fgsd.sourceforge.net/   FlightGear Scenery Designer


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-18 Thread David Megginson
On Thu, Mar 18, 2010 at 8:43 AM, Torsten Dreyer tors...@t3r.de wrote:

 First of all: That's a really cool eye candy, good work!

Seconded.  This is the coolest addition I've seen to FlightGear in a long time.

 What I noticed from a close up is, that it seems that the floor of the
 buildings is below elevation zero and the roof is at elevation zero. It
 looks somewhat as if the cities were carved out of the landscape instead of
 been built uppon it. This is especially irritating when a waterway is crossing
 an urban area and the water surface is several meters above the ground.

I noticed the same problem with roads and 3d buildings -- they're
floating above the city.  Is it possible to make the bump maps go up
instead of down?


All the best,


David

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-18 Thread Frederic Bouvier
Hi David,

- David Megginson a écrit :

 On Thu, Mar 18, 2010 at 8:43 AM, Torsten Dreyer tors...@t3r.de
 wrote:
 
  First of all: That's a really cool eye candy, good work!
 
 Seconded.  This is the coolest addition I've seen to FlightGear in a
 long time.
 
  What I noticed from a close up is, that it seems that the floor of
  the buildings is below elevation zero and the roof is at elevation
  zero. It looks somewhat as if the cities were carved out of the 
  landscape instead of been built uppon it. This is especially 
  irritating when a waterway is crossing
  an urban area and the water surface is several meters above the
  ground.
 
 I noticed the same problem with roads and 3d buildings -- they're
 floating above the city.  Is it possible to make the bump maps go up
 instead of down?

In Shaders/urban.frag, change line 57 :

vec2 dp = gl_TexCoord[0].st;

into :

vec2 dp = gl_TexCoord[0].st - ds;

Tell me what do you think. Try to land in the city.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://fgsd.sourceforge.net/   FlightGear Scenery Designer


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-18 Thread David Megginson
On Thu, Mar 18, 2010 at 5:56 PM, Frederic Bouvier fredfgf...@free.fr wrote:

 I noticed the same problem with roads and 3d buildings -- they're
 floating above the city.  Is it possible to make the bump maps go up
 instead of down?

 In Shaders/urban.frag, change line 57 :

        vec2 dp = gl_TexCoord[0].st;

 into :

        vec2 dp = gl_TexCoord[0].st - ds;

 Tell me what do you think. Try to land in the city.

I didn't seem to make any difference -- 3D buildings, trees, etc. were
still floating above the roofs of the bump-map buildings.  I also
tried

vec2 dp = gl_TexCoord[0].st + ds;

and

vec2 dp = gl_TexCoord[0].st - 2 * ds;


Thanks,


David

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Make relief map go up instead of down? (was Re: Shaders experiments)

2010-03-18 Thread Anders Gidenstam
On Thu, 18 Mar 2010, David Megginson wrote:

 I didn't seem to make any difference -- 3D buildings, trees, etc. were
 still floating above the roofs of the bump-map buildings.  I also
 tried

Hi,

You could try this diff:
http://pastebin.ca/1845056

It is possible that this does the same as Fred's change but in a more 
complicated way - however I don't think it does but rather more properly 
search part of the relief map between the fragment and the viewer (rather 
than on the other side of the fragment) which will correspond to the 
relief being above than the polygon.

The Z-buffer depth of the fragment remains the same so you will see depth 
problems - but I'm trying to figure out how to compute the desired 
Z-buffer depth for the fragment to solve this problem.

Cheers,

Anders
-- 
---
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel