Bug or refactoring artifact?

View: New views
5 Messages — Rating Filter:   Alert me  

Bug or refactoring artifact?

by Daniel Scott Matthews :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am seeing this on the console when importing with both the OBJ and
the 3DS mesh readers.

ERROR: /home/daniel/projects/k3d/k3dsdk/normal3.h line 207: assertion
`length' failed

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: Bug or refactoring artifact?

by Timothy M. Shead :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Daniel Scott Matthews wrote:
> I am seeing this on the console when importing with both the OBJ and
> the 3DS mesh readers.
>
> ERROR: /home/daniel/projects/k3d/k3dsdk/normal3.h line 207: assertion
> `length' failed

This message indicates that we're trying to normalize a zero-length
normal vector, which would cause a divide-by-zero error if we didn't
catch it.  Could you send a small sample OBJ that causes this message?

Cheers,
Tim

[tshead.vcf]

begin:vcard
fn:Timothy Shead
n:Shead;Timothy
org:www.k-3d.org
email;internet:tshead@...
title:Founder
x-mozilla-html:FALSE
url:www.k-3d.org
version:2.1
end:vcard



------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: Bug or refactoring artifact?

by Timothy M. Shead :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Daniel Scott Matthews wrote:
>> I am seeing this on the console when importing with both the OBJ and
>> the 3DS mesh readers.
>>
>> ERROR: /home/daniel/projects/k3d/k3dsdk/normal3.h line 207: assertion
>> `length' failed
>
> This message indicates that we're trying to normalize a zero-length
> normal vector, which would cause a divide-by-zero error if we didn't
> catch it.  Could you send a small sample OBJ that causes this message?

After loading a modest example sent by Daniel, I'm able to reproduce this.
 After putting an assert() in k3dsdk/normal3.h, I can see that this
computation is happening in the painter cache code, so I'm going to hand
this off to Bart ...

Cheers,
Tim

#0  0x9334fe42 in __kill ()
#1  0x9334fe34 in kill$UNIX2003 ()
#2  0x933c223a in raise ()
#3  0x933ce679 in abort ()
#4  0x933c33db in __assert_rtn ()
#5  0x00d96351 in k3d::normalize (Normal=@0x18b02654) at normal3.h:207
#6  0x1848d0ca in
module::opengl::painters::detail::face_normals::on_face_end
(this=0x18b025f0, Face=43110) at
/Users/tshead/src/k3d/modules/opengl_painters/normal_cache.cpp:153
#7  0x1848d41a in
module::opengl::painters::detail::traverse_polyhedra<module::opengl::painters::detail::face_normals>
(Mesh=@0x18387030, Functor=@0x18b025f0) at
/Users/tshead/src/k3d/modules/opengl_painters/normal_cache.cpp:133
#8  0x1848f8c1 in
module::opengl::painters::detail::face_normals::on_execute
(this=0x18b025f0, Mesh=@0x18387030, Painter=0x255c600) at
/Users/tshead/src/k3d/modules/opengl_painters/normal_cache.cpp:196
#9  0x1845067f in module::opengl::painters::scheduler::execute
(this=0x18b025f0, Mesh=@0x18387030, Painter=0x255c600) at
painter_cache.h:219
#10 0x18490a30 in
module::opengl::painters::painter_cache<module::opengl::painters::detail::face_normals,
k3d::mesh const* const>::get_data (this=0x183ad580, Key=0x18387030,
Painter=0x255c600) at painter_cache.h:70
#11 0x18490a84 in
module::opengl::painters::get_data<module::opengl::painters::detail::face_normals>
(Key=0x18387030, Painter=0x255c600) at painter_cache.h:176
#12 0x18489d3b in module::opengl::painters::normal_cache::face_normals
(this=0x183995e0, Painter=0x255c600) at
/Users/tshead/src/k3d/modules/opengl_painters/normal_cache.cpp:296
#13 0x1846dac9 in module::opengl::painters::face_painter::on_paint_mesh
(this=0x255c600, Mesh=@0x18387030, RenderState=@0xbfffe394) at
/Users/tshead/src/k3d/modules/opengl_painters/face_painter.cpp:114
#14 0x1840fc96 in k3d::gl::mesh_painter::paint_mesh (this=0x255c600,
Mesh=@0x18387030, RenderState=@0xbfffe394) at mesh_painter_gl.h:57
#15 0x1847fbe4 in module::opengl::painters::multi_painter::on_paint_mesh
(this=0x16ddbc40, Mesh=@0x18387030, RenderState=@0xbfffe394) at
/Users/tshead/src/k3d/modules/opengl_painters/multi_painter.cpp:62
#16 0x1840fc96 in k3d::gl::mesh_painter::paint_mesh (this=0x16ddbc40,
Mesh=@0x18387030, RenderState=@0xbfffe394) at mesh_painter_gl.h:57
#17 0x18d92625 in module::mesh_instance::mesh_instance::on_gl_draw
(this=0x258e200, State=@0xbfffe6b8) at
/Users/tshead/src/k3d/modules/mesh_instance/mesh_instance.cpp:198
#18 0x18d9cd17 in
k3d::gl::renderable<k3d::ri::renderable<k3d::mesh_selection_sink<k3d::parentable<k3d::transformable<k3d::node>
> > > >::gl_draw (this=0x258e200, State=@0xbfffe6b8) at renderable_gl.h:78
#19 0x051d8127 in module::opengl::detail::draw::operator()
(this=0xbfffe648, Object=0x258e200) at
/Users/tshead/src/k3d/modules/opengl/render_engine.cpp:121
#20 0x051d8152 in std::for_each<std::_List_const_iterator<k3d::inode*>,
module::opengl::detail::draw> (__first={_M_node = 0x183adfc0},
__last={_M_node = 0xbfffe7a0}, __f={m_state = @0xbfffe6b8,
m_node_selection = 0x1ecaddc}) at stl_algo.h:158
#21 0x051dad15 in module::opengl::render_engine::render_viewport
(this=0x2029e00, Camera=@0x20368d4, PixelWidth=934, PixelHeight=578,
ViewMatrix=0x5f9f6a8, ProjectionMatrix=0x5f9f728, Viewport=0x5f9f7a8) at
/Users/tshead/src/k3d/modules/opengl/render_engine.cpp:533




------------------------------------------------------------------------------
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: Bug or refactoring artifact?

by bART Janssens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jun 24, 2009 at 4:42 AM, Timothy M. Shead<tshead@...> wrote:

>> Daniel Scott Matthews wrote:
>>> I am seeing this on the console when importing with both the OBJ and
>>> the 3DS mesh readers.
>>>
>>> ERROR: /home/daniel/projects/k3d/k3dsdk/normal3.h line 207: assertion
>>> `length' failed
>>
>> This message indicates that we're trying to normalize a zero-length
>> normal vector, which would cause a divide-by-zero error if we didn't
>> catch it.  Could you send a small sample OBJ that causes this message?
>
> After loading a modest example sent by Daniel, I'm able to reproduce this.
>  After putting an assert() in k3dsdk/normal3.h, I can see that this
> computation is happening in the painter cache code, so I'm going to hand
> this off to Bart ...
Well, I've traced back the problem to two bad faces in the source
mesh. The faces appear to be reduced to a single point, so no normal
can be calculated. The first attached image shows these faces moved up
5m.

The missing wheels are a mystery to me, but this happens in both K-3D
and XSI Mod Tool. This is
unrelated to the normals error. Are you sure everything was exported properly?

In order to select and move the bad faces, I made the following changes in SVN:
- Made normals_cache print the index of bad faces
- Added a FaceToPointSelections plugin, to convert face selections to points
- Fixed a bug with mesh_simple_deformation_modifier that prevented
selection from working correctly

You should now be able to use the following procedure to identify or
fix bad faces:
- Look in the debug output for the bad face numbers
- Select a bad face using SelectFaceByNumber
- Convert this selection to points using FaceToPointSelections
- Apply a modifier, i.e. TranslatePoints or JoinPoints (needs to be
restored to the new mesh format)
- Click the "Clear" button on this modifiers mesh_selection property,
so only the points belonging to the bad face get affected

The real solution for this would be a plugin that helps cleaning up
meshes and does things like removing faces smaller than a threshold.

Cheers,

--
Bart


------------------------------------------------------------------------------

_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

train_bad_faces_moved.png (20K) Download Attachment

Re: Bug or refactoring artifact?

by Daniel Scott Matthews :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jun 26, 2009 at 8:13 AM, Bart Janssens<bart.janssens@...> wrote:

> On Wed, Jun 24, 2009 at 4:42 AM, Timothy M. Shead<tshead@...> wrote:
>>> Daniel Scott Matthews wrote:
>>>> I am seeing this on the console when importing with both the OBJ and
>>>> the 3DS mesh readers.
>>>>
>>>> ERROR: /home/daniel/projects/k3d/k3dsdk/normal3.h line 207: assertion
>>>> `length' failed
>>>
>>> This message indicates that we're trying to normalize a zero-length
>>> normal vector, which would cause a divide-by-zero error if we didn't
>>> catch it.  Could you send a small sample OBJ that causes this message?
>>
>> After loading a modest example sent by Daniel, I'm able to reproduce this.
>>  After putting an assert() in k3dsdk/normal3.h, I can see that this
>> computation is happening in the painter cache code, so I'm going to hand
>> this off to Bart ...
>
> Well, I've traced back the problem to two bad faces in the source
> mesh. The faces appear to be reduced to a single point, so no normal
> can be calculated. The first attached image shows these faces moved up
> 5m.
>
> The missing wheels are a mystery to me, but this happens in both K-3D
> and XSI Mod Tool. This is
> unrelated to the normals error. Are you sure everything was exported properly?
>
> In order to select and move the bad faces, I made the following changes in SVN:
> - Made normals_cache print the index of bad faces
> - Added a FaceToPointSelections plugin, to convert face selections to points
> - Fixed a bug with mesh_simple_deformation_modifier that prevented
> selection from working correctly
>
> You should now be able to use the following procedure to identify or
> fix bad faces:
> - Look in the debug output for the bad face numbers
> - Select a bad face using SelectFaceByNumber
> - Convert this selection to points using FaceToPointSelections
> - Apply a modifier, i.e. TranslatePoints or JoinPoints (needs to be
> restored to the new mesh format)
> - Click the "Clear" button on this modifiers mesh_selection property,
> so only the points belonging to the bad face get affected
>
> The real solution for this would be a plugin that helps cleaning up
> meshes and does things like removing faces smaller than a threshold.
>

I can't answer the question re the missing wheels, I'll just have to
keep an eye out for that happening again in another file.

Thanks for finding the issue with the normals, I agree with you about
the need for a mesh cleaning tool. Have you looked at MeshLab, it has
a tool-set for such tasks, perhaps their are parts of MeshLab that
K-3D can incorporate?  http://meshlab.sourceforge.net/

------------------------------------------------------------------------------
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development