Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(371)

Issue 4280049: modeler normals don't match render normals

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 2 months ago by sparky
Modified:
13 years, 2 months ago
Reviewers:
bf-codereview, brechtvl
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

there's a before and after shot at http://jbit.net/~sparky/nprob/ Essentially the modeler doesn't take into account that some faces might be set to flat (the way the render does it). This inconsistency is bad in various contexts. Normal maps is one (terrible) but also BGE and exports don't get the same results as the renderer which is also bad. This is my suggested fix. Btw, the before shot uses the modeler normals (which as you can see are no good).

Patch Set 1 #

Patch Set 2 : this patch fixes the same bug caused by multiple implementations but has no code sharing. #

Total comments: 11

Patch Set 3 : std fixes #

Patch Set 4 : forgot to move copy to norm inside the if(). But that's incl. in this patch. #

Patch Set 5 : angle weighted plus removed a bug frm when I went frm patch 1 to patch 2 and removed the code sharin #

Patch Set 6 : oops. must relocate one of the normalizes inside AccAtVertexNormals() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -72 lines) Patch
source/blender/blenkernel/BKE_DerivedMesh.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
source/blender/blenkernel/intern/cdderivedmesh.c View 1 2 3 4 4 chunks +26 lines, -9 lines 0 comments Download
source/blender/blenkernel/intern/mesh.c View 1 2 3 4 1 chunk +21 lines, -7 lines 0 comments Download
source/blender/blenlib/BLI_math_geom.h View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
source/blender/blenlib/intern/math_geom.c View 1 2 3 4 5 1 chunk +39 lines, -0 lines 0 comments Download
source/blender/editors/mesh/editmesh_lib.c View 1 2 3 4 1 chunk +19 lines, -5 lines 0 comments Download
source/blender/render/intern/source/convertblender.c View 1 2 3 4 11 chunks +45 lines, -50 lines 0 comments Download

Messages

Total messages: 27
sparky
13 years, 2 months ago (2011-03-15 13:16:41 UTC) #1
brechtvl
To be honest, I don't like this SCalcNormalInterface at all, way too much code and ...
13 years, 2 months ago (2011-03-15 13:59:52 UTC) #2
sparky
No that won't work. The structures are way too different. For instance edit mesh contains ...
13 years, 2 months ago (2011-03-15 14:10:45 UTC) #3
brechtvl
On 2011/03/15 14:10:45, mikkelsen7 wrote: > We can change anything we want in there. Angle ...
13 years, 2 months ago (2011-03-15 14:22:52 UTC) #4
sparky
So you'd be happy with it the way it is if I took out the ...
13 years, 2 months ago (2011-03-15 14:28:55 UTC) #5
brechtvl
On 2011/03/15 14:28:55, mikkelsen7 wrote: > So you'd be happy with it the way it ...
13 years, 2 months ago (2011-03-15 14:32:13 UTC) #6
brechtvl
On 2011/03/15 14:32:13, brechtvl wrote: > On 2011/03/15 14:28:55, mikkelsen7 wrote: > > So you'd ...
13 years, 2 months ago (2011-03-15 14:36:38 UTC) #7
sparky
But it has to iterate over the faces twice. Removing the iteration from the abstraction ...
13 years, 2 months ago (2011-03-15 14:51:05 UTC) #8
brechtvl
On 2011/03/15 14:51:05, mikkelsen7 wrote: > But it has to iterate over the faces twice. ...
13 years, 2 months ago (2011-03-15 15:02:21 UTC) #9
sparky
I'll make a version of the patch without any code sharing instead. On Tue, Mar ...
13 years, 2 months ago (2011-03-15 15:22:50 UTC) #10
sparky
Index: render/intern/source/convertblender.c =================================================================== --- render/intern/source/convertblender.c (revision 35505) +++ render/intern/source/convertblender.c (working copy) @@ -499,6 +499,11 @@ ...
13 years, 2 months ago (2011-03-15 16:20:15 UTC) #11
sparky
Index: source/blender/render/intern/source/convertblender.c =================================================================== --- source/blender/render/intern/source/convertblender.c (revision 35505) +++ source/blender/render/intern/source/convertblender.c (working copy) @@ -499,6 +499,11 @@ ...
13 years, 2 months ago (2011-03-15 17:37:26 UTC) #12
dfelinto
To add a new patch you need to click in the link between "Patch Set ...
13 years, 2 months ago (2011-03-15 17:54:36 UTC) #13
sparky
this patch fixes the same bug caused by multiple implementations but has no code sharing.
13 years, 2 months ago (2011-03-15 18:01:04 UTC) #14
brechtvl
Some comments on the code.
13 years, 2 months ago (2011-03-15 18:31:12 UTC) #15
brechtvl
http://codereview.appspot.com/4280049/diff/8003/source/blender/blenkernel/BKE_DerivedMesh.h File source/blender/blenkernel/BKE_DerivedMesh.h (right): http://codereview.appspot.com/4280049/diff/8003/source/blender/blenkernel/BKE_DerivedMesh.h#newcode213 source/blender/blenkernel/BKE_DerivedMesh.h:213: void (*getRealVertNo)(DerivedMesh *dm, int face_index, int vert_num, float no_r[3]); ...
13 years, 2 months ago (2011-03-15 18:31:32 UTC) #16
brechtvl
http://codereview.appspot.com/4280049/diff/8003/source/blender/blenkernel/intern/cdderivedmesh.c File source/blender/blenkernel/intern/cdderivedmesh.c (right): http://codereview.appspot.com/4280049/diff/8003/source/blender/blenkernel/intern/cdderivedmesh.c#newcode1869 source/blender/blenkernel/intern/cdderivedmesh.c:1869: /* calculate face normals and add to vertex normals ...
13 years, 2 months ago (2011-03-15 18:39:32 UTC) #17
sparky
Now that my code has mostly been taken out I think I will leave it ...
13 years, 2 months ago (2011-03-15 18:51:07 UTC) #18
sparky
std fixes
13 years, 2 months ago (2011-03-16 14:50:26 UTC) #19
sparky
forgot to move copy to norm inside the if(). But that's incl. in this patch.
13 years, 2 months ago (2011-03-17 03:36:05 UTC) #20
brechtvl
After some tests with various models, it seems that angle weighted really is much better ...
13 years, 2 months ago (2011-03-17 09:19:00 UTC) #21
sparky
The renderer is much more used and people using the renderer are much more sensitive ...
13 years, 2 months ago (2011-03-17 14:30:09 UTC) #22
sparky
angle weighted plus removed a bug frm when I went frm patch 1 to patch ...
13 years, 2 months ago (2011-03-19 14:21:34 UTC) #23
sparky
oops. must relocate one of the normalizes inside AccAtVertexNormals()
13 years, 2 months ago (2011-03-19 14:53:36 UTC) #24
brechtvl
Looks ok to me, I've made some changes (but can't seem to attach the patch ...
13 years, 2 months ago (2011-03-19 20:00:30 UTC) #25
sparky
Brilliant! Thanks a lot. Cheers, Morten. On Sat, Mar 19, 2011 at 1:00 PM, <brechtvanlommel@gmail.com> ...
13 years, 2 months ago (2011-03-19 21:19:47 UTC) #26
brechtvl
13 years, 1 month ago (2011-03-20 13:50:34 UTC) #27
Committed.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b