Jump to content

Undesired lighting effects


Recommended Posts

For some reason, I have two models that are being bisected horizontally by shadow in certain orientations:

qYTiGVY.png

s8O0Elb.png

But if I turn them on their side, the shading is uniformly shadowed:

MVE2Bhi.pngpv5yhrl.png

Any idea what bizarro-world magic is doing this? Do I need to use a lightmap or something? I've not encountered this on any of the larger stuff I have (and I even made one of them from scratch):

7gOOgMl.png

Link to comment
Share on other sites

Looks like mesh smoothing issues.

Are you using Blender?

I am indeed.

edit: And I notice in the heatsink picture, it appears to be happening to the edges of the mounting plates, but that's actually a black line in the texture.

Link to comment
Share on other sites

Since you're using Blender:

- Enable smoothing for your mesh(es)

- Add (but do NOT apply) a Edge Split modifier, and set the angle to 30~45 degrees

This will make the sides of the cylinder smooth, while the ends of the cylinder will remain crisp.

Also, by not actually applying the Edge Split modifier, you allow the cylinder to be edited normally (Applying Edge Split for realz literally doubles the number of vertices between edges, which makes life harder for you later no when you try to resize/modify the cylinder)

Link to comment
Share on other sites

Since you're using Blender:

- Enable smoothing for your mesh(es)

- Add (but do NOT apply) a Edge Split modifier, and set the angle to 30~45 degrees

This will make the sides of the cylinder smooth, while the ends of the cylinder will remain crisp.

Also, by not actually applying the Edge Split modifier, you allow the cylinder to be edited normally (Applying Edge Split for realz literally doubles the number of vertices between edges, which makes life harder for you later no when you try to resize/modify the cylinder)

Excellent info, thanks!

Link to comment
Share on other sites

Also, by not actually applying the Edge Split modifier, you allow the cylinder to be edited normally (Applying Edge Split for realz literally doubles the number of vertices between edges, which makes life harder for you later no when you try to resize/modify the cylinder)

I never knew you didn't have to apply the modifier to get it to stick. One way to deal with modifying it later is just to remove doubles, then re apply the edge split modifier afterwards.

Link to comment
Share on other sites

Also worth noting is that even with a sensible edge-split angle, Blender sometimes still gets confused with normals when you have a truly "manifold" mesh. I found this out the hard way. Cylinders with rims and/or protrusions (inward or outward) can mess with it. So I'll usually take the outer, truly cylindrical surfaces, and hit "Y" to detach them as their own islands. Just be careful not to "remove doubles" on it again later. If you're editing in "solid" viewport shading, you may see the shading change as soon as you hit "Y". If so, it was altering your normals, and now it will look better.

Until I figured this out, some of my tanks had impossible shadow orientations:

cMyxYNd.png

I never knew you didn't have to apply the modifier to get it to stick. One way to deal with modifying it later is just to remove doubles, then re apply the edge split modifier afterwards.

Yep, what I usually do is export as Collada/DAE for importing to Unity, and make sure the "apply modifiers" checkbox is checked. That way it gets applied during the export.

Edited by NecroBones
Link to comment
Share on other sites

I never knew you didn't have to apply the modifier to get it to stick. One way to deal with modifying it later is just to remove doubles, then re apply the edge split modifier afterwards.
Yep, what I usually do is export as Collada/DAE for importing to Unity, and make sure the "apply modifiers" checkbox is checked. That way it gets applied during the export.

Lots of Blender modifiers can simply be present in the .blend file, not permanently applied to their respective meshes, and still propagate to Unity.

I'm also using Blender prefabs for Unity, so Unity automatically accepts .blend files without the need for intermediate file formats like Collada/DAE - I can save my Blender file, and Unity will automatically reload the model in the 3D view / GameObject hierarchy.

Link to comment
Share on other sites

This edge split thing has made every model look so much better. Thanks again sumghai.

Also worth noting is that even with a sensible edge-split angle, Blender sometimes still gets confused with normals when you have a truly "manifold" mesh. I found this out the hard way. Cylinders with rims and/or protrusions (inward or outward) can mess with it. So I'll usually take the outer, truly cylindrical surfaces, and hit "Y" to detach them as their own islands. Just be careful not to "remove doubles" on it again later. If you're editing in "solid" viewport shading, you may see the shading change as soon as you hit "Y". If so, it was altering your normals, and now it will look better.

Until I figured this out, some of my tanks had impossible shadow orientations:

http://i.imgur.com/cMyxYNd.png

Blender/Unity are now conspiring to raise my blood pressure by shading along the triangle edges instead of the original poly edges on some of my stuff. I've tried splitting them into islands and it fixes the vast majority of it, but there are still some stubborn faces.

axMrP9i.png

Edited by Randazzo
Link to comment
Share on other sites

This edge split thing has made every model look so much better. Thanks again sumghai.

Blender/Unity are now conspiring to raise my blood pressure by shading along the triangle edges instead of the original poly edges on some of my stuff. I've tried splitting them into islands and it fixes the vast majority of it, but there are still some stubborn faces.

http://i.imgur.com/axMrP9i.png

Ugh, that's a pain. Where do you have the separations? I probably would make those outer rims separate islands from the large flat faces, if you haven't tried that yet. Those diagonal shadows worry me. Are there any diagonal edges there? (technically there probably would be edges since quads get divided into triangles anyway)

Link to comment
Share on other sites

Ugh, that's a pain. Where do you have the separations? I probably would make those outer rims separate islands from the large flat faces, if you haven't tried that yet. Those diagonal shadows worry me. Are there any diagonal edges there? (technically there probably would be edges since quads get divided into triangles anyway)

I did make those outer edges islands, and it corrected it on the faces above and below the center face. I tried then making the center face an island of it's own, and it had no effect.

It doesn't actually show up on my "working model", but when I save and import to Unity it's there. I know either Blender or Unity turns everything into triangles, and for some reason it's shading along the triangle edge, even though it's flat.

Link to comment
Share on other sites

I did make those outer edges islands, and it corrected it on the faces above and below the center face. I tried then making the center face an island of it's own, and it had no effect.

I think I've had a similar issue before. The face count for the curved section might be too low to look correct with the smoothing(looks like those have 3 faces). Try experimenting making those radiator fins to have 4 or 5 faces for the curved outer edge.

otherwise, another thought is that the smoothing is showing a diagonal line on the middle surface. you might need to select those 2 triangle faces and remove any doubles, as it could be considering that diagonal line as a sharp.

Link to comment
Share on other sites

I think I've had a similar issue before. The face count for the curved section might be too low to look correct with the smoothing(looks like those have 3 faces). Try experimenting making those radiator fins to have 4 or 5 faces for the curved outer edge.

otherwise, another thought is that the smoothing is showing a diagonal line on the middle surface. you might need to select those 2 triangle faces and remove any doubles, as it could be considering that diagonal line as a sharp.

Yeah, I was going to say, within that island you might want to remove doubles. I had some anomalous shading once that was caused by an extra set of polygons that I didn't realize was present. That's partly why I was asking if there was an actual edge there, because it might be two edges sharing the same space, or even a full-blown zero-sized quad hiding in there.

Sometimes I'lll also go and use the knife tool to split quads into triangles myself, so I can control where that division happens, rather than relying on Blender to choose for me. This is more useful in complex curvatures though, rather than a strip that's only curved in one direction.

Link to comment
Share on other sites

No luck, unfortunately. Nothing gets rid of the stupid triangle shading. I removed the faces, created new ones, remapped them, triangulated them myself, split them as islands, removed doubles, set the outer edges as sharp and smoothed the inner edges, tried the inverse, it always comes out the same once imported to Unity.

XoIB1qp.png

I guess I'm going to have to abandon this model and go back to the flat edges.

Link to comment
Share on other sites

Did you try my suggestion of increasing the curved surface from three to four or five sides?

I did. Every extra face had the same problems.

And whatever this is, it's not happening in Blender, even when I triangulate the faces myself. The shading occurs in a straight vertical line UNTIL I open the blend file in Unity. Then it gets broken, every time.

Edited by Randazzo
Link to comment
Share on other sites

Maybe you're unity install is borked? Or you need to delete the object fron the unity scene and re- drag it in?

I tried both a new scene and a new project. Same results. I don't think Unity is broken, it handles everything else fine, It has to be something I have done (or not done), I just have no idea what.

Link to comment
Share on other sites

Have you tried importing in a different file format? I usually convert to Collada/DAE (for non-animated parts) and import those, and if I see a problem, it's always been on the Blender side. The imports themselves have always gone smoothly. If it's an animated part, or overly complex, I've found Autodesk/FBX to be more reliable. DAE files seem to either work great or are totally borked, with no middle ground.

When exporting, you just have to remember to click "Apply Modifiers". Also, either click "Selection Only" and select all of your mesh objects, or otherwise turn off the camera, lamp, etc.

Edited by NecroBones
Link to comment
Share on other sites

Have you tried importing in a different file format? I usually convert to Collada/DAE (for non-animated parts) and import those, and if I see a problem, it's always been on the Blender side. The imports themselves have always gone smoothly. If it's an animated part, or overly complex, I've found Autodesk/FBX to be more reliable. DAE files seem to either work great or are totally borked, with no middle ground.

When exporting, you just have to remember to click "Apply Modifiers". Also, either click "Selection Only" and select all of your mesh objects, or otherwise turn off the camera, lamp, etc.

I have not tried this, I might give it a go before throwing it out the window.

Link to comment
Share on other sites

Finally got it! Exporting in different formats didn't resolve it, so I was about ready to give it up, but I decided to recreate the faces one more time. Apparently, they needed to be created in the proper order. I was just creating each face horizontally across from one edge to the other, this time I did that only with the center face and then linked the center faces edges to the upper and lower edges, and here we have it. I think the shading is backwards, actually, since the parts under the mounting plate are bright, but at this point, I'll take it.

xorpmTFh.png

Link to comment
Share on other sites

Finally got it! Exporting in different formats didn't resolve it, so I was about ready to give it up, but I decided to recreate the faces one more time. Apparently, they needed to be created in the proper order. I was just creating each face horizontally across from one edge to the other, this time I did that only with the center face and then linked the center faces edges to the upper and lower edges, and here we have it. I think the shading is backwards, actually, since the parts under the mounting plate are bright, but at this point, I'll take it.

http://i.imgur.com/xorpmTFh.png

Great! Yeah, I do most of my modeling with primitives and extrusions, rather than fills, but theoretically it shouldn't matter. Just glad it's working for you now. :)

As to how it looks in the VAB-- The VAB uses different lighting rules than out in the world. Things look VERY bright on their top surfaces there. You'll also want to put it out on the pad with the sun at about 45 degrees, and see how it looks there too.

Often I'll mitigate that sort of thing by adding some "fake" interactive shading. That is, I'll texture in some shadows, and make recessed parts a lot darker than exposed areas. I figured out the value of this with my first complex part that had concave areas, which was my Quad-Nuke:

VAB view:

Ze4S14w.jpg

Texture:

rh9Je77.jpg

If you look at the texture, you'll see that the upper-right area, the main cylinder for the engine, is heavily shaded toward the sides, which is the rear of it facing inward on the engine. Also, on the left, the copper-colored rectangle has a big shadow splotch where it just about touches the "ceiling" in the engine assembly. In the VAB, it looks pretty good and you can't tell that the texture is helping the shadowing.

Link to comment
Share on other sites

NecroBones, so you are manually create your own ambient occlusion then instead of using a program to make the shading?

Yup, I just add some gradients in the texture. A lot of the stock parts are painted that way too (and they look hand-done to me).

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...