Commit Graph

5305 Commits

Author SHA1 Message Date
05166d0a35 === bugfix ===
Fixing case where BLI_make_file_string reads one byte before passed in string when the string is empty.
Leftover from patch tracker item #2740 - thanks Andrew Zabolotny.
Also fixed the part that made sure exactly one slash is appended at the end of the dir - comment wasn't telling what the code did here :)
2006-02-11 15:02:23 +00:00
fbbe5925ff Two significant improvements in vectorblur:
1) Accumulation buffer alpha handling
Accumulating colors in an accumulation is simple; a weighting factor can
make sure colors don't over- or undersaturate.
For alpha this is a bit more complex... especially because the masks for
vectorblur are anti-aliased themselves with alpha values. Up to now I just
premultiplied the mask-alpha with the actual color alpha, which worked OK
for solid masks, but not for transparent ones. I thought that would be an
acceptable situation, since 'ztra' faces only get blurred with alpha==1.

However, it gives bad results when using 'mist' in Blender, which just
gives pixels an alpha value based on camera distance. In these cases the
alpha became oversaturated, accumulating into too high values.

The solution is to store the mask-alpha separately, only premultiply this
alpha with the weighting factor to define the accumulation amount.
This is the math:

blendfactor: the accumulation factor for a vectorblur pass
passRGBA: color and alpha value of the current to be accumulated pass
accRGBA: color and alpha value of accumulation buffer (initialized
         with original picture values)
maskA: the mask's alpha itself

accRGBA = (1 - maskA*blendfactor)*accRGBA + (maskA*blendfactor)*passRGBA

This formula accumulates alpha values equally to colors, only using the
mask-alpha as 'alpha-over' operation.
It all sounds very logical, I just write this extensive log because I
couldn't find any technical doc about this case. :)

2) Creating efficient masks with camera-shake

Vector blur can only work well when there's a clear distinction between
what moves, and what doesn't move. This you can solve for example by
rendering complex scenes in multiple layers. This isn't always easy, or
just a lot of work. Especially when the camera itself moves, the mask
created by the vectorblur code becomes the entire image.
A very simple solution is to introduce a small threshold for
moving pixels, which can efficiently separate the hardly-moving pixels
from the moving ones, and thus create nice looking masks.

You can find this new option in the VectorBlur node, as 'min speed'.
This mimimum speed is in pixel units. A value of just 3 will already
clearly separate the background from foreground.
Note; to make this work OK, all vectors in an image are scaled 3 pixels
smaller, to ensure everything keeps looking coherent.

Test renders; 'Elephants Dream' scene with lotsof moving parts; rendered
without OSA, image textures, shadow or color correction.

No vectorblur:
http://www.blender.org/bf/vblur.jpg

With vectorblur, showing the alpha-saturation for mist:
http://www.blender.org/bf/vblur1.jpg

New accumulation formula:
http://www.blender.org/bf/vblur2.jpg

Same image, but now with a 3 pixel minimum speed threshold:
http://www.blender.org/bf/vblur3.jpg

Next frame, without minimum speed
http://www.blender.org/bf/vblur4.jpg

Same frame with speed threshold:
http://www.blender.org/bf/vblur5.jpg

(Only 20 steps of vectorblur were applied for clarity).
2006-02-11 13:23:08 +00:00
a0569049ac Potential ugly bugfix in MEM_cache; the function
int IMB_cache_limiter_get_refcount()

Did not return a value at all. Any compiler should flag big warnings for
this btw... tsk tsk!
2006-02-11 12:45:32 +00:00
85afaeaf78 Applying patch #3826
smooth and bevel shortcuts listed in menus and toolbox were incorrect.

no new functionality
2006-02-11 12:07:55 +00:00
11adcb6cf2 ABF Fix:
With two adjacent quads sharing three vertices, splitting to triangles
could create duplicate triangles. This broke unwrapping of Suzanne near
the nose, where there is a sort of t-joint with quads that isn't really
a t-joint. Now works fine:
http://users.pandora.be/blendix/suzanne.png
2006-02-11 12:04:16 +00:00
c85abd748f i have a file running into this check causing a 'hang' without
may be it's a development hick up .. still i think that error trap should be there
2006-02-10 23:47:40 +00:00
ee4c7ef22a Added ability to render Zbuffer to an image.
Just use SHIFT-F3 and save an image.

	Basically all this does is copy the zbuffer to a new Image buffer
	and pass that to the save image function.

Sample output:
	http://www.cs.umn.edu/~mein/blender/kungfu_zbuf255.jpg

	Also thanks to Jesterking for helping me debug dumbness... ;)
	and the nice screenshot.

Kent
2006-02-10 21:10:58 +00:00
b9425b2a35 Interesting commit for artists using huge textures;
The code that generated mipmaps took a real long time to do it... on a
5k x 5k image it took here (no optim, debug compile) 32.5 sec.

Recoded the very old filtering routine, which already brought it down to
2.8 seconds. Then tested if we even need this filtering... in many cases
the images are painted or photographs, which is filtered OK already.
Without the filter, the mipmap timing went down to 0.39 second. :)

http://www.blender.org/bf/filters/index1.html

Here's an example of two 'mips' generated with or without gauss filter.
Note that aliasing in an image remains there... which can be a wanted
effect anyway.

So; added the gauss filter as option in making mipmaps. Also had to
reshuffle the buttons there in a more logical manner.
There's also disabled code in the do_versions to set 'gauss' on in older
files. Will be enabled during release time.
2006-02-10 18:57:52 +00:00
945484e92a Upgrade for Node type definitions: the min/max allowed values for input
sockets were not used yet... now they're verified on read, and written
in socket stack data on adding new nodes.
Also the buttons in Nodes use these values now. Special request from
Nathan Vegdahl who seems to be messing around with my precious nodes! :)
2006-02-10 13:57:30 +00:00
24694229b1 Faceselect mode fixes:
- Don't allow entering faceselect mode on a linked mesh (only checked object).
- Enable drawing of seams after ctrl+E seam marking.
2006-02-10 13:37:06 +00:00
Ken Hughes
83ea72de1a ===Python API===
Three more changes for the Mesh module:
(1) Bug fix for UV vertices ("sticky").  me->msticky was not being updated
   when vertices were added or deleted from the mesh.
(2) Vertex, edge and face .extend() methods accept zero-length sequences
   instead of throwing an exception.  (Note that not giving any argument
   is still an error).
(3) Edge and face .extend() methods ignore "invalid" edges or faces which
   have the same vertex twice instead of throwing an exception.  Cam and I
   argued about this for a while... :-)

Ken
2006-02-10 00:08:06 +00:00
5418969adf Testing commit for the studio; a bump-correction factor for when images
get sampled on larger distance. It actually just flattens bump when the
sampled area is (much) larger than pixel size, to prevent weird things
like:

current render:
http://www.blender.org/bf/b1.jpg

distance corrected:
http://www.blender.org/bf/b2.jpg

(image based on Alexander file :)

Tested on env's dinos too... seems to work, but we'll see.
2006-02-09 23:45:28 +00:00
56378eedff Addition to previous commit: disabling RenderLayer "Halo" did not skip
lamphalo rendering yet... silly me!
2006-02-09 22:56:08 +00:00
b22c846330 Tweaks in RenderLayer rendering:
- LampHalos can be rendered separately too. Just disable 'Solid' in a
  layer and keep 'Halo' option enabled.
- Note that disabling 'Solid' will still fill in Z values for the solid
  faces, to provide occlusion information for the Ztransp and Halo layer
  options. The latter didn't work this way until now for OSA render.

ALso note that that Ztransp+LampHalo still isn't good marriage... it
renders a bit weird, but that's an old issue. :)
2006-02-09 22:33:49 +00:00
9c003086fe Potential thread render bug/crashing:
Discovered I forget to re-enable the 'imbuf load' and 'envmap' mutexes.
2006-02-09 19:58:32 +00:00
5e3d30c276 Feature:
- Appending Images now re-assigns relative paths, to match with the file
  as currently being used

Bugfix:
- Memory error in creating preview render rects... gave no issues here,
  but i guess that's not saying anything! Hope its more stable now. :)
2006-02-09 19:47:53 +00:00
7eba749401 Made exr saving respect the 'RGB' or 'RGBA' setting in render output
panel. Saves a whopping 25% filesize!
2006-02-09 18:55:14 +00:00
8ef7688266 The preview-jpg option for rendering exr files was saving 32 bits jpg...
a weird format only blender can read properly. Made it 24 bits.

Also: fixed very weird line-endings in pipeline.c after schlaile's last
commit here.
2006-02-09 18:48:53 +00:00
1516350502 Further tweak of Vector Blur and alpha;
- it now correctly pre-multiplies with alpha the RGB values for the
  antialised mask (alpha artefacts were visible)
- The transparent layer will add speed vectors on top of the solid layer,
  cancelling out cases where the solid layer was not moving (like in its
  own antialising.
  This works fine, for as long you don't render in a single pass trans-
  parent faces that move on top of not-moving solid faces.
2006-02-09 17:37:22 +00:00
bb6b1d82cf Added "select same group" to select group menu. 2006-02-09 15:14:19 +00:00
3291adc997 Compositing workflow upgrade;
You now can set a Preview panel in the Image window, to define a sub-rect
of an image to be processed. Works like the preview in 3D Window. Just
press SHIFT+P to get it activated. Very nice speedup!

This is how it works:

- The compositor still uses the scene image size (including % setting) for
  Viewer or Composite output size
- If a preview exists, it calculates the cropped rect from its position
  in the Image window, and stores that in the Scene render data
- On composite execute, it copies only this part from the 'generator nodes',
  right now Images or Render Results. That makes the entire composite tree
  only using small rects, so it will execute fast.
- Also the render window will only display the cropped rect, and on F12
  only the cropped part is being executed
- On rendering in background mode, the cropping is ignored though.

Usability notes:

- translating or zooming view will automatically invoke a recalculation
- if you zoom in on details, the calculated rect will even become smaller
- only one Imagewindow can have this Preview Panel, to prevent conflicts of
  what the cropped area should be. Compositing is on Scene level, not local
  per image window. (Note; 3D Previews are local per window!)
- Closing the preview panel will invoke a full-size recalculation
- All passes/layers from rendering are nicely cropped, including Z and
  vectors.

The work to make the compositor do cropping was simple, but getting the
Image window displaying correctly and get all events OK was a lot of work...
indeed, we need to refactor Image Window usage once. Sorry for making the
mess even bigger now. :) I've tried not to interfere with UV edit or Paint
though... only when you're in compositing mode the panel will work.

BUG fix:

3D Preview render didn't work when multiple layers were set in the current
scene.
2006-02-09 11:07:04 +00:00
Stephen Swaney
6ca0a74b86 add #include <sys/time.h> to get declaration of struct timeval on
loonix for that ${BADWORD} webserver thingie.
2006-02-08 23:00:34 +00:00
3bd2066221 Changed Composit Composite.
(Voted on #blendercoders and did some websearching and it seems like
this is more correct.)

Kent
2006-02-08 22:04:54 +00:00
3753d817ab Seam Cutting in Faceselect Mode:
- Mark Border Seam: mark edges on the border of face selection as seam.
- Clear Seam: clears seams in selected faces.
Hotkey: Ctrl+E

- Alt+RMB Click: mark/clear edge as seam
- Alt+Shift+RMB Click: mark/clear seams along the shortest/straightest path
  from last marked seam. The cost of the path also includes some measure of
  'straightness' next to the typical distance to make things work more
  predicatble and edgeloop friendly. Note that this cuts a path from edge to
  edge, not vertex to vertex. That gives some nice control over the direction
  of the seam.

Also includes:

- Removed old LSCM code.
- Fix updates glitches with DerivedMesh/Subsurf drawing in FaceSelect mode.
  Now there's a drawMappedFacesTex instead of drawFacesTex.
- Minimize Stretch menu entry called Limit Stitch.
- Removed the lasttface global, was being set before it was used anyway, so
  might as wel return from a function.
- Moved some backbuf sampling code to drawview.c from editmesh, so it can be
  used by Faceselect and VPaint.
- Use BLI_heap in parametrizer.c.
2006-02-08 21:01:00 +00:00
eb42008067 Upgraded max limit for faces in render. Up to now, quads were zbuffered
as triangles, with a tag bit to denote which triangle was which part of
the quad. That was hardcoded bit 0x800000, which allows a maximum of
about 8 million quads...

I've made this a nice #define, set to be 16 times larger. So, now the
facejunkies can go up to 128 Million faces, were it not that this will eat
up a load of memory!
I only have 1 Gig in this machine. A test with 9M vertices and 7.5M quads
eats up 912 MB of memory already. If this becomes a real issue, I know
tricks how to make the vertices 20 bytes smaller, and faces 4 bytes, which
would in the above case save about 200 MB. Not much... but probably worth
the try? A much better method is of course 'bucketing' the renderdata per
tile. It's a spec of the render recode, but not a quicky to add.

Also: bug fix in curve code. There was a short counter still, crashing on
large curves with resol set to 1024 :)
2006-02-08 18:28:28 +00:00
7861ae53cc A Heap / Priority Queue ADT, will be used for Dijkstra shortest path. 2006-02-08 18:06:35 +00:00
919411a32b Three fixes;
- Composit cache now gets fully freed on a render. Each output socket of a
  node stores the entire image... and while render that's a waste of memory

- Sky 'paper' render was using wrong texture coordinates

- Found missing test_break() in ztransp rendering.
2006-02-08 17:30:28 +00:00
a3d0d456ac More things for easying the job of replacing proxy/working armatures in the scenes of Elephants Dream with the final ones: 1) adds removing Fakeusers from Actions to PyAPI, now with a hackish call in the Blender module. Possibility of better ways should be discussed on bf-python. 2) adds BPY Object.copyNLA(otherob) - that was simple 'cause the copy_nla function was nicely in kernel nla.c. 3) Object.convertActionToStrip(), here it gets tricky: the function to convert the active action of an object to a NLA strip was buried inside the respective function in the GUI editnla.c which had also code for reading mouse coordinates and whatnot. So I took the actual copying out of it and moved it to the kernel nla.c as a new function, bActionStrip *convert_action_to_strip (Object *ob). that code used other functions, of which find_stridechannel() was also in editnla.c but free of UI code so i moved it to kernel too. kept things with UI code in editnla.c. tried to be careful with keeping mallocs and the pointer business intact, and tested that this works and after usage Blender gives no memory warnings or anything, so seems ok - but certainly is best reviewed by ppl more active with c coding than me. hopefully this little refactor makes it possible to add this function to the menus too, which was not straightforward earlier when Matt took a look at it. 2006-02-08 16:58:12 +00:00
839b338be3 New:
- ZTransp render now also delivers Z values and Speed vectors in passes
  Note that speed vectors accumulate within a pixel to store the minimum,
  so rendering ztransp on top of a non-moving plane won't give speed...
  Best results you get is by rendering it in a separate layer.

  The Z value stored is the closest visible transparent face in the pixel.

Fixes:

- Render to 'spare page' has been enabled again. Because of the strict
  separation of Render and UI, but especially because a 'render result' now
  can consist of unlimited images, I've not made this a Render feature.
  Instead, the render-window itself stores the 'spare' image... I also
  had to change the convention for it a bit.

  Now, instead of having two "render buffers" (which was a render feature),
  the RenderWindow will store each previous frame on a re-render. This
  storing will only start after you've pressed 'Jkey' once, but then always
  will happen for as long the rendered image is same size as previously.
  For clarity, I've also renamed the window title, to 'previous frame'.

- RenderWindow shows alpha again on Akey

- Display of the Zvalues in ImageWindow has been tweaked. White now denotes
  closest, and the color range goes from camera clip-sta to clip-end.

- Bugfix: on splitting/merging/duplicating windows, the 3D Previewrender was
  not always freed correctly, potentially causing crashes or memory leaks.
2006-02-08 16:51:09 +00:00
06b432dfa4 Changed MEM_freeN(nu->knotsu);
to..
if (nu->knotsu) MEM_freeN(nu->knotsu);
Python created curves have nu->knotsu set to zero and was throwing.
  Memoryblock free: attempt to free NULL pointer
2006-02-08 12:52:57 +00:00
f5a22bc937 - Autosmooth now calculates smoothing based on original object-space
vertex locations, not global coordinates. This ensures consistant
  autosmoothing for each frame. Also fixes missing vectorblur for parts.

  Nice task for a dev: put autosmooth code in end of modifier stack... then
  it also shows in 3D window

- BUG FIX! I noticed the last tile rendered quite slow, and even did not
  update scanlines. Found out that the main tiles processor didn't go
  to sleep when the last tile was rendered, because it detected a free
  possible thread. This caused the main thread to go into a very tight
  loop, eating up a lot of cpu and blocking the other thread.
2006-02-08 10:57:48 +00:00
Nathan Letwory
57c5db681e ==SCons==
* 'scons blenderplayer' links the blenderplayer now correctly also on win32-vc.
  If the OS X-folks can verify the linking of the blenderplayer too, we'd have
  much of the needed work done.
2006-02-07 22:24:41 +00:00
Nathan Letwory
3ab31078df ==SCons==
* The only lib that needs change in more than one place (two), and I forgot
  that, of course.
2006-02-07 21:47:11 +00:00
Nathan Letwory
ef1b7a5735 ==SCons==
+ 'scons blenderplayer' builds blender AND blenderplayer now (tested on Linux
  only, but was only linking issue, so should work on other platforms too).

  NOTE: I noticed some compileflags for GE specific libs that were left out -
  I re-enabled them in the SConscripts, but I'm going to do a test build my-
  self now, so if there are problems with them on win32, I probably already
  know about them :)
2006-02-07 21:24:36 +00:00
78c87abeed Wanted feature for curves: a render-time resolution. This option is
located under the 'def resolu' button. If not zero, it assigns this
resolution to a curve on render.
Also copies with ctrl+c menu.
2006-02-07 19:59:02 +00:00
0b1cf0a01f Add the WITH_OPENEXR to sconscript. I needed this for toni's latest SceneRender stuff to work. Strange that it worked ok on his computer without this. 2006-02-07 19:04:24 +00:00
3fe6fca3f6 additions to make the orange rendering preparation script work, sorry undocumented again (we are testing this now and gotta commit to get this to other compus at studio, Stivs make a note to bug me about the doc or someone add it.. :o) 2006-02-07 18:33:01 +00:00
617b7b00ca Further tweaking group appending...
Previous commits attempted to link objects in a group to the scene, when
appending the group. Unfortunately... a single append then also linked
objects from previously linked groups. This is still a bit messy, mostly
caused by the way how appending now is coded.

At least things work as expected now!
2006-02-07 18:32:04 +00:00
59d67818e1 Orange-reported vectorblur bug: when using autosmooth, the amount of
vertices differed on previous/next frame, causing speedvector calculus
to be skipped.
Now that worked OK, where it not that non-existing speed vectors were not
initialized zero while rendering...

Also another issue showed up with autosmooth. When using exact smooth
angles (like 30 degrees) on a model that has been spinned with exactly
30 degree steps, the autosmooth gave different results on each frame...
and only when compiled in O2 (probably thats doing bad float rounding).

Solved this by just adding 0.1 to the user defined smooth angle.
2006-02-07 17:44:02 +00:00
e4a0390b39 Group Nodes made functional: each group now can be re-used (instanced)
with SHIFT+G. This works as well for local groups as library-linked
groups.

Also fixed that group nodes were copying internal data to the outside,
which made it impossible to use the socket-buttons to set individual
values for each group-instance.

Library-linked groups are prevented from editing. But, try to open a
group and it will give a request for 'make local'. The make local rule
is identical to other library data in blender, meaning:
- if all users of the library data are local -> the library data is
  flagged 'local', and if needed a unique name is made
- if there's mixed users (local and from other library data) it makes
  a full copy, and assigns this copy to all local users.
2006-02-07 15:50:55 +00:00
03ae9e70b8 * If an empty is a forcefield, scale the 3D forcefield shape with the empty drawsize 2006-02-07 13:05:17 +00:00
47054d00e6 Added "Blur factor" button in Vector Blur node, which scales the speed
vectors. It's actually shutter speed, but in this case works identical to
the old motionblur 'blur fac' button.

Note; the "Max Speed" button only clips speed, use this to prevent
extreme speed values. Max speed applied before the scaling happens.
2006-02-07 11:39:26 +00:00
Chris Want
2c35988fcb Needed to add zbuf_accumulate_vecblur() to the stubs.c for correct
linking of the blenderplayer.
2006-02-07 03:37:35 +00:00
f45546a1d3 iImage based Vector Blur
After a couple of experiments with variable blur filters, I tried
a more interesting, and who knows... original approach. :)

First watch results here:
http://www.blender.org/bf/rt0001_0030.avi
http://www.blender.org/bf/hand0001_0060.avi

These are the steps in producing such results:

- In preprocess, the speed vectors to previous and next frame are
  calculated. Speed vectors are screen-aligned and in pixel size.
- while rendering, these vectors get calculated per sample, and
  accumulated in the vector buffer checking for "minimum speed".
  (on start the vector buffer is initialized on max speed).

- After render:
- The entire image, all pixels, then is converted to quad polygons.
- Also the z value of the pixels is assigned to the polygons
- The vertices for the quads use averaged speed vectors (of the 4
  corner faces), using a 'minimum but non-zero' speed rule.

  This minimal speed trick works very well to prevent 'tearing' apart
  when multiple faces move in different directions in a pixel, or to
  be able to separate moving pixels clearly from non-moving ones

- So, now we have a sort of 'mask' of quad polygons. The previous steps
  guaranteed that this mask doesn't have antialias color info, and has
  speed vectors that ensure individual parts to move nicely without
  tearing effects. The Z allows multiple layers of moving masks.

- Then, in temporal buffer, faces get tagged if they move or not
- These tags then go to an anti-alias routine, which assigns alpha
  values to edge faces, based on the method we used in past to antialias
  bitmaps (still in our code, check the antialias.c in imbuf!)

- finally, the tag buffer is used to tag which z values of the original
  image have to be included (to allow blur go behind stuff).

- OK, now we're ready for accumulating! In a loop, all faces then get
  drawn (with zbuffer) with increasing influence of their speed vectors.
  The resulting image then is accumulated on top of the original with a
  decreasing weighting value.

It sounds all quite complex... but the speed is still encouraging. Above
images have 64 mblur steps, which takes about 1-3 seconds per frame.

Usage notes:

- Make sure the render-layer has passes 'Vector' and 'Z' on.
- add in Compositor the VectorBlur node, and connect the image, Z and
  speed to the inputs.
- The node allows to set amount of steps (10 steps = 10 forward, 10 back).
  and to set a maximum speed in pixels... to prevent extreme moving things
  to blur too wide.
2006-02-06 22:11:50 +00:00
4c59280ed8 ABF:
- Improved splitting of quads, which helps to avoid some degenerate triangles.
- Also improvements to choosing pins to preserve symmetry better in a few
  typical cases.
2006-02-06 20:24:15 +00:00
93dee282be Sky textures were using wrong pixel-size vectors, so images got sampled
totally blurred.

Thanks plumiferos team for the poke!
2006-02-06 19:29:37 +00:00
b5cbd1c4e6 Fixed problem spottet by Ken Hughes, that prevented FFMPEG-output with
NTSC target from working (floating point exception).
Fixes bug #3879 from the bug tracker.
2006-02-06 19:27:24 +00:00
605a645e2c Quite weird... I recall I fixed it, then it came back again.
Vertex selection (mesh edit) was using a short to calculate distances,
which can overflow with vertices outside of view.
2006-02-06 17:45:43 +00:00
6f3c9c4275 Inserting keypositions for a constraint which is part of action that's
part of action strip... now is corrected for action strip offset.
2006-02-06 13:56:47 +00:00
1c89675a3a Tweaked library link/append rules for groups a bit further;
- append group: appends group + puts objects in scene
- link group: only links group, doesn't put objects in scene

- append particle system with group: appends group + objects in scene
- link particle system with group: only links group
2006-02-06 13:00:42 +00:00