|
DeleD Community Edition Forums
|
View previous topic :: View next topic |
Author |
Message |
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Thu Apr 14, 2005 2:32 pm Post subject: Sphere lighting troubles |
|
|
Hi everyone,
Just thought I would start a thread on this one, as I am spending a rather large amount of time on this particular issue.
For quite some time now I have been struggling solving some theoretical problems lightmapping geospheres and other triangle approximations to curved surfaces. I have got the normal smoothing worked out allright, but I got stuck on the problem of adjacent triangles causing 'false' shadows to occur. Where false is defined as 'shadows that would not have been cast if the shape had exactly matched the one suggested by the smoothed normals':
(for those that miss out on the techtalk, the problem is those spiky shadows)
I even swallowed my pride as a coder and posted a thread on flipcode about this ( http://www.flipcode.com/cgi-bin/fcmsg.cgi?thread_show=25555 ), and the general consensus was that there is no definitive answer to this problem.
So I kept breaking my head: how does Gile[s] (the ultimate reference as far as lightmapping goes, you can't really beat Gile[s] ) do this? And today I found my answer: Gile[s] suffers the same problems. It takes a good eye to spot them in the next picture:
But turning on 'toon rendering' makes things very clear:
So I guess that if even Gile[s] hasn't solved this, chances of finding a simple solution to the problem are rather slim. Now what I really like about the first Gile[s] images is how the artifacts are mostly hidden because of the gradient at the light/shadow edge. I will now work on introducing something similar in the DeleD lightmapper, and see how that works out...
If you are still awake after reading all of this, thanks for bearing with me |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Apr 17, 2005 8:12 pm Post subject: |
|
|
Ok, I pretty much fixed things, I made the dependency on the angle of incidence a lot less crisp (more standard Phong diffuse component compatible), and here is how the sphere looks now:
Much more like Gile[s] does it, much more to my liking, but we should all realize this makes the average scene a tad darker, as the light intensity on faces that are not perpendicular to the lighting now is decreased.
As a fix of the lightmapping behaviour was an urgent request from one of our PRO users, they can now get a pre-beta-preview-version of DeleD PRO 1.2 from DownloadeD. Lite users will have to wait for the next official release (sorry guys, but we simply have no controlled way of distributing DeleD Lite beta's). |
|
Back to top |
|
|
granada Team member
Joined: 07 Aug 2004 Posts: 1955 Location: England
|
Posted: Sun Apr 17, 2005 8:49 pm Post subject: |
|
|
Nice work Paul-Jan
dave _________________ AMD Phenom(tm)IIx6 1090t Processor 3.20 GHS
8.00 GB memory
Windows 7 64 bit
Nvida Geforce GTX 580 |
|
Back to top |
|
|
Nocturn DeleD PRO user
Joined: 08 Aug 2004 Posts: 635
|
Posted: Wed Apr 20, 2005 6:06 am Post subject: |
|
|
yeah! i had some really troubles with sphere-lightning.
ex:
Very great thanks for fixing! |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Wed Apr 20, 2005 6:15 am Post subject: |
|
|
Hey, I like that scene (huge room with floating sphere and light... it's almost the name of a painting ) |
|
Back to top |
|
|
Yokom DeleD PRO user
Joined: 11 Apr 2005 Posts: 22 Location: Dallas TX
|
Posted: Sun Apr 24, 2005 7:03 am Post subject: |
|
|
the way i look at this issue is the shading on the material. If you use what is called "flat" shading then yes you will get this effect. Since the default way to shade an object is with no interpolation and each face is shaded with single color from first vertex in the face
Now with gouraud shading each vertex is linearly interpolated across the face. Better shading on round objects
phong shading I think is the best and most expensive for round objects. defined as
Vertex normals are interpolated across the face, and these are used to determine color at each pixel.
Now im no expert on how to pull off the math for each shader but this is what you are seeing im pretty sure. You are using a basic flat shader so the entire face is shaded with one color.
hope this helps. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Mon Apr 25, 2005 7:33 am Post subject: |
|
|
Yokom, your description of the 3 shading models is mostly correct, but that is not the problem here.
First, about the 3 models you named: besides those 3, there are lots (lots!) more, but those are the three the major 3D API's choose to implement for standard direct dynamic lighting. Those three dynamic models define a specular component as well, which cannot be taken into account by a static lightmapper (by definition). But, more importantly, besides the direct lighting, the lightmapper also has to take occlusion (shadow casting) into account, something not handled by the lighting models you describe.
Now the old 1.1 lightmapper did use flat lighting, for a very solid reason: for any other lighting model, you need per-vertex normal information, and we simply don't have that in DeleD at the moment (introducing it is a pretty big step as vertex-normals (as opposed to face-normals) need user-interaction, they can't be deterministically deduced from your model).
Now for the 1.2 lightmapper, I introduced (lightmapper-only) normal-smoothing (generated by a crease-angle based algorithm), and did normal-interpolation over the face (according to the diffuse component of the Phong model, to be precise). That is what you see on the buggy screenshot (notice the light/shadow edge halfway some of the faces: there is no way you can get that with flat shading ). That is when I started to run into trouble with the occlusion, because the lighting neatly follows the curve suggested by the interpolated normals, while the occlusion follows the exact shape of the model. Hence the popping up of the black faces, if I disabled occlusion (shadows) the lighting would be neatly curved.
However, like I said in the previous posts, I hadn't taken angle-of-incidence into my lighting model (so in fact, I wasn't doing any of the lighting models you named, as they all take angle of incidence into account ). Fixing that fixed my problems.
Long story, I hope I made things a bit more clear. Then again, I shouldn't bother you guys too much with the mathematical background of the lightmapper, as it really is my problem, not yours |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|