leigh.mcrae@cogeco.ca | 29 Sep 2010 04:25
Picon
Favicon

Planar shadows

  Hi,

I have hooked up planar shadows for my Android Tank game using a matrix 
to project all geometry onto the ground. The game has the luxury of 
having  a 2D battle field.  The problem is that I am using instanced 
rocks that are randomly rotated and pushed into ground.  So now I get a 
reverse shadow projected from underneath.  Is there any way to get rid 
of this?

Leigh

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

Jeff Russell | 29 Sep 2010 17:53

Re: Planar shadows

Yes there is - clip your shadow geometry against the ground plane before it gets flattened. You can do this with the discard keyword in your shadow pixel shader.

Jeff

On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca <leigh.mcrae <at> cogeco.ca> wrote:
 Hi,

I have hooked up planar shadows for my Android Tank game using a matrix
to project all geometry onto the ground. The game has the luxury of
having  a 2D battle field.  The problem is that I am using instanced
rocks that are randomly rotated and pushed into ground.  So now I get a
reverse shadow projected from underneath.  Is there any way to get rid
of this?

Leigh

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list



--
Jeff Russell
Engineer, 8monkey Labs
www.8monkeylabs.com
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
leigh.mcrae@cogeco.ca | 29 Sep 2010 22:57
Picon
Favicon

Re: Planar shadows

  Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.  So far 
my solutions is, well, don't push the rocks so far into the ground :)

Leigh

On 9/29/2010 11:53 AM, Jeff Russell wrote:
> Yes there is - clip your shadow geometry against the ground plane 
> before it gets flattened. You can do this with the discard keyword in 
> your shadow pixel shader.
>
> Jeff
>
> On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca 
> <mailto:leigh.mcrae <at> cogeco.ca> <leigh.mcrae <at> cogeco.ca 
> <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>
>      Hi,
>
>     I have hooked up planar shadows for my Android Tank game using a
>     matrix
>     to project all geometry onto the ground. The game has the luxury of
>     having  a 2D battle field.  The problem is that I am using instanced
>     rocks that are randomly rotated and pushed into ground.  So now I
>     get a
>     reverse shadow projected from underneath.  Is there any way to get rid
>     of this?
>
>     Leigh
>
>     ------------------------------------------------------------------------------
>     Start uncovering the many advantages of virtual appliances
>     and start using them to simplify application deployment and
>     accelerate your shift to cloud computing.
>     http://p.sf.net/sfu/novell-sfdev2dev
>     _______________________________________________
>     GDAlgorithms-list mailing list
>     GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     Archives:
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
>
> -- 
> Jeff Russell
> Engineer, 8monkey Labs
> www.8monkeylabs.com <http://www.8monkeylabs.com>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
>
>
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

Jeff Russell | 29 Sep 2010 23:09

Re: Planar shadows

You may still be able to clip without a shader - opengl has user clip planes available in some versions, check your docs.

The alternative is you could not completely flatten your geometry, just "mostly" flatten it so that it appears flat enough. Then you can still have your matrix set up to keep the unwanted geometry below the ground plane, and the depth test against the ground geometry will take care of it.

On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca <leigh.mcrae <at> cogeco.ca> wrote:
 Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.  So far
my solutions is, well, don't push the rocks so far into the ground :)

Leigh

On 9/29/2010 11:53 AM, Jeff Russell wrote:
> Yes there is - clip your shadow geometry against the ground plane
> before it gets flattened. You can do this with the discard keyword in
> your shadow pixel shader.
>
> Jeff
>
> On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
> <mailto:leigh.mcrae <at> cogeco.ca> <leigh.mcrae <at> cogeco.ca
> <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>
>      Hi,
>
>     I have hooked up planar shadows for my Android Tank game using a
>     matrix
>     to project all geometry onto the ground. The game has the luxury of
>     having  a 2D battle field.  The problem is that I am using instanced
>     rocks that are randomly rotated and pushed into ground.  So now I
>     get a
>     reverse shadow projected from underneath.  Is there any way to get rid
>     of this?
>
>     Leigh
>
>     ------------------------------------------------------------------------------
>     Start uncovering the many advantages of virtual appliances
>     and start using them to simplify application deployment and
>     accelerate your shift to cloud computing.
>     http://p.sf.net/sfu/novell-sfdev2dev
>     _______________________________________________
>     GDAlgorithms-list mailing list
>     GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
> www.8monkeylabs.com <http://www.8monkeylabs.com>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
>
>
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list



--
Jeff Russell
Engineer, 8monkey Labs
www.8monkeylabs.com
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
Simon Kozlov | 29 Sep 2010 23:30
Favicon

Re: Planar shadows

One alternative for fixed-function pipeline is to put height-dependent
value in alpha channel and use alpha test to clip parts below the
ground.

Simon

On Wed, Sep 29, 2010 at 2:09 PM, Jeff Russell <jeffdr <at> 8monkeylabs.com> wrote:
> You may still be able to clip without a shader - opengl has user clip planes
> available in some versions, check your docs.
>
> The alternative is you could not completely flatten your geometry, just
> "mostly" flatten it so that it appears flat enough. Then you can still have
> your matrix set up to keep the unwanted geometry below the ground plane, and
> the depth test against the ground geometry will take care of it.
>
> On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca
> <leigh.mcrae <at> cogeco.ca> wrote:
>>
>>  Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.  So far
>> my solutions is, well, don't push the rocks so far into the ground :)
>>
>> Leigh
>>
>> On 9/29/2010 11:53 AM, Jeff Russell wrote:
>> > Yes there is - clip your shadow geometry against the ground plane
>> > before it gets flattened. You can do this with the discard keyword in
>> > your shadow pixel shader.
>> >
>> > Jeff
>> >
>> > On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
>> > <mailto:leigh.mcrae <at> cogeco.ca> <leigh.mcrae <at> cogeco.ca
>> > <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>> >
>> >      Hi,
>> >
>> >     I have hooked up planar shadows for my Android Tank game using a
>> >     matrix
>> >     to project all geometry onto the ground. The game has the luxury of
>> >     having  a 2D battle field.  The problem is that I am using instanced
>> >     rocks that are randomly rotated and pushed into ground.  So now I
>> >     get a
>> >     reverse shadow projected from underneath.  Is there any way to get
>> > rid
>> >     of this?
>> >
>> >     Leigh
>> >
>> >
>> > ------------------------------------------------------------------------------
>> >     Start uncovering the many advantages of virtual appliances
>> >     and start using them to simplify application deployment and
>> >     accelerate your shift to cloud computing.
>> >     http://p.sf.net/sfu/novell-sfdev2dev
>> >     _______________________________________________
>> >     GDAlgorithms-list mailing list
>> >     GDAlgorithms-list <at> lists.sourceforge.net
>> >     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>> >     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> >     Archives:
>> >
>> > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>> >
>> >
>> >
>> >
>> > --
>> > Jeff Russell
>> > Engineer, 8monkey Labs
>> > www.8monkeylabs.com <http://www.8monkeylabs.com>
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Start uncovering the many advantages of virtual appliances
>> > and start using them to simplify application deployment and
>> > accelerate your shift to cloud computing.
>> > http://p.sf.net/sfu/novell-sfdev2dev
>> >
>> >
>> > _______________________________________________
>> > GDAlgorithms-list mailing list
>> > GDAlgorithms-list <at> lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> > Archives:
>> >
>> > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> GDAlgorithms-list mailing list
>> GDAlgorithms-list <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> Archives:
>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
> --
> Jeff Russell
> Engineer, 8monkey Labs
> www.8monkeylabs.com
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

Shaun Kime | 30 Sep 2010 05:37
Picon

Re: Planar shadows

Take a look at the following presentation: http://artis.inrialpes.fr/Recherche/RealTimeShadows/pdf/stencil.pdf , especially section 5: Improving Planar Projected Shadows with Stencil

Thanks,
Shaun Kime

On Wed, Sep 29, 2010 at 5:30 PM, Simon Kozlov <simon <at> roblox.com> wrote:
One alternative for fixed-function pipeline is to put height-dependent
value in alpha channel and use alpha test to clip parts below the
ground.

Simon

On Wed, Sep 29, 2010 at 2:09 PM, Jeff Russell <jeffdr <at> 8monkeylabs.com> wrote:
> You may still be able to clip without a shader - opengl has user clip planes
> available in some versions, check your docs.
>
> The alternative is you could not completely flatten your geometry, just
> "mostly" flatten it so that it appears flat enough. Then you can still have
> your matrix set up to keep the unwanted geometry below the ground plane, and
> the depth test against the ground geometry will take care of it.
>
> On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca
> <leigh.mcrae <at> cogeco.ca> wrote:
>>
>>  Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.  So far
>> my solutions is, well, don't push the rocks so far into the ground :)
>>
>> Leigh
>>
>> On 9/29/2010 11:53 AM, Jeff Russell wrote:
>> > Yes there is - clip your shadow geometry against the ground plane
>> > before it gets flattened. You can do this with the discard keyword in
>> > your shadow pixel shader.
>> >
>> > Jeff
>> >
>> > On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
>> > <mailto:leigh.mcrae <at> cogeco.ca> <leigh.mcrae <at> cogeco.ca
>> > <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>> >
>> >      Hi,
>> >
>> >     I have hooked up planar shadows for my Android Tank game using a
>> >     matrix
>> >     to project all geometry onto the ground. The game has the luxury of
>> >     having  a 2D battle field.  The problem is that I am using instanced
>> >     rocks that are randomly rotated and pushed into ground.  So now I
>> >     get a
>> >     reverse shadow projected from underneath.  Is there any way to get
>> > rid
>> >     of this?
>> >
>> >     Leigh
>> >
>> >
>> > ------------------------------------------------------------------------------
>> >     Start uncovering the many advantages of virtual appliances
>> >     and start using them to simplify application deployment and
>> >     accelerate your shift to cloud computing.
>> >     http://p.sf.net/sfu/novell-sfdev2dev
>> >     _______________________________________________
>> >     GDAlgorithms-list mailing list
>> >     GDAlgorithms-list <at> lists.sourceforge.net
>> >     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>> >     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> >     Archives:
>> >
>> > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>> >
>> >
>> >
>> >
>> > --
>> > Jeff Russell
>> > Engineer, 8monkey Labs
>> > www.8monkeylabs.com <http://www.8monkeylabs.com>
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Start uncovering the many advantages of virtual appliances
>> > and start using them to simplify application deployment and
>> > accelerate your shift to cloud computing.
>> > http://p.sf.net/sfu/novell-sfdev2dev
>> >
>> >
>> > _______________________________________________
>> > GDAlgorithms-list mailing list
>> > GDAlgorithms-list <at> lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> > Archives:
>> >
>> > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> GDAlgorithms-list mailing list
>> GDAlgorithms-list <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> Archives:
>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
> --
> Jeff Russell
> Engineer, 8monkey Labs
> www.8monkeylabs.com
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
leigh.mcrae@cogeco.ca | 30 Sep 2010 16:17
Picon
Favicon

Re: Planar shadows

  Thank you I will look into that.

On 9/29/2010 5:09 PM, Jeff Russell wrote:
> You may still be able to clip without a shader - opengl has user clip 
> planes available in some versions, check your docs.
>
> The alternative is you could not completely flatten your geometry, 
> just "mostly" flatten it so that it appears flat enough. Then you can 
> still have your matrix set up to keep the unwanted geometry below the 
> ground plane, and the depth test against the ground geometry will take 
> care of it.
>
> On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca 
> <mailto:leigh.mcrae <at> cogeco.ca> <leigh.mcrae <at> cogeco.ca 
> <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>
>      Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.
>      So far
>     my solutions is, well, don't push the rocks so far into the ground :)
>
>     Leigh
>
>     On 9/29/2010 11:53 AM, Jeff Russell wrote:
>     > Yes there is - clip your shadow geometry against the ground plane
>     > before it gets flattened. You can do this with the discard
>     keyword in
>     > your shadow pixel shader.
>     >
>     > Jeff
>     >
>     > On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
>     <mailto:leigh.mcrae <at> cogeco.ca>
>     > <mailto:leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>>
>     <leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>
>     > <mailto:leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>>>
>     wrote:
>     >
>     >      Hi,
>     >
>     >     I have hooked up planar shadows for my Android Tank game using a
>     >     matrix
>     >     to project all geometry onto the ground. The game has the
>     luxury of
>     >     having  a 2D battle field.  The problem is that I am using
>     instanced
>     >     rocks that are randomly rotated and pushed into ground.  So
>     now I
>     >     get a
>     >     reverse shadow projected from underneath.  Is there any way
>     to get rid
>     >     of this?
>     >
>     >     Leigh
>     >
>     >    
>     ------------------------------------------------------------------------------
>     >     Start uncovering the many advantages of virtual appliances
>     >     and start using them to simplify application deployment and
>     >     accelerate your shift to cloud computing.
>     > http://p.sf.net/sfu/novell-sfdev2dev
>     >     _______________________________________________
>     >     GDAlgorithms-list mailing list
>     > GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     > <mailto:GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>>
>     > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     >     Archives:
>     >
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>     >
>     >
>     >
>     >
>     > --
>     > Jeff Russell
>     > Engineer, 8monkey Labs
>     > www.8monkeylabs.com <http://www.8monkeylabs.com>
>     <http://www.8monkeylabs.com>
>     >
>     >
>     >
>     ------------------------------------------------------------------------------
>     > Start uncovering the many advantages of virtual appliances
>     > and start using them to simplify application deployment and
>     > accelerate your shift to cloud computing.
>     > http://p.sf.net/sfu/novell-sfdev2dev
>     >
>     >
>     > _______________________________________________
>     > GDAlgorithms-list mailing list
>     > GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     > Archives:
>     >
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>     ------------------------------------------------------------------------------
>     Start uncovering the many advantages of virtual appliances
>     and start using them to simplify application deployment and
>     accelerate your shift to cloud computing.
>     http://p.sf.net/sfu/novell-sfdev2dev
>     _______________________________________________
>     GDAlgorithms-list mailing list
>     GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     Archives:
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
>
> -- 
> Jeff Russell
> Engineer, 8monkey Labs
> www.8monkeylabs.com <http://www.8monkeylabs.com>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
>
>
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

leigh.mcrae@cogeco.ca | 30 Sep 2010 16:18
Picon
Favicon

Re: Planar shadows

  The models are instanced, so I don't see how I could use this.  Thanks 
though.

On 9/29/2010 5:30 PM, Simon Kozlov wrote:
> One alternative for fixed-function pipeline is to put height-dependent
> value in alpha channel and use alpha test to clip parts below the
> ground.
>
> Simon
>
> On Wed, Sep 29, 2010 at 2:09 PM, Jeff Russell<jeffdr <at> 8monkeylabs.com>  wrote:
>> You may still be able to clip without a shader - opengl has user clip planes
>> available in some versions, check your docs.
>>
>> The alternative is you could not completely flatten your geometry, just
>> "mostly" flatten it so that it appears flat enough. Then you can still have
>> your matrix set up to keep the unwanted geometry below the ground plane, and
>> the depth test against the ground geometry will take care of it.
>>
>> On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca
>> <leigh.mcrae <at> cogeco.ca>  wrote:
>>>   Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.  So far
>>> my solutions is, well, don't push the rocks so far into the ground :)
>>>
>>> Leigh
>>>
>>> On 9/29/2010 11:53 AM, Jeff Russell wrote:
>>>> Yes there is - clip your shadow geometry against the ground plane
>>>> before it gets flattened. You can do this with the discard keyword in
>>>> your shadow pixel shader.
>>>>
>>>> Jeff
>>>>
>>>> On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
>>>> <mailto:leigh.mcrae <at> cogeco.ca>  <leigh.mcrae <at> cogeco.ca
>>>> <mailto:leigh.mcrae <at> cogeco.ca>>  wrote:
>>>>
>>>>       Hi,
>>>>
>>>>      I have hooked up planar shadows for my Android Tank game using a
>>>>      matrix
>>>>      to project all geometry onto the ground. The game has the luxury of
>>>>      having  a 2D battle field.  The problem is that I am using instanced
>>>>      rocks that are randomly rotated and pushed into ground.  So now I
>>>>      get a
>>>>      reverse shadow projected from underneath.  Is there any way to get
>>>> rid
>>>>      of this?
>>>>
>>>>      Leigh
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>      Start uncovering the many advantages of virtual appliances
>>>>      and start using them to simplify application deployment and
>>>>      accelerate your shift to cloud computing.
>>>>      http://p.sf.net/sfu/novell-sfdev2dev
>>>>      _______________________________________________
>>>>      GDAlgorithms-list mailing list
>>>>      GDAlgorithms-list <at> lists.sourceforge.net
>>>>      <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>>>>      https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>>>>      Archives:
>>>>
>>>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jeff Russell
>>>> Engineer, 8monkey Labs
>>>> www.8monkeylabs.com<http://www.8monkeylabs.com>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Start uncovering the many advantages of virtual appliances
>>>> and start using them to simplify application deployment and
>>>> accelerate your shift to cloud computing.
>>>> http://p.sf.net/sfu/novell-sfdev2dev
>>>>
>>>>
>>>> _______________________________________________
>>>> GDAlgorithms-list mailing list
>>>> GDAlgorithms-list <at> lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>>>> Archives:
>>>>
>>>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Start uncovering the many advantages of virtual appliances
>>> and start using them to simplify application deployment and
>>> accelerate your shift to cloud computing.
>>> http://p.sf.net/sfu/novell-sfdev2dev
>>> _______________________________________________
>>> GDAlgorithms-list mailing list
>>> GDAlgorithms-list <at> lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>>> Archives:
>>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>
>>
>> --
>> Jeff Russell
>> Engineer, 8monkey Labs
>> www.8monkeylabs.com
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> GDAlgorithms-list mailing list
>> GDAlgorithms-list <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>> Archives:
>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

leigh.mcrae@cogeco.ca | 30 Sep 2010 16:20
Picon
Favicon

Re: Planar shadows


Thank you I will read it.

Leigh

On 9/29/2010 11:37 PM, Shaun Kime wrote:
> Take a look at the following presentation: 
> http://artis.inrialpes.fr/Recherche/RealTimeShadows/pdf/stencil.pdf , 
> especially section 5: Improving Planar Projected Shadows with Stencil
>
> Thanks,
> Shaun Kime
>
> On Wed, Sep 29, 2010 at 5:30 PM, Simon Kozlov <simon <at> roblox.com 
> <mailto:simon <at> roblox.com>> wrote:
>
>     One alternative for fixed-function pipeline is to put height-dependent
>     value in alpha channel and use alpha test to clip parts below the
>     ground.
>
>     Simon
>
>     On Wed, Sep 29, 2010 at 2:09 PM, Jeff Russell
>     <jeffdr <at> 8monkeylabs.com <mailto:jeffdr <at> 8monkeylabs.com>> wrote:
>     > You may still be able to clip without a shader - opengl has user
>     clip planes
>     > available in some versions, check your docs.
>     >
>     > The alternative is you could not completely flatten your
>     geometry, just
>     > "mostly" flatten it so that it appears flat enough. Then you can
>     still have
>     > your matrix set up to keep the unwanted geometry below the
>     ground plane, and
>     > the depth test against the ground geometry will take care of it.
>     >
>     > On Wed, Sep 29, 2010 at 3:57 PM, leigh.mcrae <at> cogeco.ca
>     <mailto:leigh.mcrae <at> cogeco.ca>
>     > <leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>> wrote:
>     >>
>     >>  Thanks but it's OpenGL 1.0 for BlackBerry and 1.1 for Android.
>      So far
>     >> my solutions is, well, don't push the rocks so far into the
>     ground :)
>     >>
>     >> Leigh
>     >>
>     >> On 9/29/2010 11:53 AM, Jeff Russell wrote:
>     >> > Yes there is - clip your shadow geometry against the ground plane
>     >> > before it gets flattened. You can do this with the discard
>     keyword in
>     >> > your shadow pixel shader.
>     >> >
>     >> > Jeff
>     >> >
>     >> > On Tue, Sep 28, 2010 at 9:25 PM, leigh.mcrae <at> cogeco.ca
>     <mailto:leigh.mcrae <at> cogeco.ca>
>     >> > <mailto:leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>>
>     <leigh.mcrae <at> cogeco.ca <mailto:leigh.mcrae <at> cogeco.ca>
>     >> > <mailto:leigh.mcrae <at> cogeco.ca
>     <mailto:leigh.mcrae <at> cogeco.ca>>> wrote:
>     >> >
>     >> >      Hi,
>     >> >
>     >> >     I have hooked up planar shadows for my Android Tank game
>     using a
>     >> >     matrix
>     >> >     to project all geometry onto the ground. The game has the
>     luxury of
>     >> >     having  a 2D battle field.  The problem is that I am
>     using instanced
>     >> >     rocks that are randomly rotated and pushed into ground.
>      So now I
>     >> >     get a
>     >> >     reverse shadow projected from underneath.  Is there any
>     way to get
>     >> > rid
>     >> >     of this?
>     >> >
>     >> >     Leigh
>     >> >
>     >> >
>     >> >
>     ------------------------------------------------------------------------------
>     >> >     Start uncovering the many advantages of virtual appliances
>     >> >     and start using them to simplify application deployment and
>     >> >     accelerate your shift to cloud computing.
>     >> > http://p.sf.net/sfu/novell-sfdev2dev
>     >> >     _______________________________________________
>     >> >     GDAlgorithms-list mailing list
>     >> > GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     >> > <mailto:GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>>
>     >> > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     >> >     Archives:
>     >> >
>     >> >
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>     >> >
>     >> >
>     >> >
>     >> >
>     >> > --
>     >> > Jeff Russell
>     >> > Engineer, 8monkey Labs
>     >> > www.8monkeylabs.com <http://www.8monkeylabs.com>
>     <http://www.8monkeylabs.com>
>     >> >
>     >> >
>     >> >
>     >> >
>     ------------------------------------------------------------------------------
>     >> > Start uncovering the many advantages of virtual appliances
>     >> > and start using them to simplify application deployment and
>     >> > accelerate your shift to cloud computing.
>     >> > http://p.sf.net/sfu/novell-sfdev2dev
>     >> >
>     >> >
>     >> > _______________________________________________
>     >> > GDAlgorithms-list mailing list
>     >> > GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     >> > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     >> > Archives:
>     >> >
>     >> >
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>     >>
>     >>
>     >>
>     >>
>     ------------------------------------------------------------------------------
>     >> Start uncovering the many advantages of virtual appliances
>     >> and start using them to simplify application deployment and
>     >> accelerate your shift to cloud computing.
>     >> http://p.sf.net/sfu/novell-sfdev2dev
>     >> _______________________________________________
>     >> GDAlgorithms-list mailing list
>     >> GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     >> Archives:
>     >>
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>     >
>     >
>     >
>     > --
>     > Jeff Russell
>     > Engineer, 8monkey Labs
>     > www.8monkeylabs.com <http://www.8monkeylabs.com>
>     >
>     >
>     ------------------------------------------------------------------------------
>     > Start uncovering the many advantages of virtual appliances
>     > and start using them to simplify application deployment and
>     > accelerate your shift to cloud computing.
>     > http://p.sf.net/sfu/novell-sfdev2dev
>     > _______________________________________________
>     > GDAlgorithms-list mailing list
>     > GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     > Archives:
>     >
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>     >
>
>     ------------------------------------------------------------------------------
>     Start uncovering the many advantages of virtual appliances
>     and start using them to simplify application deployment and
>     accelerate your shift to cloud computing.
>     http://p.sf.net/sfu/novell-sfdev2dev
>     _______________________________________________
>     GDAlgorithms-list mailing list
>     GDAlgorithms-list <at> lists.sourceforge.net
>     <mailto:GDAlgorithms-list <at> lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
>     Archives:
>     http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
>
>
> _______________________________________________
> GDAlgorithms-list mailing list
> GDAlgorithms-list <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

Andreas Brinck | 1 Oct 2010 09:57
Picon
Gravatar

Filtering

Hi,

I have a texture in which I use the R, G and B channel to store a
value in the [0, 1] range with very high precision. The value is
extracted like this in the (Cg) shader:

float
extractValue(float2 pos) {
    float4 temp = tex2D(buffer, pos);
    return (temp.x * 16711680.0 + temp.y * 65280.0 + temp.z * 255.0) *
(1.0 / 16777215.0);
}

I now want to sample this value with bilinear filtering but when I do
this I don't get a correct result. If I do the filtering manually like
this:

float
sampleValue(float2 pos) {
	float2 ipos = floor(pos);
	float2 fracs = pos - ipos;
	float d0 = extractValue(ipos);
	float d1 = extractValue(ipos + float2(1, 0));
	float d2 = extractValue(ipos + float2(0, 1));
	float d3 = extractValue(ipos + float2(1, 1));
	return lerp(lerp(d0, d1, fracs.x), lerp(d2, d3, fracs.x), fracs.y);
}

everything works as expected. The values in the buffer can be seen as
a linear combination of three constants:

value = (C0 * r + C1 * g + C2 * b)

If we use the built in texture filtering we should get the following
if we sample somewhere between two texels: {r0, g0, b0} and {r1, g1,
b1}. For simplicity we just look at filtering along one axis:

filtered value = lerp(r0, r1, t) * C0 + lerp(g0, g1, t) * C1 +
lerp(b0, b1, t) * C2;

Doing the filtering manually:

filtered value = lerp(r0 * C0 + b0 * C1 + g0 * C2, r1 * C0 + g1 * C1 +
b1 * C2, t)  =
                   = (r0 * C0 + b0 * C1 + g0 * C2) * (1 - t) + (r1 *
C0 + g1 * C1 + b1 * C2) * t =
                   = (r0 * C0) * (1 - t) + (r1 * C0) * t + ... =
                   = lerp(r0, r1, t) * C0 + ...

So in the world of non floating point numbers these two should be
equivalent right?

My theory is that the error is caused by an unfortunate order of
floating point operations. I've tried variations like:

(temp.x * (16711680.0 / 16777215.0) + temp.y * (65280.0/16777215.0) +
temp.z * (255.0/16777215.0))

and

(((temp.x * 256.0 + temp.y) * 256.0 + temp.z) * 255.0) * (1.0 / 16777215.0)

but all exhibit the same problem. What do you think; is it possible to
solve this problem?

Regards Andreas

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list


Gmane