Removed all limitations from render code for maximum threads. The only
define for this now is in BLI_threads.h, and currently set to 8.
Note that each thread renders an entire tile, and also allocates the
buffers for the tiles, so; more threads might work better with smaller
tiles.
IMPORTANT: node system won't work yet with more than 2 threads! So, don't
try material nodes or compositing with over 2 threads. That I'll commit
later today.
What does work (should work :) is AO and soft shadow now.
Random seeding is still not perfect in render, especially lack of good
thread support still.
- VectorBlur node was calling seed for each exec, causing other nodes to
get fixed random too.
- added seed in non-OSA main loop for render
- use BLI_srandom, is better than BLI_srand
* Add WITH_BF_YAFRAY, which per default is 'true', so no visible changes for developers (and users).
Set WITH_BF_YAFRAY to 'false', and you'll save some major compile time :) Also handy if you're strapped for memory and compilation fails on yafray compilation due
to this.
- this commit also has a few whitespace changes and
- made BF_NO_ELBEEM a proper BoolOption. This will be renamed to WITH_BF_ELBEEM in the near future...
Full log:
http://www.blender3d.org/cms/Irregular_Shadow_Buffe.785.0.html
In short: this is a shadow buffer approach that always results in crispy
shadows, independent of lamp buffer size or zoom level. This shadow buffer
system also supports transparent shadow.
This is part of work on refreshing Shadow Buffers in Blender. You now can
choose of two types (Classical, Irregular). More types will follow. Also
quality issues for Classical shadow buffers are going to be reviewed,
especially to solve the lousy Biasing.
For the CVS log record; it is based on articles:
Gregory Johnson et al, University of Texas, Austin. (Regular grid method).
Timo Aila and Samuli Laine, Helsinki University of Technology. (BSP method).
module itself, replacing the special MEM_mallocT/MEM_freeT functions.
Mutex locking is only enabled when threads are running.
There was no good reason to have these separate, it just led to ugly
hacks when calling functions with non-threadsafe malloc from threads.
When a sequencer has mixed use of 32 bits and float images (note, Scene
strip returns float image too), the old 32 bits image should be freed,
otherwise it keeps saving that image.
- It saves a file with indicated type on each change, with number
appended denoting the current frame (like ANIM saving).
- Output filename button supports relative paths ("//")
- Shows optional preview image too
- For now, added a print on each file save as feedback
To make this option work nicely, changed the BKE_makepicstring() function
to have less globals inside, so it is more generic. Todo: allow amount of
digits in filenames to be set (to support files like tmp_123456.jpg)
Hurmf, then you bring back old backbuffer, and they want to have fields
work on that!
OK... here it is. Although using Compositor features will make this much
easier and advanced to control. :)
Render timers were called in the internal render loops (tile processor),
they still had to be moved to the outer loop, so they include fields/blur
or sequencer render timing correctly.
suffered for the entire movie. :)
It only happened when rendering large frames, using a lot of memory and
typically when you also use other software in meantime.
Reason: the main thread does the drawing updating, while rendering is
still continuing. When using Ztransp, there was a free buffer done
when possibly a draw could still be in progress. Only crashed when drawing
is slow... explaining why it only showed up in more complex cases.
A proper check for the error "No Camera" on rendering can only be made
after a renderwindow was initialized. The error menu then shows in the
render window, which appears to not work OK in windows ATI (again!).
So; I've moved the test to before the renderwindow is activated, this is
not a test checking on the entire render pipeline (like Composite nodes or
sequence strips). In case more complex setups cannot render, an error is
printed in the console only.
Not clearing the value for 'parts rendered' caused 3d previewrender to
sometimes fail doing updates (when an escape happens during converting
render data).
- when renderwin exists, but not used for render, the ESC timer check still
could return ESC event, due to missing flag clearing.
(For example in sequencer, a scene strip did not update on frame advance)
- option 'single layer' set in combination with render "Do Sequence" didn't
free the pushed layers.
Sequencer:
Removing feature that allowed live updates of render progress while using
scene strips. In 2.41 and older this also happens invisible, and ESC from
it works now anyway.
Two reasons:
- it is quite annoying, especially on quit renders
- new 'render to window' conflicts too much with the sequencer window
option that shows previews (in code as well as functional!)
solution could have been much simpler, but since that would have required
altering blender code (only a single line though)...
also fixed a minor bug reported in the yafray forums, when spotlights had the
shadowbuf flag set and then switching to yafray, yafray still rendered
shadows which to user was unexpected since there was no shadow flag enabled
in the yafray lamp panel, so now ignores the blender flag.
In windows, without temp path set, the 'save buffers' render option crashes.
I've coded a blenlib BLI_is_writable(char *filename) to check for such
cases. This is not much needed in Blender, since the open() command is
checked for. However, file saving happens deep inside the C++ exr lib, and
it throws an exception crash when a file cannot be written.
naming convention for Compositing:
- Render Result node -> Render Layers node (name only appears in Add menu)
- Compositor image -> Viewer Node image
I've also added a version patch (2.41 saved files only) to rename existing
"Compositor" Images.
More Sequence render fixes:
- on load of .blend file, with Sequencer invoking a sequence render, the
header window matrix was not set, giving "Insane icon" prints
- option "Do Sequence" had no re-display call in end
Next to the "DispWindow" there are now two new choices:
- Display render output to Image Editor
- Display render output to Screen-sized Image Editor
Both options won't open a 2nd window anymore, which makes work quite more
smooth even, especially because 'focus' isn't lost. Further it fits in the
'single window UI' paradigm of Blender. Should have been done 10 years ago!
Lastly it might bypass issues with X11... having 2 windows with opengl
context is not always stable in Linux.
This option uses an identical trick as for the Compositor viewer, using an
Image block with a fixed name ("Render Result").
The flow, when invoking a Render, goes as follows:
- first it checks if there's an Image Editor visible displaying the "Render
Result", if so then it uses that area-window.
(Use this option for dual-monitor setups for example, a render will always
go to the same location then)
- else it checks if there's an Image Editor open in general, it then
assigns that window the "Render Result" Image.
- else: it searches for the largest Area in the screen, and turns that into
a temporal Image Editor showing render output.
After a render, an ESC will push back the former view, if the Area type has
changed.
Same rules apply for the "Full Screen" option. Here an ESC will always go
back to the regular Screen, and restore Area type if required.
While rendering, the queue for the renderwindow isn't handled yet, so you can
not zoom (nor get full redraws), as for the regular render window.
Existing conflicts:
- in FaceSelect mode, the Image editor enforces to display the face texture
after rendering again.
- when using an Image window for compositing, you'll lose the Viewer output
on a render.
Implementation note:
While rendering updates, nothing is drawn in frontbuffer anymore. That's
good news for b0rked OpenGL drivers (and faster). However, for the few
OpenGL cards that don't do a "swap copy" but a "swap exchange" you get
issues... has to be worked on. I'm afraid we have to drop frontbuffer
drawing altogether.
Other fixes:
- Hotkeys NumPad 1, 2, 4, 8 will set zoom levels (was half coded only?)
Use SHIFT to zoom out (smaller).
- Rendering Tile updates still had draw errors on edges of tiles, in OSA
only. (Caused by commit 4 days ago)
"Backbuf" image render option is back :)
Nicer coded, using Image texture functions.
If you want 100% reliable pixel to pixel accuracy you have to use
compositing. (Old Backbuf didn't do this accuracy either btw).
Uncommitted the feature I added for Plumiferos to be able to render
animated render-borders (which effectively means every frame can be a
different size).
For several reasons;
- it will crash movie rendering (when image sizes differ)
- it forced code to do a full initialize each frame, also for setting the
renderwindow (which popped up on each frame)
- the render pipeline was not designed with per-frame python changes in
mind for image sizes... it uses an "Initialize" stage which is only
called once for an entire sequence.
That latter might be an omission, but for that I better code a new API
call (for use in Python) so a re-init can be enforced.
The old functionality (animated render borders) will still work when you
render in background, using small steps like blender -s 1 -e 5 -a etc.
To enable python to change border while render, I moved the initialize
call inside of the main loop that went over the frames.
Forgot to do move the movie-initialize call as well... which now got
called with zero'ed values.
Thanks Peter Schlaile for the poke!
strand texcoords as orco coords, so yafray doesn't have to be adapted for this.
bugfix #4254 added support for dupligroups, but might not work completely
correct yet at this point, more testing needed.
Also added some missing parts from the code apparently removed at some time.
Mainly having to do with dupliverts, cam.info for aspect ratio/ortho mode/etc.
Header stats (render window) should now work again too.
Fixed missing last tile draw of render window.
Added the missing const_cast in the win32 part of the xml export code.
Changing render settings with python while Anim render now updates display
for each frame. So you can animate render borders, or even save different
sized images.
to take over now, but I'm available for help. Main notes for completing:
- Yafray module uses old global R all over... is now a pointer handle.
It can be temporally bypassed by straight copying, which I do now.
- I am not sure in what pixel format Yafray renders... Blender now only
uses float buffers. In the code, marked with XXX I've added the
rudimentary code for retrieving buffers.
- This integration will skip compositing when Yafray render is used.
This commit brings back:
- Field Render
- MBlur Render (old style)
- Border render with or without cropping
Note: Field Render is not supported in Compositor yet. Blurring or filter
will destroy field information.
Both MotionBlur as Field render are done before Compositing happens.
Fixes:
- The "Save Buffers" option only worked on single frame renders, not for
Anim render.
- Found an un-initalized variable in Render initialize... this might have
caused the unknown random crashes with render.
Code restructure:
Cleaned up names and calls throughout the pipeline, more clearly telling
what goes on in functions.
This is visible in the updated first image of the Wiki doc:
http://mediawiki.blender.org/index.php/BlenderDev/RenderPipeline
- added documentation to Render - saveRenderedImage has an option to save the zbuffer along with the image
(off by default)
- fixed a really annoying runtime error of uninitialized data being passed to a method in pipeline.c during a render
only images input in compositor. Currently still renders in the scene's
own resolution. It also doesn't show scanline/tile updates yet while
rendering.
was required (compositor can also be used with only image input) told
the pipeline not to render when no composite nodes were available at all,
and with button 'Use Nodes' on.
- added a zoom factor for Planar Environment Map, allowing to zoom in or
out on the reflected object. The zoom is corrected when rendering, so it
just gives control over the resolution.
- Planar maps don't cycle anymore, but only render the front plane, using
standard image texture extend mode.
- threaded rendering is back in envmap render