Commit Graph

54 Commits

Author SHA1 Message Date
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
e79b244097 Fix collada and freestyle module compile errors after recent commit, forgot to
compile with those enabled.
2014-01-15 19:15:51 +01:00
ebbb6adf32 Fix for infinite freestyle re-render in the viewport
Was a regression since e618d8238e and was caused by the wrong
main being tagged for update.
2014-01-15 17:42:01 +06:00
e618d8238e Fix T38054: High CPU usage with many objects
This is a regression since threaded dependency graph landed to master.
Root of the issue goes to the loads of graph preparation being done
even if there's nothing to be updated.

The idea of this change is to use ID type recalc bits to determine
whether there're objects to be updated. Generally speaking, we now
check object and object data datablocks with DAG_id_type_tagged()
and if there's no such IDs tagged we skip the whole task pool creation
and so,

The only difficult aspect was that in some circumstances it was possible
that there are tagged objects but nothing in ID recalc bit fields.

There were several different circumstances when it was possible:

* When one assigns object->recalc flag directly DAG flush didn't
  set corresponding bits to ID recalc bits. Partially it is fixed
  by making it so flush will set bitfield, but also for object
  types there's no reason to assign recalc flag directly. Using
  generic DAG_id_type_tag works almost the same fast as direct
  assignment, ensures all the bitflags are set properly and for the
  long run it seems it's what we would actually want to.

* DAG_on_visible_update() didn't set recalc bits at all.

* Some areas were checking for object->recalc != 0, however it is was
  possible that object recalc flag contains PSYS_RECALC_CHILD which
  was never cleaned from there.

  No idea why would we need to assign such a flag when enabling
  scene simplification, this is to be investigated separately.

* It is possible that scene_update_post and frame_update_post handlers
  will modify objects. The issue is that DAG_ids_clear_recalc is called
  just after callbacks, which leaves objects with recalc flags but no
  corresponding bit in ID recalc bitfield. This leads to some kind of
  regression when using ID type tag fields to check whether there objects
  to be updated internally comparing threaded DAG with legacy one.

  For now let's have a workaround which will preserve tag for ID_OB
  if there're objects with OB_RECALC_ALL bits. This keeps behavior
  unchanged comparing with 2.69 release.
2014-01-13 15:57:51 +06:00
f4dc0fa6c9 Fix #35353: Freestyle + Compositor + Auto-render renders freestyle lines in the wrong place. 2013-06-12 17:59:03 +00:00
5520331215 Fix #35561: freestyle + read full sample layers = crash.
Now add_freestyle() in pipeline.c takes a second argument to enable/disable
stroke rendering.  When stroke rendering is disabled, the function allocates
data structures but does not perform stroke rendering.  The allocated data
structures (mostly left unpopulated with data elements) are intended to allow
for the Read Full Sample Layers (Shift-R) command in the compositor.
2013-06-11 02:32:01 +00:00
a86e7c8b01 Replaced a hard-coded array length with MAX_ID_NAME. 2013-06-10 10:58:49 +00:00
a1ed1dd26b Fix for full-sample anti-aliasing (FSAA) not working with Freestyle.
Reverted the trunk revision 56136 and part of revision 56127 concerning the local Main
for Freestyle and temporary scene generation for stroke rendering.

The function do_merge_fullsample() in pipeline.c has access to the Scene of each Render,
so that the temporary Scene generated by Freestyle has to be kept for FSAA even after
stroke rendering has been done.  By the same token, the local Main has been moved from
the BlenderStrokeRenderer class to Render.  It is noted that free_all_freestyle_renders()
in pipeline.c is intended to get the temporary Scene of each Render released specifically
taking account of the FSAA case.
2013-04-23 22:40:13 +00:00
5725be6f08 Minor code clean-up & removal of unused code segments. 2013-04-20 23:00:27 +00:00
23d636eaf5 Fix for access freed scene when doing freestyle render
It's more like an ownership thing, but it's not so much
clear who actually is an owner of temporary scene, so
for now just ensure Render does not have link to it
after strokes are rendered.

There're also suspicious thing related on why separate
RE_free_database is needed for freestyle renders, but
that's also another story.
2013-04-18 12:11:50 +00:00
4df0c46f83 Make freestyle use local Main for temporary objects
This means main database is no longer pollutes with
temporary scene and objects needed for freestyle
render.

Actually, there're few of separated temporary mains
now. Ideally it's better to use single one, but it's
not so much trivial to pass it to all classes. Not
so big deal actually.

Required some changes to blender kernel, to make it
possible to add object to a given main, also to
check on mesh materials for objects in given main.
This is all straightforward changes.

As an additional, solved issue with main database
being infinitely polluted with text blocks created
by create_lineset_handler function.

This fixes:
- #35003: Freestyle crashes if user expands objects in FRS1_Scene
- #35012: ctrl+f12 rendering crashes when using Freestyle
2013-04-18 08:58:21 +00:00
ae58968e0a Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.

When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)

- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
  works for non-raytrace scenes, or zoom in ortho or camera mode, or for 
  Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
  re-render yet.

Tech notes:

- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.

- Fixed some bugs that were noticable with such excessive re-renders, like 
  for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
800f86c845 Attempt to fix a potential name conflict between Freestyle and the compositor.
A crash in the Freestyle renderer was reported by Ton on IRC with a stack trace
below.  Note that #2 is in Freestyle, whereas #1 is in the compositor.  The problem
was observed in a debug build on OS X 10.7 (gcc 4.2, openmp disabled, no llvm).

----------------------------------------------------------------------
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
[Switching to process 72386 thread 0xf303]
0x0000000100c129f3 in NodeBase::~NodeBase (this=0x10e501c80) at COM_NodeBase.cpp:43
43			delete (this->m_outputsockets.back());
Current language:  auto; currently c++
(gdb) where
#0  0x0000000100c129f3 in NodeBase::~NodeBase (this=0x10e501c80) at COM_NodeBase.cpp:43
#1  0x0000000100c29066 in Node::~Node (this=0x10e501c80) at COM_Node.h:49
#2  0x000000010089c273 in NodeShape::~NodeShape (this=0x10e501c80) at NodeShape.cpp:43
#3  0x000000010089910b in NodeGroup::destroy (this=0x10e501da0) at NodeGroup.cpp:61
#4  0x00000001008990cd in NodeGroup::destroy (this=0x10e5014b0) at NodeGroup.cpp:59
#5  0x00000001008990cd in NodeGroup::destroy (this=0x114e18da0) at NodeGroup.cpp:59
#6  0x00000001007e6602 in Controller::ClearRootNode (this=0x114e19640) at Controller.cpp:329
#7  0x00000001007ea52e in Controller::LoadMesh (this=0x114e19640, re=0x10aba4638, srl=0x1140f5258) at Controller.cpp:302
#8  0x00000001008030ad in prepare (re=0x10aba4638, srl=0x1140f5258) at FRS_freestyle.cpp:302
#9  0x000000010080457a in FRS_do_stroke_rendering (re=0x10aba4638, srl=0x1140f5258) at FRS_freestyle.cpp:600
#10 0x00000001006aeb9d in add_freestyle (re=0x10aba4638) at pipeline.c:1584
#11 0x00000001006aceb7 in do_render_3d (re=0x10aba4638) at pipeline.c:1094
#12 0x00000001006ae061 in do_render_fields_blur_3d (re=0x10aba4638) at pipeline.c:1367
#13 0x00000001006afa16 in do_render_composite_fields_blur_3d (re=0x10aba4638) at pipeline.c:1815
#14 0x00000001006b04e4 in do_render_all_options (re=0x10aba4638) at pipeline.c:2021
----------------------------------------------------------------------

Apparently a name conflict between the two Blender modules is taking place.
The present commit hence intends to address it by putting all the Freestyle C++
classes in the namespace 'Freestyle'.  This revision will also prevent potential
name conflicts with other Blender modules in the future.

Special thanks to Lukas Toenne for the help with C++ namespace.
2013-04-09 00:46:49 +00:00
829a2cc1b0 remove blender foundation copyright from freestyle files.
this can be added back on case-by-case basis, but better not assume ownership of another projects work by default.
2013-03-31 01:11:07 +00:00
4a0351cba2 Freestyle changes:
- Revert some stylistic changes made in branch
  They weren't directly related on freestyle project
  and better be handled in trunk. Helps reading patches
  ad prevents possible merge conflicts.

- Solved issue introduced with recent deprecation of
  RenderData.maximize,
2013-03-26 09:59:43 +00:00
4a92d82626 A big code clean-up patch from Bastien Montagne, many thanks! 2013-03-07 23:17:23 +00:00
51460e7789 Fix for a buffer overflow, by simply removing the unnecessary string copy.
Review comment from Campbell.
2013-03-02 18:43:06 +00:00
9e3bf44011 Fix for a static variable in BlenderStrokeRenderer::RenderStrokeRep() left after
quick trials of different approaches to performance improvement.
2013-02-14 19:19:44 +00:00
ac9ec06ec1 Merged changes in the trunk up to revision 54421.
Conflicts resolved:
release/datafiles/startup.blend
release/scripts/startup/bl_ui/properties_render.py
source/blender/SConscript
source/blender/blenloader/intern/readfile.c
2013-02-10 10:17:59 +00:00
68715c5ca7 A patch set from Bastien Montagne (thanks!) for silencing build warnings (from gcc 4.7),
mostly by commenting out unused variables, or using the BLI's SET_UINT_IN_POINTER macro.
2013-01-18 02:13:36 +00:00
feccbaabbd Merged changes in the trunk up to revision 53584.
Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/RNA_enum_types.h

Also made additional code updates for:
r53355 UIList - Python-extendable list of UI items
r53460 Alpha premul pipeline cleanup
2013-01-05 22:24:05 +00:00
ec78eb353f New command-line option --debug-freestyle to enable verbose debug messages
on the console during Freestyle rendering.  The debug prints are turned off
by default now.  Errors are still printed on the console.

A patch set implementing this functionality was provided by Bastien Montagne.
Many thanks! :)
2013-01-03 23:27:20 +00:00
d433cd65f7 Merged changes in the trunk up to revision 53146.
Conflicts resolved:
release/datafiles/startup.blend
source/blender/blenkernel/CMakeLists.txt
source/blender/blenlib/intern/bpath.c
source/blender/blenloader/intern/readfile.c
2012-12-19 01:49:58 +00:00
10f0f66560 Another big code clean-up patch by Bastien Montagne (GPL headers, indentation,
spaces around operators, and so forth).  Many thanks!
2012-12-18 00:51:25 +00:00
3c4987f983 Fix for a number of compiler warnings as well as a bug hidden by the warnings.
Patch contribution by Bastien Montagne, thanks!
2012-12-08 22:24:41 +00:00
f252230216 Fix for OCIO-based color management (reported in the commit log of revision 50832).
The solution is exactly the same with revision 43584 for a similar issue in pre-OCIO color management:
i.e., just disabling color management during the nested invocation of BI for stroke rendering.
2012-10-20 20:46:42 +00:00
5d95a72916 An attempt to improve the performance of temporary scene generation for stroke rendering.
Many thanks to Joshua Leung (aligorith) for the performance analysis of BKE_object_add function:
http://lists.blender.org/pipermail/bf-committers/2012-October/037759.html
2012-10-06 14:06:40 +00:00
d38ba6b5d2 Fix for persistent failures of BLI_assert(CustomData_has_layer(&dm->faceData, CD_POLYINDEX));
in CDDM_calc_normals_mapping_ex() in source/blender/blenkernel/intern/cdderivedmesh.c.
Problem report by flokkievids with an example .blend file for reproducing the issue. Thanks!

The issue was caused by the fact that Freestyle was using the pre-BMesh way for constructing
mesh data with the aim of generating a temporary 3D scene for stroke rendering.  Specifically,
the MFace struct was used for defining triangular faces.  Now BMesh is in the trunk, MFace
is internally used for tessellated faces only, and MPoly and MLoop are used for general mesh
data construction.  This commit is intended to update the Freestyle stroke rendering code in
the BMesh way.
2012-06-16 21:49:52 +00:00
8925ed1420 Merged changes in the trunk up to revision 46557.
Conflicts resolved:
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/makesrna/intern/rna_scene.c

Additional changes:
* Fix for recent changes of BKE_* function renaming.
* Fix for an "attempt to free NULL pointer" in BlenderStrokeRenderer::RenderStrokeRepBasic().
2012-05-11 22:48:41 +00:00
bf2fac79d4 Fix for X and Y aspect ratios not working properly with Freestyle stroke rendering.
Problem report by octane98 in the BA Freestyle thread.  Thanks!
2012-05-07 17:13:10 +00:00
3667cddf1a Fix for color management not working properly with Freestyle. 2012-01-21 21:58:47 +00:00
b6569ee4e7 Merged changes in the trunk up to revision 42116. 2011-11-26 13:11:55 +00:00
72cfdfec30 Fix for a crash when two scenes in the compositor have different render
resolution (i.e., image width and height, scaled by the size factor).
Problem report by flokkievids together with a .blend file for reproducing
the bug, thanks!
2011-11-06 12:23:44 +00:00
32c7e22d36 Merged changes in the trunk up to revision 37388.
Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/creator/SConscript
source/blender/blenlib/intern/bpath.c
source/blender/editors/space_outliner/outliner.c
2011-06-11 00:22:10 +00:00
4bb277117f Fix for composite node parameter animation not working with Freestyle.
The problem was reported by ikeahloe together with a .blend file for
reproducing the issue.  Thanks!
2011-04-17 02:47:32 +00:00
30da80cc41 Fixed a bug in the initialization of a temporary Scene struct
for stroke rendering.  This fix is intended to improve the
stability of stroke rendering when the output format is AVI
Codec, QuickTime, or one of FFMpeg codecs.
2010-08-16 16:51:44 +00:00
a5692fd67b Merged changes in the trunk up to revision 30952. 2010-08-01 23:37:52 +00:00
7abdf9b953 Minor comment fixes. 2010-06-26 16:35:56 +00:00
08e022da37 Second attempt to fix the border option. At the moment, accessing
diffuse and Z depth information through style modules won't work
correctly with the border option.  Another fix will follow.
2010-03-30 00:41:26 +00:00
f4e9c5d71e Merged changes in the trunk up to revision 27817. 2010-03-28 22:45:14 +00:00
e2cb635744 Slightly reduced the memory consumption during stroke rendering by
removing ListBase BlenderStrokeRenderer::objects and relying on
Base freestyle_scene::base instead.
2010-03-28 18:12:45 +00:00
840ba8e8e7 Fixed the full sample anti-aliasing support in Freestyle.
The render pipeline has been extended to better work with
Freestyle stroke rendering.  Struct Render has a new member
ListBase freestyle_renders to keep Render instances generated
through stroke rendering in Freestyle.  The number of
elements (LinkData instances with LinkData::data pointing to a
Render instance) in freestyle_renders is the same as the scene
render layers of the scene being rendered.  When the k-th scene
render layer has the Freestyle option enabled, the k-th element
of freestyle_renders refers to a Render instance that holds
Freestyle render results for the scene layer.  This association
between the scene render layer and the Render instance is used to
merge the Freestyle render results into the corresponding render
results for the scene render layer.
2010-03-28 17:46:10 +00:00
6a681bca45 Made an attempt for fixing an instability issue regarding animation
rendering.

RE_BlenderFrame() and RE_BlenderAnim() are Blender's internal
top-level rendering API functions for a single frame and a series of
frames, respectively.  These functions rely on global variables to
keep render pipeline states.  Freestyle's stroke rendering was also
using RE_BlenderFrame to render a temporary scene of stroke meshes.
These nested calls of the top-level rendering API functions were
causing broken render pipeline states and eventually led to a crash.

This commit is intended to fix the issue, by introducing an rendering
API function RE_RenderFreestyleStrokes specifically used for stroke
rendering in Freestyle.  The new function does not do anything with
regard to the global variables in the rendering API implementation.
2010-03-01 21:51:14 +00:00
ca908e21e2 Added support for transparent stroke colors (again).
Transparent strokes are rendered by means of transparent vertex colors.
To make this possible, Blender's internal renderer has been slightly
extended to allow transparent vertex colors.  When Material::vcol_alpha
is non-zero, the renderer takes MCol::a into account.
2010-02-16 02:10:27 +00:00
12506ed6a1 Reverted the changes for adding support for transparent stroke colors,
because of incomplete functionality.

When two transparent strokes intersect, the stroke drawn first is
completely overridden by the stroke drawn after the first stroke,
instead of two stroke colors being blended at the intersection.
2010-02-15 00:07:15 +00:00
135a944c66 Merged changes in the trunk up to revision 26856. 2010-02-13 01:13:16 +00:00
4ec75badf8 Added support for transparent stroke colors.
In Freestyle, strokes are represented with triangle strips, and stroke
colors are realized using vertex colors in order to enable variable
stroke colors (i.e., each triangle has a different color).  Stroke
colors in Freestyle are in the RGBA format, while vertex colors in
Blender do not have an alpha component.  Therefore, we here employ a
2-pass rendering approach as follows.  First, the alpha component of
an image is rendered by using the red component of vertex colors as
the alpha component of stroke colors (1st pass).  The render result is
saved into a temporary buffer.  Then, the vertex colors of stroke
meshes are replaced with RGB values, and the RGB components of the
image is rendered (2nd pass).  Finally, the RGB and alpha components
are merged to produce the render result in the RGBA format.
2010-02-08 02:19:17 +00:00
9bafbe4549 Fixed a bug that visible strokes are not rendered correctly when
the aspect ratio is not equal to 1:1.
2010-01-30 09:59:01 +00:00
446af11fb3 Fixed a bug that caused a Y-direction offset in rendering results.
The renderer now takes the aspect ratio settings into account.
2010-01-29 22:13:39 +00:00
c5558e6967 Made an attempt to improve memory consumption during stroke
rendering.  When objects exists out of the viewing frustrum and
near the near clipping plane, feature edges in the 3D camera
coordinate system are projected to an extremely far location from
the camera view in the 2D image space.  These feature edges
result in very long strokes with a large number of stroke
vertices, which temporarily require a significant memory storage,
causing a fatal "out of memory" error.  This problem is partially
addressed by the changes in the present commit.
2010-01-26 22:24:53 +00:00