Weighted Normals Calculator

add-ons

(notallowed) #1

Hi all,

it’s been a long time since my last post on this forum. I prepared simple addon with operator for recalculation of normals by principle of “Weighted Normals” similar to one that Maya has.

Operator can be used on any mesh object, auto smooth and properties needed for it, will be set upon execution.

Test example:

  1. create cube
  2. bevel it
  3. hit space and type: “Weighted Normals”
  4. viola you normals have been recalculated

weighted_normals_1.1.zip (5.06 KB)
weighted_normals_1_2.zip (1.73 KB)

Changelog 1.2:

  • fixed problems when some faces in mesh are hidden

Happy Blending,
notallowed


What's wrong with topology? (bad smoothing)
First Post, Any Advice Welcome
Autosmooth Beveled edges
(nikitron) #2

not see it in searchmenue


(nikitron) #3

ok, object mode needed


(Spirou4D) #4

Thanks @notallowed,
I will try it… bye bye.

EDIT: Hi Nikitron :eyebrowlift2:


(notallowed) #5

@all: I updated the script, with support for hard edges. So if you will set any hard edges on the mesh they should be preserved!


(varomix) #6

oh my good!, dude this is so amazing, been trying to do this for a while, this type of normals work sooooo much better for game models with normals maps.

thanks a lot


(mzprox) #7

Could someone explain me what does this addon does and which are the major uses in the modelling pipeline? I remember reading about face wighted normals some time ago, but wasn’t very clear then,and since Blender had no script i did not care about it. Thx.


(notallowed) #8

@mzprox: Well Blender by default calculates normals as average of faces normals shared with the vertex. Instead of average, by weighted normals the amount of donated face normal is calculated by it’s area. So bigger faces will donate more of it’s normal to vertex then smaller faces.

If I didn’t explain it well maybe this will help you:
http://www.bytehazard.com/articles/vertnorm.html -> Surface Area Weights


(mzprox) #9

Thanks for the explanation. So if I get it right using this script on a low poly before normal map bake could result in cleaner normal map. I assume these modified normals are exported with the fbx format, right?

Btw I was testing it, extruding some sides of a beweled cube, adding edgeloops to it etc, and getting some weird results in shading which stays even after I put on an edgesplit modifier to make the edges hard)


(notallowed) #10

@mzprox: That is correct. This script is operator, so it’s one time action only. This means if you change the mesh itself after you use weighted normals you should use it again to recalculate split normals :wink:


(Floki) #11

Awesome addon! Thanks man!


(critch) #12

I am experiencing crashing when I bake normal after running the weighted normal add-on. Steps:selecting low poly mesh>run weighted normal>cycles bake normal, selective to active with cage. Only way I can restore baking is to clear custom split normal data on low poly.


(critch) #13

After more testing it seems the cage must also have the weighted normal applied prior to bake. Everything works then. Bake does appear to give better results. Thanks!


(JWise) #14

You have two different zip files listed above…one is 77 lines long, the other 103…which is the most current?


(adamnerva) #15

The script linked in the body of the OP is the most recent, and the additional code is support for sharp edges. The script included as an attachment is the previous version. But you have probably figured that out by now.


(notallowed) #16

Hi everyone,

sorry for inconvenience with multiple files, but the thing is that this addon anyway didn’t work as expected with sharp edges.

Just now I uploaded new version which is reworked to actually properly work with sharp edges.

So go ahead and try it out again.

Bye and happy blending :slight_smile:


(pachupp) #17

hi, im getting error
File"C:…\weighted_normals.py", line 148, in execute curr_n = calc_weighted_normal(bm, curr_loop.vert.index, e_i)
NameError: name ‘calc_weighted_normal’ is not defined

location:<unknown location>:-1

any ideas?


(notallowed) #18

@pachupp: Download again, refactoring problem :slight_smile: Should work now.


(pixelgrip) #19

hi,thank you for your fantastic addon

im get strange artefacts
its work well it seems with the basic mesh,but with a mirror modifier ,the mirrored mesh shows not the same result

is this a bug ? or is there a workaround possible, with mirror modifier enabled but unapplyed?


(MmAaXx) #20

this is an amazing addon! 1 click and it does a super cool result!
just geussing if it is possible to achive a result like this in the picture, thanks!

on the left is what I got with your addon, on the righet is what I got with the blend4webaddon.

http://s30.postimg.org/thzlf2rch/example.jpg