Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

About problems with sculpties and light ...

Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
04-12-2009 05:07
Hi all;

I have written a short article about the principles as i understood them. For me it makes pretty much sense, but i still may be wrong or missleading. So please can anybody take a look at the following Blog-entry and verify that it "tells the truth" ?

http://blog.machinimatrix.org/sidenode-on-vertex-lighting-in-sl/

If i am wrong or missleading or i could enhance my description, please tell me, so that i can correct the article.

have fun
Gaia
Coal Porter
Owner CP Motors
Join date: 26 Mar 2008
Posts: 37
04-12-2009 07:09
The final result looks great. What 3d program are you using? Im using wings3d and unable to figure out hot to smooth and collapse the right way. Are there any further details to share?
Ponk Bing
fghfdds
Join date: 19 Mar 2007
Posts: 220
04-12-2009 09:52
Nice work, Gaia. I Haven't bothered looking too far into it as I usually just bake the textures. Nice to know I can get away with being more lazy now :)
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
04-12-2009 12:58
I was honestly under the impression that this was known, it never occurred to me that people wouldn't think of this. Well done, Gaia.

I've been using Blender for a couple of years now, and have over time learned that when using smooth shading, to get a sharp edge (Also when trying to keep models low poly) you often need to double up on the edge loops, or else it would attempt to smooth a supposedly straight section. This also occurred with the SubSurf(ace) modifier, though it could be fixed there with edge creasing, as well.

I've been lazy in doing it, but generally it's always the best idea to do this with sculpties, since Second Life does use shading that's affected by this. Those 'dark edges' you quite often see can be destroyed by just snuggling some edges together, and usually it won't hurt your detail ability at all, since it's a straight edge anyway.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL
Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
04-12-2009 15:19
From: Keira Wells
I was honestly under the impression that this was known, it never occurred to me that people wouldn't think of this.
I think, that many people have come to build in SL, who never ever had anything to do with 3D-content creation before. So i very strongly assume, that this sort of information is NOT known by all builders! This was at least true for me until 2 days ago, when i finally understood, how lighting works. Not that i needed 2 years to learn that, but i never was curious enough before to investigate...

Interestingly my curiousity raised while i was trying to understand why standard prim cubes need 108 Tris where 12 tris would be enough. So after someone mentioned that "vertex lighting would otherwise not work" i needed to understand what that means ;-)

And now here comes my next question ;-) :

After i have understood, how "intensity bleeding" (BTW: is there a technical term available for this effect ?) destroys sculptie surface textures, i really do NOT understand, why this effect does not appear with standard prims... Apparently they do not use double lines of vertices, otherwise we would see that in the Ktri counters ...

So how does lighting work with standard prims then ??? Is it because the sharp edges are known beforehand on the standard-prims and this knowledge could somehow be passed to the renderer ? Or do they simply use another algorythm for the light calculation ?

Anybody can "shed some light" on this please ... ? ;-)
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
04-12-2009 15:31
From: Gaia Clary
I think, that many poeple have come to SL, who never ever had anything to do with 3D-content creation before. So i very strongly assume, that this sort of information is NOT known by all builders! This was at least true for me until 2 days ago, when i finally understood, how lighting works. Not that i needed 2 years to learn that, but i never was curious enough to investigate...

I know there are many new to it.. this just wasn't something that ever occurred to me to tell people, because I just do it so automatically. I've never understood how the lighting _really_ works either, so this was an interesting read ^-^
From: someone
i have understood, how "intensity bleeding" (BTW: is there a technical term available for this effect ?) destroys sculptie surface textures, i really do NOT understand, why this effect does not appear with standard prims... Apparently they do not use double lines of vertices, otherwise we would see that in the Ktri counters ...

So how does lighting work with standard prims then ??? Is it the fact, that the sharp edges are known beforehand on the standard-prims and this knowledge could somehow be passed to the renderer ? Or do they simply use another algorythm for the light calculation ?

Anybody can "shed some light" on this please ... ? ;-)

I would assume it's due to the natural prims being pre-determined. Because of that, they can see edges that are marked sharp, and draw them as such.

Also worth noting, I feel, is that occasionally you'll see a natural prim behaving oddly in lights, showing individual faces lit differently than adjacent ones (Such as a sudden bit of shadow starting halfway down the prim with a solid edge), so it seems possible that some of the natural prims aren't drawn with smooth shading, but rather with solid shading, and that it's just not normally noticable.

Due to sculpties being based off of an image with RGB channels at the moment, it would be hard to define any specific edge as sharp, and it would need another channel, or another data input to do so without revamping it completely.

So, SL simply shades everything smoothly with sculpties, because it's easier to fake a sharp edge than it is to fake smoothing, and because their real value comes into play in organics, where things tend not to be made up of a ton of little triangles.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
04-12-2009 15:39
From: Gaia Clary
If i am wrong or missleading or i could enhance my description, please tell me, so that i can correct the article.


There's another alternative. For two faces, A and B. if A's part of the texture is overlayed with (for example) 25% grey, then A-B will always appear to have a sharp edge as there's always that 25% difference between the faces.

While collapsing faces works at full detail, it can have the side effect of texture jumps at lower detail levels, so fixing it in the texture rather than the model is usually the better option.
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
04-12-2009 15:46
Well a video cards treats a sculpt as one surface. where a cube has 6 faces and each is treated as a separate group. IN 3DsMax these are called "smoothing groups". Also a video cards will buffer a vertex if the same facet shares the same vertex in the same smoothing group. So a box which has 2 faces which share the same edge you would think there are only 4 vertex but the video sees 8 and treat the two faces separately. So at first thought you would think a box is 56 verts but it actually 96 (each side being 16x16 verts) when a video card processes it. Now if all the verts belong to the same smoothing group for a box you would get the light bleeding effect you see on a sculpt. And the box would only be 56 vert vs the 96.

Hope this brings some more insight into vertex light bleeding.
Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
04-12-2009 16:13
From: Domino Marama
There's another alternative. For two faces, A and B. if A's part of the texture is overlayed with (for example) 25% grey, then A-B will always appear to have a sharp edge as there's always that 25% difference between the faces.

While collapsing faces works at full detail, it can have the side effect of texture jumps at lower detail levels, so fixing it in the texture rather than the model is usually the better option.
While i agree with you in general, that it makes more sense to take care on the textures, i still think, people would want to get that corrected on the model. Look at the following image as an example:



I have used an extreme lighting preset (Sailor's delight). So although i have used a texture, which sharpens the edges, the light bleeding still occurs and makes the surface redish on the wrong places (look at the sculptie at the bottom of the image). While the shadowing on the corrected model behaves exactly as expected (the one at the top of the image).

conclusions ...

- If you need full control of the objects lighting behaviour, use duplicate lines.

- if you can live with static shadows on the texture, make your object fullbright and create the appropriate texture.

- If you want to texturize, but do not want fullbright, you must live with the bleeding effect, which still occurs, but it can be partially hidden by using your own shadowing on the texture. This can be artistically interesting but it does not make up for a "realistic" light/shadows effect.

- At the end i can see, that you even could start playing with the bleeding effect and let it work for you instead of against you ;-)

And of course you could use all techniques at the same time on the same sculptie at different regions ;-) At the end it depends on the effect you want to achieve which technique you will use. But i guess that it is good to know about the alternatives ;-)

So dear reader... Please consider these conclusions as possibilities, not as advices!!!

Have fun
Gaia
Gaia Clary
mesh weaver
Join date: 30 May 2007
Posts: 884
04-12-2009 16:16
From: Gearsawe Stonecutter
Well a video cards treats a sculpt as one surface. where a cube has 6 faces and each is treated as a separate group.
That makes pretty much sense at the end ;-)
Drongle McMahon
Older than he looks
Join date: 22 Jun 2007
Posts: 494
04-12-2009 16:35
This is how I (unexpertly) understand it....

Sculpties, designed for rounded shapes, have just one continuous face. Within a face, the shading is determined by the normals, directions perpendicular to the surface. I think the SL source code calculates normals for each vertex from the average of the normals of the four triangles that join at the vertex. When these are passed to opengl, it interpolates the shading across the surface of each triangle to give a smooth transition between the three vertex normals (Gouraud shading). Thus the lighting tries to mimic a smooth curve across the boundaries of the triangles. This is what is needed for the smooth shapes sculpties were designed for, and for each separate surface of the normal prims.

Why collapsing the vertices along the edge makes it sharp is not so clear to me, but I imagine that the zero-area triangles that result are simply ignored for the averaging that produces the vertex normals, so that they end up with the normal of the triangles that are in the flat surface. Happening either side of the collapsed edge, this looks just like a sharp edge.

This is pretty much equivalent to your explanation if you understand the 'strength' of a vertex as the contribution of it's normal to the shading.

As Domino says, the collapsed edge does lead to texture artefacts on LOD switches, which can be quite nasty, depending on the texture. Those of us who like to make angular sculpties would love to see a parameter that specified planar shading, where the triangle normals are simply applied to the whole triangle, instead of Gouraud shading. I can even imagine an alpha plane (yes, yet another) being used to specify the shading vertex-by-vertex, or to divide the surface into separately shaded faces.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-12-2009 16:50
Interesting. This explains why the lighting on the edges of steep verticals on the ground mesh are so messed up. Pity you can't directly edit the ground mesh.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
04-12-2009 18:21
I think collapsing for sharp edges works because vertices that occupy the same space get 'normal gimbal lock'. I'm not sure what to call it exactly.

Let's say that you have a triangle and all 3 verts have unique space. The normals are apparent and easy to calculate. Once two of the verts are in the same space, the math itself collapses and the normals go poof. Consider, what are the normals of a 2d straight line in 3d space?