Jump to content

Part not lighting correctly


Recommended Posts

Afternoon all,

I'm having a small issue with a part I've made - it doesn't receive lighting correctly. I've screenied it below. It includes just the diffuse texture as I was trying to convince myself it was my noob-ish normal maps causing the problem,but evidently not.

rwRwQV1l.jpg

The tank immediately adjacent to the light receives no light at all, and the tank that does receive light acts as if it is 'bulging' at the middle. The visual and collision mesh are completely flat faces, and initially just 1 face per side. As a bonus problem, it appears that lights can also shine through the tank.

I have no idea what could cause this so my troubleshooting approach is somewhat 'tinker til it works'. Well, tinkering hasn't worked (unsurprisingly). Here's what I've tried:-

- Setting shader to diffuse only

- Checked face and vertex normals in Blender. All fine - and I that I mean they all point outwards, which is what I assume they should do?

- Subdivided cylinder face of visual and collision mesh from 1 face per side to 2 (I essentially did a loop cut on the x-axis)

- Re-made the collision and visual meshes

- Various experimentation with the mesh render object component in Unity

- I can also see this effect occur after importing the mesh into Unity. If I place a light close to the tank only the top/bottom half of the lit side receives lighting depending on light orientation. This leads me to believe I've does something fundamentally wrong in Blender, but I have no idea how I could have messed up a 32-sided cylinder, or more to the point - how to stop it happening with anything else that I make.

I'm at a loss of what to try next, so any help would be appreciated. Thanks!

Link to comment
Share on other sites

I think I read somewhere that KSP only supports meshes made of triangles. So try making them triangles (select them and press f or alt+f, I can't remember). In case they are already triangles, I don't know what to do.

Link to comment
Share on other sites

I have exported meshes from Blender without converting quads to tris and they've shown up/been lighted just fine.

I honestly have no idea about this issue. The only thing that comes to mind is vertex normals, but you say you checked that.

How are you exporting from Blender?

Link to comment
Share on other sites

The Quad -> Triangle thing was a good call. Just tested it, but as Torminator says, it doesn't seem to affect this.

In the screenshot below I've put a directional light in which better shows the 'bulging' effect. It's slightly odd seeing a flat object illuminate as you'd expect a curved surface or torus to behave!

v1PJrsll.png

I'm not 'exporting' as such - I'm dragging and dropping the .blend file from Explorer into Unity. Should I be using a different filetype?

EDIT: Apparently I am an idiot and should be exporting. I tried exporting as a .dae then dragging into Unity. The bulging effect is fixed but it still permits light to shine through it.

jxdipSal.pngLptuIm5l.png

I thought both problems would be linked but I guess not. 1 problem down, 1 to go!

Edited by Milkshakefiend
Link to comment
Share on other sites

Have you tried a simple Edge Split modifier, letting the engine automatically figure your surface cuts?

I hadn't. I've now read about it, and I can see that some of my faces are now split from others, but I don't really get the purpose of it or why I would use it. You are dealing with an absolutely noob here, so I apologise for my complete lack of understanding!

Link to comment
Share on other sites

Edge split automatically does what you were trying to do by hand I think, separate each face where their edge angle is greater than a certain amount (which you can adjust before applying) so that lighting is applied to them on an individual basis. In blender, most models need an edge split to appear correctly in Unity/KSPs shading engine.

When you add the modifier, you'll see the angle setting and 2 check boxes.

You can uncheck the angle split mode if you only want it to edge cut on edges you mark as sharp (by using "edge selection mode and Mesh -> Edges -> Mark Sharp in the Edit)mode menu)

lUDlw2b.png

Link to comment
Share on other sites

I'll add that it has additional value if you're using smooth shading (aka, blending vertex normals to reduce the appearance of hard edges), since it allows you to keep certain angles "sharp" while smoothing others, as Blender will not smooth split edges.

Link to comment
Share on other sites

yeah its all related, they're also referred to as shading groups in Max I think. its basically how you determine which set of faces is treated as one unit to be shaded together. Without an edge split, Blender usually exports things as a single group with smoothing on, which is how you get those silly cylinders appearing to be lit from above improperly.

Link to comment
Share on other sites

Aha! This is very useful! Thanks for the explanation guys. I've actually completely re-done the mesh and used an edge-split. I now have quadrants instead of a single unwrapped cylinder face, but lights still shine through the object in Unity. I haven't exported to KSP for this mesh yet, so I'll give that a try in a bit and get back.

Link to comment
Share on other sites

Et voila. I completely stole the NovaPunch art style, but I figure it's probably okay if it's only for my use. All of my rockets obey the Rule of Cool first and foremost, so using an unmatching texture was just unthinkable. That and the orange texture I made earlier looked like someone had filled a sandblaster full of Tang and had at it.

mR3TPhbl.png

After some testing I have found that stock parts also allow lights to shine through them. I'm not really sure how I didn't notice this before, but I shall quell my lighting pedantry.

I also see a lot of meshes in addons that have blatant over-smoothing. It's what causes that strange, putty-like look.

Any indications of that in mine? Since being made aware of that edge split and crease tools I've found the subsurf modifier is much more controllable and I use it extensively on my high-poly models for normal mapping.

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...