A sneaky workaround for custom vertex normals

Post any tutorial and tools you might find it useful for other creators.
Post Reply
User avatar
Smarty
Beta tester
Posts: 2155
Joined: 30 Jun 2015 01:56
Location: Ontario, Canada
Contact:

A sneaky workaround for custom vertex normals

#1 Post by Smarty » 31 Jul 2016 05:23

Anyone who's tried using custom split normals (or forgot to delete them from imported geometry) has likely run into the issue where the result looks like the dog's breakfast. This is (usually) because of a fundamental issue with how the split normals data is (or rather isn't) processed when the mesh is triangulated (i.e. when quads and ngons are turned into triangles). The Blender developer responsible for this module doesn't consider this a bug, so it may be a long time until this is corrected. I've come up with a workaround, though it's not exactly pretty; You will most likely have to redo this every time you make a major geometry change. Nothing in Blender is ever simple. It builds 'character.' :roll:

For reference, here's an example of a mesh I've been wanting to correct the normals on for a very long time. Wheels are highly circular and highly reflective. It doesn't take much scrutiny to pick out any flaws in shading or reflections:

Image

First, set up your mesh the way you want it to appear using Normal Edit, Data Transfer, Y.A.V.N.E. (awesome plugin btw), Blend4Web, or whatever other tools you typically use to fine-tune your normals. You could also just use an imported mesh with custom normals as well. We'll call this the 'master' mesh. Duplicate your master mesh to create the 'slave' mesh. The slave mesh will be the one that gets exported through SCSBT. From the slave mesh, remove all modifiers related to custom normals, and remove the custom split normals data set. Triangulate the slave mesh, and add a Data Transfer modifier with the following settings:

Image

Run the export helper, boot up the game and bask in the results:

Image

50keda: This seems simple enough to work into the exporter, no? You usually make a temporary copy of the piece to triangulate anyway... Why not transfer the normals data from the original in the process? :D
Image

User avatar
plykkegaard
Posts: 4522
Joined: 26 Oct 2014 13:42
Location: Denmark
Contact:

Re: A sneaky workaround for custom vertex normals

#2 Post by plykkegaard » 31 Jul 2016 08:09

Kewl
Office moved to Fort Collins, Colorado

User avatar
ohaha
Posts: 17052
Joined: 07 Dec 2012 06:31
Location: Watchin' y'all
Contact:

Re: A sneaky workaround for custom vertex normals

#3 Post by ohaha » 31 Jul 2016 15:50

You lost me somewhere around "who's tried using custom splits", but the results look awesome. :)
Something more to learn!
Thank you :D
Retired, but still loving it.

User avatar
50keda
SCS Software
Posts: 2708
Joined: 07 Dec 2012 11:59

Re: A sneaky workaround for custom vertex normals

#4 Post by 50keda » 01 Aug 2016 20:57

@smarty: any custom split normal data should be properly exported, so in this case you shouldn't need any data transfer modifiers... Meaning if you do any kind of normal editing be it with addons or by hand, it should be in resulted mesh already o.O

I need example files where result is not as expected ;)

User avatar
Smarty
Beta tester
Posts: 2155
Joined: 30 Jun 2015 01:56
Location: Ontario, Canada
Contact:

Re: A sneaky workaround for custom vertex normals

#5 Post by Smarty » 01 Aug 2016 21:16

Try any mesh with quads and custom normals (especially if imported, or modifiers are already applied). Basically any time the mesh has to be triangulated with 'static' custom split normals. It's a bug with split normals in Blender, not the exporter. You get the same result if you use ctrl+t on such a mesh within Blender. I'll see if I can't whip up an example file tonight.
Image

Post Reply

Return to “User Tutorials & Tools”

Who is online

Users browsing this forum: No registered users and 1 guest