Triangle count is incorrect when above around 2 billion #57884

Closed
opened 2018-11-17 01:45:26 +01:00 by Carlo Andreacchio · 16 comments

System Information
Ubuntu 17.10

Blender Version
Broken: 2c347ebbba

Short description of error
Triangle count is incorrect when its too large

Exact steps for others to reproduce the error

  1. Get high resolution tree and make it into bounding box mode
  2. create particle plane
  3. increase particle count until the triangles get above 2billion approximately
  4. notice how the number of triangles goes into the negative.

This happens on production scenes -- Selection_079.png

**System Information** Ubuntu 17.10 **Blender Version** Broken: 2c347ebbba9 **Short description of error** Triangle count is incorrect when its too large **Exact steps for others to reproduce the error** 1. Get high resolution tree and make it into bounding box mode 2. create particle plane 3. increase particle count until the triangles get above 2billion approximately 4. notice how the number of triangles goes into the negative. This happens on production scenes -- ![Selection_079.png](https://archive.blender.org/developer/F5592631/Selection_079.png)

Added subscriber: @candreacchio

Added subscriber: @candreacchio

This is actually a problem on verts and faces aswell, not just tris.

This is actually a problem on verts and faces aswell, not just tris.

Added subscriber: @StephenSwaney

Added subscriber: @StephenSwaney

Please attach a .blend showing the problem.

This sounds like integer overflow.
A signed integer has a maximum value of roughly 2,000,000,000. Go over that and you get negative numbers.

  - MISSING INFO

Please follow our submission template and guidelines and make a complete, valid bug report, with required info, precise description of the issue, precise steps to reproduce it, small and simple .blend and/or other files to do so if needed, etc.

A guideline for making a good bug report can be found here: https://wiki.blender.org/wiki/Process/Bug_Reports

Marking as "Incomplete" until the requested information/data is provided.

Please attach a .blend showing the problem. This sounds like integer overflow. A signed integer has a maximum value of roughly 2,000,000,000. Go over that and you get negative numbers. - MISSING INFO Please follow our submission template and guidelines and make a complete, valid bug report, with required info, precise description of the issue, precise steps to reproduce it, small and simple .blend and/or other files to do so if needed, etc. A guideline for making a good bug report can be found here: https://wiki.blender.org/wiki/Process/Bug_Reports Marking as "Incomplete" until the requested information/data is provided.

Probably not the most efficient bug blend, but its there. make sure you have enough ram to open the file (not a problem in blender 2.7)

overflow.blend

Probably not the most efficient bug blend, but its there. make sure you have enough ram to open the file (not a problem in blender 2.7) [overflow.blend](https://archive.blender.org/developer/F5624873/overflow.blend)
Member

Added subscribers: @Sergey, @lichtwerk

Added subscribers: @Sergey, @lichtwerk
Sergey Sharybin was assigned by Philipp Oeser 2018-11-19 12:16:08 +01:00
Member

Overflow confirmed.

@Sergey: does this have to be changed to long (or whatever) all over the place? DNA_mesh_types etc?

Overflow confirmed. @Sergey: does this have to be changed to long (or whatever) all over the place? DNA_mesh_types etc?

Never use long! It is platform specific and different on different OS/bitnesses. Use uint64_t in the statistics. Doing this in DNA_mesh_types is hell of a lot of work, which will involve modifying all the areas which loops and indices those.

Quite sure avoiding overflow in stats will solve 99% of cases. And quite sure once you've got mesh with more than 2B vertices you'll have other issues.

P.S. Do you expect me to work on this?

Never use `long`! It is platform specific and different on different OS/bitnesses. Use `uint64_t` in the statistics. Doing this in DNA_mesh_types is hell of a lot of work, which will involve modifying all the areas which loops and indices those. Quite sure avoiding overflow in stats will solve 99% of cases. And quite sure once you've got mesh with more than 2B vertices you'll have other issues. P.S. Do you expect me to work on this?

This isn't to do with one mesh but a scene... I opened our production scenes from blender 2.7 in 2.8 and it's reporting it.

The difference lies with 2.8 counting each particle instance in the tri /vert / face count rather than discounting it entirely.

Not sure who should work on it but it does occur in normal scenes for us.

If any more info is needed please let us know and we will clarify as soon as possible

Carlo

This isn't to do with one mesh but a scene... I opened our production scenes from blender 2.7 in 2.8 and it's reporting it. The difference lies with 2.8 counting each particle instance in the tri /vert / face count rather than discounting it entirely. Not sure who should work on it but it does occur in normal scenes for us. If any more info is needed please let us know and we will clarify as soon as possible Carlo
Sergey Sharybin was unassigned by Philipp Oeser 2018-11-19 13:07:59 +01:00
Member

think I checked and me_eval->totloop was overflowing already, but will have a second look...

think I checked and `me_eval->totloop` was overflowing already, but will have a second look...

@lichtwerk if that thing is overflowing, then drawing will not be correct. And the modifiers, or anything. That's very weird and dangerous if that thing is overflown.

@lichtwerk if that thing is overflowing, then drawing will not be correct. And the modifiers, or anything. That's very weird and dangerous if that thing is overflown.
Member

@Sergey: yep, my bad (will stand in the corner for a while...), was something else overflown, checking this again atm...

@Sergey: yep, my bad (will stand in the corner for a while...), was something else overflown, checking this again atm...

@lichtwerk, my bet would be on SceneStats from info_stats.c. Change int to uint64_t would be the first step. Second one would be to ensure correct format in SCENE_STATS_FMT_INT is used.

@lichtwerk, my bet would be on `SceneStats` from `info_stats.c`. Change `int` to `uint64_t` would be the first step. Second one would be to ensure correct format in `SCENE_STATS_FMT_INT` is used.

This issue was referenced by cec83e92e6

This issue was referenced by cec83e92e6160adf1e39e0173c77743cb1ff1be7
Member

I had a go in D3962

I had a go in [D3962](https://archive.blender.org/developer/D3962)
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#57884
No description provided.