Erin Catto | 1 Nov 2007 06:46
Picon
Favicon

Re: [Algorithms] Raycasting - how fast does it get?

----- Original Message ----

Other contenders that come to mind:
1) loose octree
2) plain octree (every polygon in up to 8 nodes)
3) a kd-tree
4) a bsp, but having polygons in leaf nodes and testing the polygons
individually, instead of just searching for a solid node (this one
should work even with a general polygon soup).

I'm guessing a kd-tree will be among the fastest because each branch is so
cheap to compute. The downside is the necessary primitive splitting or replication.

If you don't want to split primitives, I suggest looking at loose kd-trees as shown in some of Thatcher
Ulrich's open source code (not the loose octree stuff). You can view a loose kd-tree as an axis-aligned
bounding half-space tree. I found loose kd-trees to be much faster than AABB trees for ray casting and to
use less memory (even less than compressed AABBs).

I also found a good build rule: minimize the combined surface area of AABBs that contain the children. This
works better for flat meshes than using the child volumes.

Erin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
(Continue reading)

Jason Hughes | 1 Nov 2007 07:29

Re: [Algorithms] Raycasting - how fast does it get?

Erin Catto wrote:
> I'm guessing a kd-tree will be among the fastest because each branch is so
> cheap to compute. The downside is the necessary primitive splitting or replication.
>
> If you don't want to split primitives, I suggest looking at loose kd-trees as shown in some of Thatcher
Ulrich's open source code (not the loose octree stuff). You can view a loose kd-tree as an axis-aligned
bounding half-space tree. I found loose kd-trees to be much faster than AABB trees for ray casting and to
use less memory (even less than compressed AABBs).
>
>   
There are probably many ways to skin this cat.  :-)

Actually, I did something that was neither of those options.  I bucketed 
all my triangles by some regular point feature (centroid is fine).  This 
gives me unambiguous splitting planes because I can split on exactly the 
median every time.  During traversal, I run through all triangles in the 
leaf to check distance to the actual triangle, not the associated 
point.  The traversal is slightly altered as well, I (to oversimplify a 
bit) find the closest triangle in the current cell, but if the splitting 
plane is closer than that point, I search the other side of the plane as 
well and early out if nothing over there is closer than what I've found 
already.  The devil is in the details, because it requires projection of 
the query point into the opposing cell, yet the distance check must be 
from the original query point... 

As a caveat, I also know that the mesh is preconditioned to have 
triangles that are generally the same size.  Were this not true, a large 
triangle on the other side of the splitting plane might be missed as the 
collision point.  For my purposes, this is an acceptable risk, since the 
results aren't used for rendering or collision, and any error will be a 
(Continue reading)

Eric Haines | 2 Nov 2007 15:23
Picon

[Algorithms] Second layer shadow mapping to avoid acne?

So a classic problem with shadow mapping is self-shadowing, "surface acne", where the receiver shadows itself. There are various fixed and plane gradient biases that can be set to avoid the problem, though nothing's foolproof.

One old trick (Wang & Molnar 1994, though I'd seen it before then) is to simply do frontface culling when making the shadow map. Now the receiver is (usually) nowhere near the depth of the occluder and self-shadowing is avoided.

My question: is this what game developers using shadow maps usually do? I was talking with someone at NVIDIA and he maintains most do so. Also, are there any fatal flaws I'm missing? (see list below)

I was a little surprised that backface culling would be the norm, as this method has its own problems:

1) double-sided objects: the backface == the frontface, so the surface acne problem is back. This happens for things like palm fronds or other cutout textures. I'd solve it by simply offsetting the fronds a fair bit when written into the shadow map (more than solid objects).
2) thin objects: similar problem.
3) near silhouette edges: again with the acne. All these could be helped by traditional biasing techniques, but then that makes the next problem worse:
4) light leaks at point of contact: a cube is on a plane, you're looking at an edge on the plane in shadow. Light leaks through the cube (since the backfaces are very close to the plane) and there's a streak of random light blobs on the plane where the cube is. My NVIDIA contact says "move the cube off the plane, no one will notice". Fair enough - a little Peter Panning, but otherwise OK.
5) if objects interpenetrate you'll get the same light leaking at the points of contact. Solution: don't let objects interpenetrate for any appreciable amount of time.

Really, none of these problem are insurmountable, and so "draw the backfaces" does seem like a pretty good solution overall as it avoids self-shadowing headaches 95% of the time by default.

Comments? I'm writing about this in "Real-Time Rendering" and would like to get "best practices" across.

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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
Joris Mans | 2 Nov 2007 15:36
Picon

Re: [Algorithms] Second layer shadow mapping to avoid acne?

Front face culling does allow self-shadowing. It breaks down when your objects arent "closed" dough (there is some nice term to describe this property, but i m not so good at computational-geometry-bingo so i'll leave that one to the specialists ;) ).
We use this, combined with some small bias, and some extra geometry inside objects to fix some leak cases.
 
But the generale rule with shadows is: whatever system you take, there are always cases where it breaks down.
 
Joris
 
----- Original Message -----
Sent: Friday, November 02, 2007 3:23 PM
Subject: [Algorithms] Second layer shadow mapping to avoid acne?

So a classic problem with shadow mapping is self-shadowing, "surface acne", where the receiver shadows itself. There are various fixed and plane gradient biases that can be set to avoid the problem, though nothing's foolproof.

One old trick (Wang & Molnar 1994, though I'd seen it before then) is to simply do frontface culling when making the shadow map. Now the receiver is (usually) nowhere near the depth of the occluder and self-shadowing is avoided.

My question: is this what game developers using shadow maps usually do? I was talking with someone at NVIDIA and he maintains most do so. Also, are there any fatal flaws I'm missing? (see list below)

I was a little surprised that backface culling would be the norm, as this method has its own problems:

1) double-sided objects: the backface == the frontface, so the surface acne problem is back. This happens for things like palm fronds or other cutout textures. I'd solve it by simply offsetting the fronds a fair bit when written into the shadow map (more than solid objects).
2) thin objects: similar problem.
3) near silhouette edges: again with the acne. All these could be helped by traditional biasing techniques, but then that makes the next problem worse:
4) light leaks at point of contact: a cube is on a plane, you're looking at an edge on the plane in shadow. Light leaks through the cube (since the backfaces are very close to the plane) and there's a streak of random light blobs on the plane where the cube is. My NVIDIA contact says "move the cube off the plane, no one will notice". Fair enough - a little Peter Panning, but otherwise OK.
5) if objects interpenetrate you'll get the same light leaking at the points of contact. Solution: don't let objects interpenetrate for any appreciable amount of time.

Really, none of these problem are insurmountable, and so "draw the backfaces" does seem like a pretty good solution overall as it avoids self-shadowing headaches 95% of the time by default.

Comments? I'm writing about this in "Real-Time Rendering" and would like to get "best practices" across.

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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
Marco Salvi | 2 Nov 2007 15:37
Picon

Re: [Algorithms] Second layer shadow mapping to avoid acne?

On 11/2/07, Eric Haines <erich666666 <at> gmail.com> wrote:

Really, none of these problem are insurmountable, and so "draw the backfaces" does seem like a pretty good solution overall as it avoids self-shadowing headaches 95% of the time by default.

Comments? I'm writing about this in "Real-Time Rendering" and would like to get "best practices" across.

Eric

I don't know if this is relevant to what you need to write but I think it's fair to add that more advanced shadow maps filtering algorithms such as variance shadow maps, convolution shadow maps, etc.. are all extremely good at converting 'acne' to a low frequency self shadowing term (when they don't completely eliminate acne) that most of the people don't notice at all.

 
Marco

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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
Willem H. de Boer | 2 Nov 2007 15:57

Re: [Algorithms] Second layer shadow mapping to avoid acne?

Wang & Molnar works under the premise that it's generally quite dark on back faces,
but this situation breaks down in a multiple-light situation. Imagine an object being lit
by a light on one side, and another light on the other side.
I too would be very interested in hearing about what other people have used in their games
engines to battle surface acne. I'm currently working on the same problem and would love
some input :)
 
Willem
----- Original Message -----
Sent: Friday, November 02, 2007 2:23 PM
Subject: [Algorithms] Second layer shadow mapping to avoid acne?

So a classic problem with shadow mapping is self-shadowing, "surface acne", where the receiver shadows itself. There are various fixed and plane gradient biases that can be set to avoid the problem, though nothing's foolproof.

One old trick (Wang & Molnar 1994, though I'd seen it before then) is to simply do frontface culling when making the shadow map. Now the receiver is (usually) nowhere near the depth of the occluder and self-shadowing is avoided.

My question: is this what game developers using shadow maps usually do? I was talking with someone at NVIDIA and he maintains most do so. Also, are there any fatal flaws I'm missing? (see list below)

I was a little surprised that backface culling would be the norm, as this method has its own problems:

1) double-sided objects: the backface == the frontface, so the surface acne problem is back. This happens for things like palm fronds or other cutout textures. I'd solve it by simply offsetting the fronds a fair bit when written into the shadow map (more than solid objects).
2) thin objects: similar problem.
3) near silhouette edges: again with the acne. All these could be helped by traditional biasing techniques, but then that makes the next problem worse:
4) light leaks at point of contact: a cube is on a plane, you're looking at an edge on the plane in shadow. Light leaks through the cube (since the backfaces are very close to the plane) and there's a streak of random light blobs on the plane where the cube is. My NVIDIA contact says "move the cube off the plane, no one will notice". Fair enough - a little Peter Panning, but otherwise OK.
5) if objects interpenetrate you'll get the same light leaking at the points of contact. Solution: don't let objects interpenetrate for any appreciable amount of time.

Really, none of these problem are insurmountable, and so "draw the backfaces" does seem like a pretty good solution overall as it avoids self-shadowing headaches 95% of the time by default.

Comments? I'm writing about this in "Real-Time Rendering" and would like to get "best practices" across.

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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
Richard Schubert | 2 Nov 2007 16:15
Picon
Favicon

Re: [Algorithms] Second layer shadow mapping to avoid acne?

Usually shadowmaps are applied to a specific light term. On the back side of an object there is no light, hence there is no shadow.
 
----- Original Message -----
Sent: Friday, November 02, 2007 3:57 PM
Subject: Re: [Algorithms] Second layer shadow mapping to avoid acne?

Wang & Molnar works under the premise that it's generally quite dark on back faces,
but this situation breaks down in a multiple-light situation. Imagine an object being lit
by a light on one side, and another light on the other side.
I too would be very interested in hearing about what other people have used in their games
engines to battle surface acne. I'm currently working on the same problem and would love
some input :)
 
Willem
----- Original Message -----
Sent: Friday, November 02, 2007 2:23 PM
Subject: [Algorithms] Second layer shadow mapping to avoid acne?

So a classic problem with shadow mapping is self-shadowing, "surface acne", where the receiver shadows itself. There are various fixed and plane gradient biases that can be set to avoid the problem, though nothing's foolproof.

One old trick (Wang & Molnar 1994, though I'd seen it before then) is to simply do frontface culling when making the shadow map. Now the receiver is (usually) nowhere near the depth of the occluder and self-shadowing is avoided.

My question: is this what game developers using shadow maps usually do? I was talking with someone at NVIDIA and he maintains most do so. Also, are there any fatal flaws I'm missing? (see list below)

I was a little surprised that backface culling would be the norm, as this method has its own problems:

1) double-sided objects: the backface == the frontface, so the surface acne problem is back. This happens for things like palm fronds or other cutout textures. I'd solve it by simply offsetting the fronds a fair bit when written into the shadow map (more than solid objects).
2) thin objects: similar problem.
3) near silhouette edges: again with the acne. All these could be helped by traditional biasing techniques, but then that makes the next problem worse:
4) light leaks at point of contact: a cube is on a plane, you're looking at an edge on the plane in shadow. Light leaks through the cube (since the backfaces are very close to the plane) and there's a streak of random light blobs on the plane where the cube is. My NVIDIA contact says "move the cube off the plane, no one will notice". Fair enough - a little Peter Panning, but otherwise OK.
5) if objects interpenetrate you'll get the same light leaking at the points of contact. Solution: don't let objects interpenetrate for any appreciable amount of time.

Really, none of these problem are insurmountable, and so "draw the backfaces" does seem like a pretty good solution overall as it avoids self-shadowing headaches 95% of the time by default.

Comments? I'm writing about this in "Real-Time Rendering" and would like to get "best practices" across.

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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
Sylvain G. Vignaud | 2 Nov 2007 16:25
Favicon

Re: [Algorithms] Second layer shadow mapping to avoid acne?

Some are using the average of Z_front and Z_back as the value in the
depth map to solve that.

----- Original Message -----
From: Eric Haines <erich666666 <at> gmail.com>
Date: Friday, November 2, 2007 2:23 pm
Subject: [Algorithms] Second layer shadow mapping to avoid acne?
To: Game Development Algorithms <gdalgorithms-list <at> lists.sourceforge.net>

> So a classic problem with shadow mapping is self-shadowing, 
> "surface acne",
> where the receiver shadows itself. There are various fixed and plane
> gradient biases that can be set to avoid the problem, though nothing's
> foolproof.
> 
> One old trick (Wang & Molnar 1994, though I'd seen it before then) 
> is to
> simply do frontface culling when making the shadow map. Now the 
> receiver is
> (usually) nowhere near the depth of the occluder and self-shadowing is
> avoided.
> 
> My question: is this what game developers using shadow maps usually 
> do? I
> was talking with someone at NVIDIA and he maintains most do so. 
> Also, are
> there any fatal flaws I'm missing? (see list below)
> 
> I was a little surprised that backface culling would be the norm, 
> as this
> method has its own problems:
> 
> 1) double-sided objects: the backface == the frontface, so the 
> surface acne
> problem is back. This happens for things like palm fronds or other 
> cutouttextures. I'd solve it by simply offsetting the fronds a fair 
> bit when
> written into the shadow map (more than solid objects).
> 2) thin objects: similar problem.
> 3) near silhouette edges: again with the acne. All these could be 
> helped by
> traditional biasing techniques, but then that makes the next 
> problem worse:
> 4) light leaks at point of contact: a cube is on a plane, you're 
> looking at
> an edge on the plane in shadow. Light leaks through the cube (since 
> thebackfaces are very close to the plane) and there's a streak of 
> random light
> blobs on the plane where the cube is. My NVIDIA contact says "move 
> the cube
> off the plane, no one will notice". Fair enough - a little Peter 
> Panning,but otherwise OK.
> 5) if objects interpenetrate you'll get the same light leaking at 
> the points
> of contact. Solution: don't let objects interpenetrate for any 
> appreciableamount of time.
> 
> Really, none of these problem are insurmountable, and so "draw the
> backfaces" does seem like a pretty good solution overall as it avoids
> self-shadowing headaches 95% of the time by default.
> 
> Comments? I'm writing about this in "Real-Time Rendering" and would 
> like to
> get "best practices" across.
> 
> Eric
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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

Jeremiah Zanin | 2 Nov 2007 17:04

Re: [Algorithms] Raycasting - how fast does it get?

Christer,

Do you think it would be better to split triangles that straddle a
splitting axis, or reference them from both sides, or use a loose
kd-tree?

-----Original Message-----
From: gdalgorithms-list-bounces <at> lists.sourceforge.net
[mailto:gdalgorithms-list-bounces <at> lists.sourceforge.net] On Behalf Of
christer_ericson <at> playstation.sony.com
Sent: Wednesday, October 31, 2007 12:22 PM
To: Alen Ladavac; Game Development Algorithms
Subject: Re: [Algorithms] Raycasting - how fast does it get?

Alen,

> To ask it straight off... What would be the fastest way to check a ray
> against a polygon soup? The mesh is static, so any kind of
> precalculation could be ok (as long as the memory requirement is not
> ridiculous). The only required result is distance of nearest hit (or
> +inf if it's a miss) - don't even need to know which polygon was hit.

For a tree-based hierarchy there are two things you need to
worry about:

1. The traversal cost of getting to where the data is, usually
   the leaves
2. The cost if intersecting the ray(s) against the polygons
   stored in the leaves

Optimizing both is all an exercise in caching.  Like many have
implied already, a k-d tree gives you very small tree nodes
which allows you to pack many of them into a single cache line.
By using a van Emde Boas-type chunking of the tree, you can
ensure that you can traverse several levels (3, 4, perhaps even
5) of the tree without ever leaving a cache line.  (Section 13.4.1
of my book outlines one way of doing this.)

Once you're in a leaf you want your data to be linearized (thus
cache line friendly) and also SIMD-able. Usually data is not stored
in such a format, because you're likely using indices etc to reduce
storage. However, as ray queries are usually coherent over time you
can pull all data in and write it into a software cache, in a
SIMD-friendly and linearized format. Then, each time you visit a
leaf, you check if you already have the leaf in your software cache
and your tests are blisteringly fast. (I talk about this too,
in Section 13.5.)  You'll have to experiment some to find out what
the appropriate number of polygons per leaf should be for your
particular application.

So, short answer: your best bet is likely a cache-aware k-d tree
(van Emde Boas style) with cached linearization of the leaves.

Christer Ericson, Director of Tools and Technology
Sony Computer Entertainment, Santa Monica
http://realtimecollisiondetection.net/blog/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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

Tom Forsyth | 2 Nov 2007 17:24

Re: [Algorithms] Second layer shadow mapping to avoid acne?

The polygonalisation of the object can still cause light to bleed around to
the back (interpolated gouraud shading, or slightly wonky interpolation on
the normal), and shadows to bleed around to the front. And then you can
still see the sharp terminator.

The best solution I've found is to bend the normals towards the light a bit.
That way the clamp(N.L) terminator moves around and puts slightly more of
the hard shadow terminator in the shade.

This obviously doesn't work with hemispherical/wraparound lighting models.
One way is to separate the hemispherical model into frontface and backface
components and only shadow the frontface stuff, but then it's twice as
expensive.

To the general question, I use frontface shadowbuffers and an offset for
self-shadowing, and then I use an ID buffer (not a depth buffer) for
shadowing between objects. Once you find a suitable intra-object offset
(MUCH easier than finding an inter-object offset), I found the artifacts
from backface rendering to be more objectionable than those from frontface
rendering.

TomF.

From: gdalgorithms-list-bounces <at> lists.sourceforge.net
[mailto:gdalgorithms-list-bounces <at> lists.sourceforge.net] On Behalf Of
Richard Schubert
Sent: Friday, November 02, 2007 8:16 AM
To: Game Development Algorithms
Subject: Re: [Algorithms] Second layer shadow mapping to avoid acne?

Usually shadowmaps are applied to a specific light term. On the back side of
an object there is no light, hence there is no shadow.
 
----- Original Message ----- 
From: Willem H. de Boer 
To: erich <at> acm.org ; Game Development Algorithms 
Sent: Friday, November 02, 2007 3:57 PM
Subject: Re: [Algorithms] Second layer shadow mapping to avoid acne?

Wang & Molnar works under the premise that it's generally quite dark on back
faces,
but this situation breaks down in a multiple-light situation. Imagine an
object being lit
by a light on one side, and another light on the other side. 
I too would be very interested in hearing about what other people have used
in their games 
engines to battle surface acne. I'm currently working on the same problem
and would love
some input :)
 
Willem
----- Original Message ----- 
From: Eric Haines 
To: Game Development Algorithms 
Sent: Friday, November 02, 2007 2:23 PM
Subject: [Algorithms] Second layer shadow mapping to avoid acne?

So a classic problem with shadow mapping is self-shadowing, "surface acne",
where the receiver shadows itself. There are various fixed and plane
gradient biases that can be set to avoid the problem, though nothing's
foolproof. 

One old trick (Wang & Molnar 1994, though I'd seen it before then) is to
simply do frontface culling when making the shadow map. Now the receiver is
(usually) nowhere near the depth of the occluder and self-shadowing is
avoided. 

My question: is this what game developers using shadow maps usually do? I
was talking with someone at NVIDIA and he maintains most do so. Also, are
there any fatal flaws I'm missing? (see list below)

I was a little surprised that backface culling would be the norm, as this
method has its own problems: 

1) double-sided objects: the backface == the frontface, so the surface acne
problem is back. This happens for things like palm fronds or other cutout
textures. I'd solve it by simply offsetting the fronds a fair bit when
written into the shadow map (more than solid objects). 
2) thin objects: similar problem.
3) near silhouette edges: again with the acne. All these could be helped by
traditional biasing techniques, but then that makes the next problem worse:
4) light leaks at point of contact: a cube is on a plane, you're looking at
an edge on the plane in shadow. Light leaks through the cube (since the
backfaces are very close to the plane) and there's a streak of random light
blobs on the plane where the cube is. My NVIDIA contact says "move the cube
off the plane, no one will notice". Fair enough - a little Peter Panning,
but otherwise OK. 
5) if objects interpenetrate you'll get the same light leaking at the points
of contact. Solution: don't let objects interpenetrate for any appreciable
amount of time.

Really, none of these problem are insurmountable, and so "draw the
backfaces" does seem like a pretty good solution overall as it avoids
self-shadowing headaches 95% of the time by default. 

Comments? I'm writing about this in "Real-Time Rendering" and would like to
get "best practices" across.

Eric
________________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/ 
________________________________________
_______________________________________________
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
________________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/ 
________________________________________
_______________________________________________
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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
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