Commit Graph

170 Commits

Author SHA1 Message Date
4cfca0adfe Nicer solution to T38846: Split off the render layer forcing from the
validity check for render operator.

This way scene DNA can stay read-only there, cleaner and we don't have
to pass an awkward bool pointer around.
2014-02-26 14:56:27 +01:00
ecbae4ab46 Fix T38846: Render layer checkbox is not refreshed.
The render operator invoke checks render layers, which can force the
render layer to be activated. This requires a notifier, which has to be
done in the operator itself (can't do this inside pipeline code).
2014-02-26 14:39:14 +01:00
a68ceb0af8 Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:

- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.

- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.

  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.

  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.

  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.

  Other tools like backing would also benefit of this option.

  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.

  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.

  Currently allowed image editor navigation and zooming.

Reviewers: brecht, campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
fbf821c50b Fix T37967: autosave does not save dynamic topology edits while in sculpt mode. 2014-01-20 14:26:48 +01:00
018fe81779 Fix T38269: scene full copy in mesh edit or sculpt mode did not copy mesh edits. 2014-01-20 14:16:22 +01:00
348cf17448 Code Cleanup: no need to pass empty strings as default values 2014-01-16 22:00:29 +11:00
71f689843d Fix deadlock happening when using Save Buffers for render
Summary:
Issue was caused by the same tile being written twice to
the EXR file. This was happening because of partial update
of work-in-progress tiles was merging result to the final
render result in order to make color management pipeline
happy.

We need to avoid such a merges and keep memory usage as
low as possible when Save Buffers is enabled.

Now render pipeline will allocate special display buffer
in render layer which will contain combined pass in the
display space. This keeps memory usage as low as we can
do at this moment.

There's one weak thing which is changing color management
settings during rendering would lead to lossy conversion.
This is because render result's display buffer uses color
space from the time when rendering was invoked.

This is actually what was happening in previous release
already actually so not a big issue.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D162
2014-01-01 22:32:47 +06:00
0d6ae3fda2 Main API: refactor naming, use BKE_main_ prefix and add main arg. 2013-12-30 13:25:27 +11:00
6e77dfeb1a Color management: get rid of original byte buffer partial update
It was only used by opengl render and in fact it needed just to
set DISPLAY_BUFFER_INVALID flag for the image buffer.

In theory it wouldn't make any change to opengl render speed
(because this change just moved rect_from_float from color
management code to image save code). And could not see any speed
changes on my laptop.
2013-12-18 15:25:46 +06:00
c5d7ea091f Changes to partial update during rendering
Summary:
Mainly addressed to solve old TODO with color managed fallback
to CPU mode when displaying render result during rendering.

That fallback was caused by the fact that partial image update
was always acquiring image buffer for composite output and was
only modifying display buffer directly.

This was a big issue for Cycles rendering which renders layers
one by one and wanted to display progress of each individual
layer. This lead to situations when display buffer was based on
what Cycles passes via RenderResult and didn't take layer/pass
from image editor header into account.

Now made it so image buffer which partial update is operating
with always corresponds to what is set in image editor header.

To make Cycles displaying progress of all the layers one by one
made it so image_rect_update switches image editor user to
newly rendering render layer. It happens only once when render
engine starts rendering next render layer, so should not be
annoying for navigation during rendering.

Additional change to render engines was done to make it so
they're able to merge composite output to final result
without marking tile as done. This is done via do_merge_result
argument to end_result() callback. This argument is optional
so should not break script compatibility.

Additional changes:

- Partial display update for Blender Internal now happens from
  the same thread as tile rendering. This makes it so display
  conversion (which could be pretty heavy actually) is done in
  separate threads. Also gives better UI feedback when rendering
  easy scene with small tiles.

- Avoid freeing/allocating byte buffer for render result
  if it's owned by the image buffer. Only mark it as invalid
  for color management.

  Saves loads of buffer re-allocations in cases when having
  several image editors opened with render result. This change
  in conjunction with the rest of the patch gave around
  50%-100% speedup of render time when displaying non-combined
  pass during rendering on my laptop.

- Partial display buffer update was wrong for buffers with number
  of channels different from 4.

- Remove unused window from RenderJob.

- Made image_buffer_rect_update static since it's only used
  in single file.

Reviewers: brecht

Reviewed By: brecht

CC: dingto

Differential Revision: http://developer.blender.org/D98
2013-12-17 23:42:38 +06:00
5a91df3271 Implement GPU-side dither
Summary:
Uses some magic pseudo-random which is actually a
texture coordinate hashing function.

TODOs:
- Dither noise is the same for all the frames.
- It's different from Floyd's dither we've been
  using before.
- Currently CPU and GPU dithering used different
  implementation. Ideally we need to use the same
  dither in CPU.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: http://developer.blender.org/D58
2013-12-13 12:36:45 +06:00
29790d4fca Fix T37414: local view not taken into account for blender internal F12 render over 3D view. 2013-11-27 20:22:13 +01:00
Lukas Toenne
c9fdec14f5 Fix #37261 Rendering a Render Layer from another scene doesn't update.
The scene pointer used for looking up the appropriate source of render result images in the image editor was always taken from context. This means that render results for a different scene would never be
displayed in the image editor.

To give feedback on running renders, try to get the running render job's scene pointer in the image editor for render result type images. This only happens during rendering, apart from that the regular
context scene result is displayed.
2013-10-31 17:20:31 +00:00
7267221715 remove return argument from wmOperatorType->cancel, was only ever returning OPERATOR_CANCELLED. 2013-10-30 23:08:53 +00:00
6e1fe4ddd9 Implementation of curve mapping in GLSL
The title says it all, now having curve mapping
enabled in color management settings wouldn't
force fallback from GLSL to CPU based color space
conversion.
2013-10-09 15:57:32 +00:00
5806ffdfd9 Fix blender internal viewport render not using color management settings like
view, exposure, looks.
2013-10-01 15:34:43 +00:00
fc2dbc20ff Fix #36800: closing render window during render crashes, the operator would be
cancelled before the job, causing invalid access to op->reports in the job thread.
2013-09-23 19:35:21 +00:00
ed2343270c Related to #36710: add a "use_viewport" option to the render operator, to specify
if the layers and camera of the 3d viewport should be used. Python scripts don't
always want this behavior.
2013-09-13 13:34:12 +00:00
c41bb7961f Different implementation of patch #36430: use layer froms scene directly for
rendering, in case some script wants to set it in the render_pre callback. In
case of decoupled 3d view layers or local view it will still override this
though.
2013-09-12 12:09:14 +00:00
f6b37f34ec code cleanup:
- add missing headers from cmake (own omission)
- quiet rna_test.c unused define warnings.
- minor style edits
- spelling corrections and ignore all uppercase words with spell checking script.
2013-09-05 19:56:49 +00:00
d4b8a6cb85 Code cleanup: use boolean instead of int for colormanagement 2013-09-05 17:13:43 +00:00
60e5abe71f Fix a few issues reported by coverity scan. 2013-09-03 22:39:21 +00:00
a54dd1155f Fix #36449: switching between render slots during render would leave some tiles
black until the end of the render.
2013-09-03 20:59:24 +00:00
60ff60dcdc RenderEngine API: add viewport draw utility functions to bind a GLSL fragment
shader for converting colors from linear to display space, based on the scene
color management settings.

if engine.support_display_space_shader(scene): # test graphics card support
	engine.bind_display_space_shader(scene)
	# draw pixels ..
	engine.unbind_display_space_shader()
2013-08-30 23:49:35 +00:00
e2534eac8e fix [#36347] Blender crashes when clicking on 'render' in 'viewport shading' 2013-08-20 18:55:41 +00:00
e5a885a038 fix for blender-internal viewport render looking fuzzy, don't filter the image 2013-08-05 05:13:09 +00:00
78a3c2ae57 Fix missing render info text in blender internal rendered viewport after
previous fix for checking char arrays against NULL.
2013-07-16 12:22:31 +00:00
925c5010e8 fix for checking char arrays against NULL, instead check their first character. also remove some dead code (return directly after return). 2013-07-16 11:42:07 +00:00
32586e6805 Fix #35470: crash rendering from the terminal in some cases due to render info
text threading issue.
2013-07-12 20:31:30 +00:00
8d9229538c Related to #36115: show in render info text when 3D view layer or camera overrides
scene settings when pressing F12 over a 3D view.
2013-07-12 16:33:30 +00:00
6ebfdd8dc3 remove reference to wrong python version in comments & pedantic style edit. 2013-07-10 09:40:49 +00:00
3f34a88fc8 Fix #36075: editing shading nodes could still crash blender internal rendered
draw mode. This happens because it uses node data structures in threads, now
it does same as preview render, which is to immediately stop the render thread
when e.g. deleting nodes.
2013-07-10 01:05:56 +00:00
a2553444fa Fix #35969: blender internal and cycles not updating mesh while in edit mode.
Patch for blender internal made by Campbell.
2013-07-08 22:41:14 +00:00
751062fc5f Fix #35979, #35937, #35739: undo crashes and missing updates with blender
internal viewport rendering. Lots of tweaks here, mainly:

* Stop 3D viewport render and free database before undo.
* Accumulate update flags rather than replace them each time it rerenders, to
  avoid previous updates getting lost.
* Don't check against Render struct view parameters for changes, those are set
  in the job thread which might not run before the next update call.
2013-07-08 22:26:10 +00:00
3ce280e825 Fix #35960, #36044: blender internal viewport rendering crash while editing data.
Now the viewport rendering thread will lock the main thread while it is exporting
objects to render data. This is not ideal if you have big scenes that might block
the UI, but Cycles does the same, and it's fairly quick because the same evaluated
mesh can be used as for viewport drawing. It's the only way to get things stable
until the thread safe dependency graph is here.

This adds a mechanism to the job system for jobs to lock the main thread, using a
new 'ticket mutex lock' which is a mutex lock that gives priority to the first
thread that tries to lock the mutex.

Still to solve: undo/redo crashes.
2013-07-08 17:56:51 +00:00
37f5945188 style cleanup 2013-06-25 10:44:30 +00:00
0309f442bb Render stats text: show elapsed time for blender internal, hide useless "Single Layer"
at the start, more clearly indicate what the render time of the last frame was, some
other tweaks for consistency.
2013-06-24 22:41:24 +00:00
789fabba41 Fix #35405: properties editor preview render restarted unnecessarily after F12 render. 2013-06-11 12:37:56 +00:00
ab52b15964 Fix #35681: cycles excluded layers still got evaluated before and after
rendering even if they were not used on any render layers.
2013-06-10 13:53:38 +00:00
99ead1948e quiet compiler warning building with internationalization enabled. 2013-06-03 19:20:45 +00:00
092d9c31a1 Bug fix, irc submitted:
3D Viewport render (internal) didn't render bump maps (it was black even).
2013-05-25 11:52:52 +00:00
c70a900736 More work on 3d view render:
- reverted fix for bug 32537 (error report drawing after thread job didn't show)

  This solves very bad 3d view render updates while using transform, it was
  getting into an eternal feedback loop for dependencies. (jobs sending mousemoves
  causing jobs to end, causing mousemoves, causing etc).
  
- The render-update code was not going over all windows, but over every screen to
  send signals (also the invisble ones)
2013-05-17 16:46:59 +00:00
7b2172cb0b 3D Viewport rendering (Blender Internal)
Added incremental re-render on view changes. That means all data preprocessing
only needs to be done once on view changes, quite faster that way.

Also fixed a bug in raytracing strands with soft shadows, was wrongly changing
coordinates in a static array.

Note: proper signals for re-renders is still on the todo. Many button options
don't signal a re-render yet. Work around: press G+ESC for quick full renders.
2013-05-17 11:13:46 +00:00
a4b5c05aad Fixes for blender internal viewport render:
* Particles did not render at viewport resolution like meshes.
* Properties editor preview render of hair was crashing, solution is to have
  two separate flags for this preview render and viewport preview render.
2013-05-15 17:09:45 +00:00
4fcd44d389 Fix #35362: using dyntopo gives wrong render results
Made it so dynamic topology will flush changes from
SculptSession->bm to Object->me.

Used the same approach as sculptsession_bm_to_me does,
but instead of using DAG_id_tag_update used in-place
DerivedMesh release. Otherwise this lead to some
update issues resulting in missed object after render.

Also fixed multires modifier not being applied for
render when rendering from dyntopo sculpt mode.

P.S. Apparently sculpsession_bm_to_me was declared
     in BKE_paint.h but implemented in object.c.
     Rather confusing and better make it so this
     functions are declared and implemented in
     consistent files. But will solve this in a
     separate commit.
2013-05-15 08:25:42 +00:00
df74639002 Speedup for rendered viewport for blender internal
Display code was a bottleneck here, so made it so render
result draw follows Image Draw settings.
2013-05-12 19:01:23 +00:00
1ea1f21b63 Viewport Render Internal:
Animated characters were not rendering yet, the render code for it
caused a signal for re-draw and re-render, in eternal loop.

Solved by forcing viewport render to use the same derivedmesh data
as for 3d viewport drawing. Faster too.
2013-05-12 17:16:43 +00:00
5fcf9b1d2f 3D viewport render preview:
- Put it available as a default now (no debug value needed)
- Fixed viewport size error, viewport was badly set
  (visible with border render, property regions)
- Fixed hanging lock in conflict between drawing and initialize
  new renders.
2013-05-12 13:15:41 +00:00
f74201190d code cleanup: remove references to BLI_rand.h 2013-05-08 12:59:35 +00:00