Jump to content

How To: Fix Extruded/Cut Cylinder/Cone Shading in Blender (Command pods, etc)


Recommended Posts

Okay, so, I've spent like the last 6 months being constantly aggravated over the terrible shading artifacts brought onto smooth-shaded low-poly shapes with any kind of non-exact mesh-flow (extrusions, cuts, whatever).  Over the past day or two, I have discovered a newer feature added to blender in the last few months, the 'Transfer Data' modifier.

Now, you might be thinking... how does transferring data between objects help solve normal shading?  Yah, I thought that too.  But when you realize that edge/face/vertex (shading) normal data is merely another pre-computed part of the model, it makes sense.  Integral to this feature actually being useful though, is blenders capability to not only transfer the normals from one object to another, but also to interpolate the vertex and edge normals properly from a vastly different donor mesh.

So, without wasting too much time on the 'why' -- here is the 'how'.

1. Get yourself a mesh with messed up shading due to edge flow.  Generally easy enough to find these (make a conical command pod and cut a window in it.. instant shading artifacts).

2. Split off the mesh that needs to be 'corrected'.  So far I have only determined how to do this technique for cylinders and cones, but it might be applicable to other shapes and layouts with some adaptation.

3. Create an un-distorted 'donor' mesh that will supply your clean normals.  This mesh should match the to-be-fixed mesh as close as possible, and should be a multiple of the face count of the to-be-fixed mesh.  For normal 24-side KSP cylinders, I use a 384-side cylinder as the normal donor.  Apply smooth shading to this donor mesh.  Apply Auto-smoothing if needed (you want proper normals on your donor mesh).  Delete any un-needed faces (e.g. top/bottom for most cylinders and cones), as these -may- interfere with the process (unknown, did not test).

4.  Select your to-be-fixed mesh, enable 'Auto-Smoothing'.

5.  Add the 'Data Transfer' modifier to your to-be-fixed mesh.

6.  Set data transfer modifier to 'Nearest Corner and best matching Face Normal' mode, and click the 'custom normals' button that appears below the checkbox.  Enter your donor object name in the 'Source Object' box.

7. Apply the modifier, and your normal are fixed!  You can merge this mesh back into the base mesh it came from -- just do not alter edge-sharpness modifiers or 'recalc normals', or you will need to re-fix your shading again.  Preliminary tests have shown that it exports through .fbx properly, and handles the fixed normal/shading once exported through Unity into KSP.

8.  Unkown if this can be applied to inside-facing normals for stuff like IVAs, but it seems likely (as long as source and donor mesh normals are facing the same way, it -should- logically work; but blender is not always logical)

 

 

Hope someone finds this information helpful -- I've been pretty excited about it after 6+ months of trying to find a solution (finally, proper shaded command pods!).

 

Edited by Shadowmage
Link to comment
Share on other sites

Nice! I haven't used Blender in a while but I saw some info on people using the Data Transfer modifier over on the Polycount forums.

I've been experimenting with Face Weighted Vertex normals in MODO after reading some documentation online through the polycount forums and our very own bac9.

Link to comment
Share on other sites

This is a great hint..  but I just gave it a shot and wasn't in love with the results?  With a simple hole cut like your example, it did in fact clean the mesh up a lot!  But when I went to extrude that edge to turn the simple hole into a window, for example... things to weird

.  If I extruded and made the inset face before doing the data transfer, there was no way to get sharp edges around the window...  it made the window into a sort of organically sunk in abscess in the cylinder with lumpy and unclear edges, even when I tried marking them sharp or applying an edge split.  

if I extruded AFTER applying the data transfer, the shading artifacts came back worse than ever?  

Did you have any luck taking a next step on the demo mesh you're showing it and putting additional geometry attached to that hole?

My go-to 'sometimes fix' for the normal artifacting problem has been marking the cut out edges as 'sharp' and applying an edge split, by the way, but those results aren't perfect!  This looks much better, if I can get it to work!  

 

EDIT:  

I tried making IDENTICAL extrudes to both models before applying the data transfer modifier, and it worked beautifully!  It's a bit of a pain to work on a high and low poly model at the same time and have to do identical operations, but if you think ahead and start with all of the required inset cuts...  it could be awesome!

Edited by artwhaley
Link to comment
Share on other sites

Another option might be to make the exterior (that's being adjusted with the data transfer) its own mesh object, and make the windows with a new mesh object. It adds a draw call, but there shouldn't be any cross-talk. This also has the virtue of allowing you to make the window use its own smaller texture, so that if you want to use an emissive to light it up, the emissive map can be pretty small.

 

Link to comment
Share on other sites

37 minutes ago, hoojiwana said:

How well does this transfer in-game? Does the mu converter in Part Tools strip this data or does it show up alright?

@Beale made a thread recently on a similar topic, there are some other options available there for those interested.

Yes, this is one of the biggest pains I have ever come across while modelling. (And it still defeats me).

I think the best solution I saw was the manual face-normal control.

Link to comment
Share on other sites

1 hour ago, hoojiwana said:

How well does this transfer in-game? Does the mu converter in Part Tools strip this data or does it show up alright?

@Beale made a thread recently on a similar topic, there are some other options available there for those interested.

From my brief experiments, it transfers 100% through fbx, into unity, and into KSP, without error.  As long as it looks right in blender when you export, it -should- be right in Unity (as long as you have Unity set for 'Import Normals = true').

 

Edit: Was looking for that thread, but did not spot it in the top 2-3 pages of threads, so ended up starting a new one.  Had not seen it since it was a 'new' thread with only a few posts in it... had I been able to find it I probably would not have posted at all, as it appears that the 'Data Transfer' modifier was already known and posted there.  Sorry for the semi-duplicate threads...

 

29 minutes ago, Beale said:

Yes, this is one of the biggest pains I have ever come across while modelling. (And it still defeats me).

I think the best solution I saw was the manual face-normal control.

Would love that option, sadly, it is not available in Blender (that I'm aware of), and I have not $$$ for 3dsMax.

There is a plugin for blender that -kind-of- allows such manual manipulation (Blend4Web), but was... painful to work with, and inconsistent (any changes to a mesh after fixing the normals would revert -all- of the work), nor did it export properly into Unity/KSP.

Not to mention that manually fixing every vertex normal for a 1000+ vertex mesh is... ughh.. I would die of boredom before I got it done :)

Edited by Shadowmage
Link to comment
Share on other sites

4 hours ago, artwhaley said:

This is a great hint..  but I just gave it a shot and wasn't in love with the results?  With a simple hole cut like your example, it did in fact clean the mesh up a lot!  But when I went to extrude that edge to turn the simple hole into a window, for example... things to weird

.  If I extruded and made the inset face before doing the data transfer, there was no way to get sharp edges around the window...  it made the window into a sort of organically sunk in abscess in the cylinder with lumpy and unclear edges, even when I tried marking them sharp or applying an edge split.  

if I extruded AFTER applying the data transfer, the shading artifacts came back worse than ever?  

Did you have any luck taking a next step on the demo mesh you're showing it and putting additional geometry attached to that hole?

My go-to 'sometimes fix' for the normal artifacting problem has been marking the cut out edges as 'sharp' and applying an edge split, by the way, but those results aren't perfect!  This looks much better, if I can get it to work!  

 

EDIT:  

I tried making IDENTICAL extrudes to both models before applying the data transfer modifier, and it worked beautifully!  It's a bit of a pain to work on a high and low poly model at the same time and have to do identical operations, but if you think ahead and start with all of the required inset cuts...  it could be awesome!

 

Yah, you have to make it so that the normal-data-transfer is the -last- thing you do to the mesh.  If you do any more cuts, extrusions, or even just move a single vert around, it will likely revert to 'auto calculated normals', and you'll need to re-fix the shading.  So model + cut first, fix normals last.  Might require breaking your base mesh into separate meshes, one for each bit that needs normals fixed, and re-joining them once it is all corrected.

But, for my test-case (an apollo-styled CM), I was able to pull the cylinder and hatch sides out of the master mesh, move them to a new layer, fix their shading, and re-join them into the master mesh without problem.  It then exported to fbx, into and out of unity, and into KSP with nice smooth-shiny, non-artifacty shading.

Most notable is the shading on the hatch, rather the lack of artifacts in the 'fixed' hatch shading. (as I -just- learned this technique yesterday, but did the initial model a few weeks back, I had already mangled the edge-flow of the rest of the mesh to minimize artifacts, so the hatch is the most visible fixed area).

Pre-fix:

KkuOhJv.png

 

Post-fix

kcfPwzn.png

 

For me, it is going into my workfow right before the AO bake step, where I already have the model split into various meshes for clean bakes, but where I know there are no more geometry changes to be done.

It is nowhere near a perfect solution, but I was pretty excited to be able to cut some windows in a command pod without it looking like mud :) (and combined with the upcoming 1.1 reflective shaders, I'll likely put it to good use on the rest of the pod as well).

 

Edit:  I will revise the 'tutorial' with a bit more information and pictures regarding how to use it with an actual model.  I'll be doing another CM soon, so can hopefully use a real example for it.  And now that I know what it is all about, I can likely use it to cheat some better looking normals on a lot of other low-poly details as well -- will see about adding some examples for that stuff too as I figure it out (piping, manifolds, I'm sure I'll find more places).

Edited by Shadowmage
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...