creative labs teaches Carmack a thing or two about shadows?

That's the problem with software patents. There are only so many different ways to do the sme thing, and if you happen to "discover" a technique that's already used, you're the one to get in trouble.
I did a uni assignment (which involved sorting)a few years back and we had to reference every bit of code (or algorithms) we used. I implemented some sort of hash sort that I came up with on my own (or so I thought), but then lost marks because I was unable to reference it.
 
In my expert opinion, as a software architect who's been involved in company mandated efforts to obtain software patents, software patents suck. I do not know any engineers who think that software patents are or should be valid.
 
Hell, I thought I could think of a good way to play Devil's advocate here. But then I shot down my own arguments so fast it's not even funny. Dear God, software patents are just flat-out wrong.
 
here is the original text in JC's shadow volume email that was post on nvidia server.

John Carmack on shadow volumes...

I recieved this in email from John on May 23rd, 2000.

- Mark Kilgard


I solved this in a way that is so elegant you just won't believe it. Here
is a description that I posted to a private mailing list:

----------------------------------------------------------

I first implemented stencil shadow volumes over two years ago in the
post-Q2 research period. They looked great until you flew the viewpoint
into one of the volumes, and depending on the exact test you used, either
most of the screen went into negative shadow, or most of the shadows
disappeared.

The classic shadow volume works that stencil shadows are derived from
usually suggest "inverting the test when the view is inside a shadow
volume". That is not a robust solution, because a non-zero near clip plane
will give situations where the plane is not cleanly on one side or the
other of the view point. It is also non-trivial to make the "inside a
shadow volume" determination, especially after silhouette optimizations.

The conventional wisdom has been that you will need to clip the shadow
volumes to the view plane and cap with triangles, treating the shadow
volumes as if they were polyhedrons.

I implemented the easy cases of this, choosing to project the silhouette
points to either the far plane of the light's effect or the view plane.
For the clear-cut cases, this worked fine, allowing you to walk in front of
a shadowed object, or look directly at it with the light behind it.
Intermediate cases, where some of the vertexes should project onto the
light plane and some should project onto the view plane could also be
handled, but the cost of all the testing was starting to pile up.

Unfortunately, there are cases when an occluding triangle projects a shadow
volume that will clip to something other than a triangular prism. There
are cases where real, honest volume clipping must take place.

Anything that requires finding convex hulls in realtime is starting to
sound like a Bad Idea.

I sweated over this for a while, with the code getting grosser and grosser,
but then I had an idea for a different direction.

It should be possible to let the shadow volumes get clipped off at the view
plane like they always do, then find the clipped off areas in image space
and correct them.

The way to find if a volume has been clipped off is to render the shadow
volume with depth testing disabled, incrementing for the front faces and
decrementing for the back faces. If the stencil buffer ends up with the
original value, the shadow volume is well formed in front of the view volume.

My first attempt to utilize this involved a whole bunch of passes to
determine if it was well formed and combine it with the standard volume
stencil operations. It was an interesting experiment with masking and
anding in the stencil buffer to perform two operations, but it turned out
that, while it worked for simple shapes, complex shapes needed more
information from the volume clipping than just "well formed" or not.

The next iteration involved attempting to "preload" the standard stencil
shadow algorithm by the number of clipped away planes. I first drew the
shadow volumes with depth test disabled, incrementing for back sides and
decrementing for front sides. This finishes with a positive value in the
stencil buffer for each plane that is clipped away at the view plane. The
normal depth tested shadow volume is drawn next, with the change polarity
reversed, decrementing for back sides and incrementing for front sides.
The areas not equal to the initial clear value are in shadow.

That works all the time.

Later, I realized something else. The algorithm was now basically:

Draw back sides, incrementing both with depth pass and depth fail.
Draw front sides, decrementing both with depth pass and depth fail.
Draw back sides, decrementing with depth pass and doing nothing with depth
fail.
Draw front sides, incrementing both with depth and doing nothing with depth
fail.

Rearrange the passes and you get:
Draw back sides, incrementing both with depth pass and depth fail.
Draw back sides, decrementing with depth pass and doing nothing with depth
fail.
Draw front sides, decrementing both with depth pass and depth fail.
Draw front sides, incrementing both with depth and doing nothing with depth
fail.

It is then obvious that they partially cancel each out and can be combined
into:

Draw back sides, doing nothing with depth pass and incrementing with depth
fail.
Draw front sides, doing nothing with depth pass and decrementing with depth
fail.

I was shocked. I went from feeling pretty clever with my unbalanced
preloading algorithm (which I would only apply on surfaces that were likely
to intersect the view plane) to just feeling dumb that I had never seen the
trivial solution before. Thinking about operating on depth test fails is a
bit non-intuitive, but if you work it through a couple times, what is going
on makes pretty good sense.

Shadows done this way have none of the "fragile" feel that geometric
algorithms tend to give. You can use them for major occluders in the world
and noclip fly right through them without any problems at all.

Stencil shadows still aren't cheap by any means. It can cost 3x the
triangle count of the source model (although <2x with some optimizations is
reasonable) per shadowing light, and it can have pathological fill rate
utilization in some cases, like a light shining out horizontally through a
jail cell door. Still, they are quick operations even if there are a lot
of them. The vertexes are just bare xyz points without texcoords or color,
and the fill rate is only to the depth/stencil buffer.

There are lots of subtleties to actually using this, like making sure your
shadow volumes are capped on both ends if they need to be (you can often
optimize away the caps based on culling information), making sure that none
of the shadow volumes get clipped off by your far clipping plane (which
would unbalance the count), and all the normal picky silhouette
optimization issues.

Depth buffer based shadows still sound like they have a lot of advantages:

Not much in the way of coding subtleties required.

The performance is more level (fixed fill rate overhead) and theoretically
somewhat faster (only one extra drawing of the surface into the shadow
buffer) in most cases.

They avoid the silhouette finding work that still needs to be done with the
shadow volumes (a per-face dot product and some copying), and don't require
any connectivity information.

Unfortunately, the quality just isn't good enough unless you use extremely
high resolution shadow maps (or possibly many offset passes with a lower
resolution map, although the bias issues become complex), and you need to
tweak the biases and ranges in many scenes. For comparison, Pixar will
commonly use 2k or 4k shadow maps, focused in on a very narrow field of
view (they assume projections outside the map are NOT in shadow, which
works for movie sets but not for architectural walkthroughs), along with 16
jittered samples of the shadow map for each pixel and occasional hand
tweaking of the bias.

I still want to research the options for cropping and skewing shadow depth
buffer projection planes, but I am now positive that the stencil shadow
architecture works out.


John Carmack
 
arjan de lumens said:
The way I heard the story about the RAMBUS patents was something like this: First, RAMBUS filed some patent applications, around 1990 or so. Then, a couple of years later, the standards body JEDEC started standardization work on SDRAM. RAMBUS participated in this work without disclosing their patent applications to the JEDEC working group, and for some time kept adding to their patent applications ideas that were discussed at JEDEC, many of which ended up in the final SDRAM standard. Then, several years later when the patents finally passed, they started suing everybody who made SDRAMs for infringement on these patents. IIRC, many of these suits are still going on.

If I have gotten this story wrong or omitted important pieces, please correct me.

This is one version of the story... The version of the story that the DRAM makers put out to the press.

The other side of the story is that all the DRAM makers knew that Rambus had patents filed on the various technologies. They knew this because Rambus had NDA with almost all of them to discuss licensing of Rambus technology.

In addition, Rambus was invited/encouraged to join Jedec.

And three, it has already been looked at and thrown out.

As I said earlier, the Rambus/DRAM maker cases are simple good guy/bad guy stories. Much more shades of gray. With a lot of psuedo legal issues on both sides (there is somewhat credible evidence of collution between the DRAM makers to harm Rambus, both before, during, and after they were part of Jedec).

Aaron Spink
speaking for myself inc.
 
Chalnoth said:
This is just about what I heard. This makes these patents invalid (or at least unenforceable) because Dell tried pretty much the same thing some years earlier, and got it thrown out in court. RAMBUS, along with all other members of JEDEC, signed an agreement to disclose all of their relevant patents. They didn't, so they should forfeit.

The Dell situation is fairly different, not the lease because the standards orginization actually had a patent policy and people actually followed it. The evidence points to JEDEC not really having a patent policy and pretty much no one paying attention to it. In addition, the JEDEC policy only covered issued patents, and not filed but no yet issued patents.

Aaron Spink
speaking for myself inc.
 
DemoCoder said:
Nope, math can be patented. See RSA patent, which is essentially a patent of Euler's totient function and discoveries in number theory.

and of course the funny bit about the RSA maths is that some bloke working for gchq in the uk invented it in the 70's.. but since it was all secret work then he just gets some personal kudos . ..
 
DemoCoder said:
Nope, math can be patented. See RSA patent, which is essentially a patent of Euler's totient function and discoveries in number theory.
NO! It's not a patent on mathematics BUT a clever and novel use of maths to produce a public/private key encryption system.
 
DemoCoder said:
Nope, RSA pretty much boxed off the entire idea of public key encryption.
That would not be possible. The concept of a Public key system was described prior to anyone (GCHQ possibly excluded) coming up with a working system.

I think that the company, RSA, might have also owned the Diffie-Hellman patent which might be why they had the market tied up.
 
BRiT said:
In my expert opinion, as a software architect who's been involved in company mandated efforts to obtain software patents, software patents suck. I do not know any engineers who think that software patents are or should be valid.

NON TRIVIAL ones should be valid.

Anyway, how can you tell if "X", a patented idea, is actually being done in custom hardware or is actually running in an embedded cpu?
 
Simon F said:
DemoCoder said:
Nope, RSA pretty much boxed off the entire idea of public key encryption.
That would not be possible. The concept of a Public key system was described prior to anyone (GCHQ possibly excluded) coming up with a working system.

I think that the company, RSA, might have also owned the Diffie-Hellman patent which might be why they had the market tied up.

info . .
http://www.wordiq.com/definition/Asymmetric_key_algorithm

simon, dont you actually have to 'prove' a patent works ? IE not just say "preferred embodiment" , actually have the thing working in a real enviroment ? i'm just thinking that did creative have to show the algorithm was useful in an actual piece of software rather than just in theory? from quick checks, it seems you have to do more than is in the patent in order to actually use the idea,, which i thought would mean the patent was moot ? [ ie , most articles talk about extra steps]
-dave-
 
davefb said:
They ordered that a bit strangely. It's better worded in "Applied Cryptography":
The concept of public-key... was invented by Whitfield Diffie and Martin Hellman, and independently by Ralph Merkle"
.
It further says that it was first presented in 1976.

simon, dont you actually have to 'prove' a patent works ? IE not just say "preferred embodiment" , actually have the thing working in a real enviroment ?
That might be useful in the US when perhaps you have to prove when you invented something, but I don't believe it's essential. It can take time to build something and not being able to protect it from the time you invent it could be really bad for the inventor. Besides, it'd be stupid to patent something that didn't work :)
 
I'll ask a stupid question and risk wearing the dunce hat for awhile, but how does Creative's patent affect nVidia's UltraShadow technique? My logic follows that if Doom3 is using patented Creative technology, and nVidia created UltraShow primarily with Doom3 shadows in mind, then maybe there's a overlap there somewhere?
 
Ratchet said:
I'll ask a stupid question and risk wearing the dunce hat for awhile, but how does Creative's patent affect nVidia's UltraShadow technique? My logic follows that if Doom3 is using patented Creative technology, and nVidia created UltraShow primarily with Doom3 shadows in mind, then maybe there's a overlap there somewhere?
No overlap.
 
Simon F said:
BRiT said:
In my expert opinion, as a software architect who's been involved in company mandated efforts to obtain software patents, software patents suck. I do not know any engineers who think that software patents are or should be valid.

NON TRIVIAL ones should be valid.

Anyway, how can you tell if "X", a patented idea, is actually being done in custom hardware or is actually running in an embedded cpu?

Simon,
while I agree that we need a system like the patent system, something that doesn't allow for independant invention is just totally flawed in my book.

The copywright system ought to be sufficient for the protection of software.

I'm not even sure that there is a fair workable system.
 
thats what I don't get there is a hundred different ways to write the same algo, how is it possible to patent all types of methods? It shouldn't be. If that was the case, If go and patent my 3d engine no else can make a 3d engine and sell it for a profit.
 
Way back in the day, Atari (the real Atari, not Infogrammes renamed) held a patent on graphics that moved sideways. They got some money out of Nintendo because Super Mario Bros. and about a billion other games used sidescrolling without Atari's permission.
 
Regardless of what you think, PKP, can, and did, assert they they had ownership of public key, even if legally they may have not. I worked on a system which used PKey concepts at the time (not RSA, not DH, not ElGamal or DSA), and we decided to get a license rather than a legal challenge.

Just go search for discussion of PKP and patent concepts, or PGP, prior to the expiration of the RSA/DH/etc patents.

Here's for example a quote from sci.crypt:

Paul Rubin said:
The Diffie-Hellman and Merkle-Hellman(?) patents predated the RSA
patent. PKP claimed at the time that the two patents covered the
concept of public-key encryption. Though many, many people thought
that the claim was legally dubious, nobody actually litigated the
matter to trial while the patents were in force. Most companies felt
it was cheaper to simply pay for licenses, and there were a number of
disputes that ended in confidential settlements. It's rumored that
some larger companies showed willingness to fight rather than pay, and
PKP, fearful of losing in court, simply issued licenses to those
companies at close to zero cost

Much of the patent system relies on fear and cost/benefit (cheaper to sue or license). It's legalized extortion. It doesn't matter if GCHQ or NSA (NSA also claims to have invented it in the early 70s independently) came up with it, since those were more or less kept secret until later.
 
Back
Top