Commit Graph

300 Commits

Author SHA1 Message Date
fbc743f332 fix .. hum not really a bug but waste of CPU
remove 6 multiplications and one square root in core spring calculation .. called for every solver step try
2007-12-27 22:48:30 +00:00
7da56f4a9b Particles
=========

Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:

- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.

.. and lots of other things, some more info is here:

http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc

The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.

Point Cache
===========

The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.

See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint

Documentation
=============

These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
fd3764f9a4 = Fix for softbody collision mode selector =
This commit makes all softbody collision modes work as they should.

Thanks to Genscher for noticing the issue.

bjornmose, please check this commit.
2007-11-16 12:23:00 +00:00
e448f20db5 Routine purge of compiler warnings. Yet again, they were mostly uninitialised vars. 2007-10-29 05:59:26 +00:00
d407f5ae81 added point to edge collision in case point to face missed
/* special hidden feature! shrink to fit */
if (G.rt > 500){
	scale = (G.rt - 500) / 100.0f;
}
-- shrink a T shirt to fit .. evil grin
-- by the way i did set up the rule 'if any *outer object* hits no *inner* will be regarded' ... pretty poor IMHO .. well but it works
2007-10-18 22:47:55 +00:00
c4114780d4 Little code cleanup.
bsystem_time was being called with an extra variable, which was useless. Most of the places that called it, were passing NULL for that variable anyway.

I've also cleaned up that function a bit, but the underlying problems with that part of the code still exist (EVIL GLOBALS that are exported for frame_to_float), for mblur and fields rendering features. That remains for another time.
2007-08-05 09:21:29 +00:00
afdd54fa37 moved source and text to american spelling
* colour -> color
* centre -> center
* normalise -> normalize
* modelling -> modeling
2007-04-04 13:18:41 +00:00
Ken Hughes
115b65ce7c Fix numerous gcc warnings. 2007-03-16 05:03:38 +00:00
4f8079d49c Modifier Stack: Limit calculation to required data.
This commit upgrades the modifier stack to only calculate the data which is
needed, either by modifiers further down the stack or by other functions at
the end of the stack (e.g. drawing functions).

This speeds up modifier stack recalculation, especially where vertex
groups and UV coordinates are concerned. For example, a mesh with an Armature
modifier followed by a Subsurf modifier would previously have required the
Subsurf modifier to interpolate all the vertex groups in the mesh, slowing
down modifier calculations considerably. With this update, vertex group data
is not propagated beyond the Armature modifier, so calculations are faster.

Note that this depends on the order of modifiers in the stack. If the Armature
and Subsurf modifiers were swapped in the above example, the Subsurf modifier
would have to interpolate vertex groups, as they are needed by the Armature
modifier.
2006-12-05 17:42:03 +00:00
08ef0d3466 Klocwork warning fix
Doing NULL pointer paranoia check in time.
It's completely pointless calling the function with null pointer,
but who knows.
At least it does not crash then.
2006-12-02 18:42:20 +00:00
40c5b56707 softbodies
nice little 'debug' feature
SHIFT_ESC breaks baking without throwing away the baked keys
so you can check the solution calculated so far
baked sb replay checks for NULL pointers in keys -> motion will stop there
even saving and loading to file works here,
but i would not expect it to do so
humm .. may be i'll add a dirty flag for that
2006-11-23 20:31:46 +00:00
731e7e3915 having a nice break/esc behavior on bake
other occasions like ALT_A needs that too
2006-11-20 22:27:05 +00:00
228b94dc89 softbody bugfix
evil typo causing crashes
2006-11-20 09:19:14 +00:00
e435fbc3c5 Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.

Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData


Replaced TFace by MTFace:

This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.


Removed DispListMesh:

This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.


Removed ssDM and meshDM DerivedMesh backends:

The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.


This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
85615f7ac8 More Softbodies
Added a less 'strict' solver step size control.
Cuts down needed loops to a 1/5 in 'regular' collision situations.
So why be a maths smartass when we want to do a skirt in a breeze :)
Is on by default, old mode can be turned on with the 'O' button beside the RK-limit.

Some minor fixes to the UI
2006-11-16 20:57:02 +00:00
9e717b59cb softbody review
1. UI review -> disabeling options when not available .. giving hints why ( even tried to give usefull tooltips )
1.1 give some more user control to the solving process  (mins,maxs).. optional feedback on the console

2. replacing ugly object level 'sumohandle' with SB (private runtime) level/pointer 'scratch'
which holds runtime data like cached collider data and more .. and it's thread save this way :)

3.related no 2.  write a 'private' history of collision objects to ease the 'fast' collider tunneling syndrome'

4. some <clean> optimizations, 3-BSP for self collision,  general AABB checking before ever going to collision details

5. some <dirty>  ( in the sense of do some inacurate physics noone ever will see ) little tricks to make things faster .. ..fuzzy collision situation bypass .. forward collision resolution
2006-11-10 23:09:16 +00:00
587d24bb42 stupid typo spoiling adaptive step sizes in heun solver 2006-11-04 15:53:47 +00:00
52c20fecba softbody update -> self collision search takes 1/3 of the time here
this one should work nice -->
http://www.wund.homepage.t-online.de/hidden/sb_col_must_3_0.blend
2006-10-30 22:47:41 +00:00
5376df2689 Fixed all gcc 4 warnings in blenkernel. Found 2 potentially harmful
unintialized variables in the verse code, verse_session.c:451 and
verse_object_node.c:339, those are properly initialized now.
2006-10-26 23:34:44 +00:00
88455e8d5c bug fix
in softbody aerodynamics
(should zero a vector which is only added to in function call)
thanks michael
2006-10-20 23:02:47 +00:00
57f01fdb46 more softbody goodies:
SB collision targets may be picked up from modifier stack
works fine with static targets having subsurf and/or array mofifiers
see-->
http://www.wund.homepage.t-online.de/hidden/Mstack.blend
http://www.wund.homepage.t-online.de/hidden/Mstack_II.blend

however when calulating the SB object dynamics the vertices of the
'deform only' m-stack result are used

so SB <-> SB may look strange
subsuf modifier is applied to SB object after doing SB dynamics
(that is: colliding mesh is subsurfed, SB is not )
subsurfed SB cubes colliding
link --> http://www.wund.homepage.t-online.de/hidden/ColSelfMod.blend

or may give unwanted results
subsuf and array modifier is applied to SB object after doing SB dynamics
link --> http://www.wund.homepage.t-online.de/hidden/ColSelfMod_nobug.blend

last, modifiers that change vertex locations in time (like waves)
suffer from not beeing seen at needed time resolution
(SBs see colliders static in a frame)
well but that's beyond the limits of the current dep-graph use
and needs to be resolved on design level

anyhoo have fun
BM
2006-10-19 22:01:06 +00:00
f0fbffcd59 made a nice new softbody II panel on UI to keep things usable (logic wise)
- failed on final alinignment issues may be matt can give a helping hand ? :)
2006-10-17 22:03:32 +00:00
03be45c8c0 softbodies again
unnesting aerodynamics from edge collision
cleaning up softbody.c
that is:
removing old todos in comments
adding some new :)
2006-10-14 19:03:06 +00:00
babb95c3e0 softbody update
nicer kinematics in self collision -> blending to complete inelastic impact
now does something close to real physics

first steps towards aerodynamics
anisotropic friction
springs 'see' their movement in media
--> see surrrounding  media does not move and/or reacts on wind
(*for now  needs to have a pseudo collider araound  -> that is: add a cube in the same layer
and make it a deflector  *)
2006-10-13 21:27:43 +00:00
80aa6fe5fb softbodies
-seld collision adding fine control to UI
-cleaning up code
volatile test file again
http://www.wund.homepage.t-online.de/hidden/sb_col_must_2_0.blend
2006-10-11 22:53:22 +00:00
b6b5cdefa9 some tiny changes to the softbody system
- UI for self collision ball size definition
- edge collision mode added (almost a bug fix)
volatile test file -->
http://www.wund.homepage.t-online.de/hidden/sb_col_must_1_2.blend
2006-10-10 21:49:02 +00:00
aaaae78527 removing self collision for curves
just did a few tests, with the 'surprising' result that balls are not curves ..
and i don't want to be swamped by bug reports tellling me
'it does not collide as i whised it would'
2006-10-05 21:30:55 +00:00
f2d27eb4cb bug fix
only alow self collision for suited objects

feature request from hairdressers
self collision for curves
works amazingly well if you keep in mind there balls around vertices colliding
2006-10-05 17:46:01 +00:00
21d6b199ab softbody self collision
ironing out a few glitches related to goal pinning
volatile test blend ->
http://www.wund.homepage.t-online.de/hidden/sb_col_must.blend
+ adding a few alternative collision ball calculation algos
since i did not want to blow up (waste)  DNA space without need,
coded as -1.0 -0.1 -1.1 values in 'ball size' (look at tooltip popup)
2006-10-04 21:36:55 +00:00
c903e2c07b -bug fix
sometimes goal pinned vertices were omitted by self collision
2006-10-03 12:12:24 +00:00
1ace6ec0ef softbody panel cosmetics
and a forgotten debug print .. tsk
2006-10-02 17:05:56 +00:00
ab92fca306 softbodies
mostly reshuffeling UI to have things where i'd expect them to be
2006-10-01 21:49:10 +00:00
8e7b403924 new softbody feature:
simple (naive) self collision
estimates a collision ball
using the spring lenght to attached neighbours
(idea stolen from old cloth modifier files, but i'm sure ZAZ and genscher won't mind)
-- usefull for untangeling static cloth like objects
-- may be used for cloth simulation with known limitations
like 'tunnel effect' if objects are moving too fast ...

demo -- volatile files
http://www.wund.homepage.t-online.de/hidden/sb_without_selfcol.avi
http://www.wund.homepage.t-online.de/hidden/sb_with_selfcoll.avi

have fun
BM
2006-09-28 20:27:46 +00:00
2d11fbe192 fix for homegrown bug in softbody rigidity
springs inserted twice caused unreal stiffness in ODEs
-> bad performance killers
2006-09-27 06:59:27 +00:00
d8874df09c New softbody option: adjustable rigidity.
Gives local structure stability for though fabrics, thin steelplates ..
even suzanne gets pretty crash resistant that way.
If non zero it not only adds diagonals but all other "2edge-wide" springs
so it somehow replaces stiff quads for meshes too.
2006-09-26 12:53:57 +00:00
4603f452c2 Animation department feature request: support for vertex groups in Lattices
In a quick glance: (temp image)
http://www.blender.org/bf/rt.png

Main reason is that Lattices are useful a lot for Armature deformation.
Lattices just provide much more precise and interesting control. However,
with only bone envelopes it's very hard to use.

Working with Lattice vertex groups is nearly identical to Mesh:
- on CTRL+P 'make parent' you can choose the deform option now
- In editmode, the buttons to control vertex groups are available
- In outliner you can select vertexgroups too
- Deforming Lattices with Armatures has all options as for Mesh now.

Note:
- No WeightPaint has been added yet. To compensate, the editmode
  drawing for a Lattice with vertex group shows weight values for the active
  vertex group.
- Lattice editmode doesn't undo/redo weight editing yet.
- Softbody for Lattice still uses own vertex weights

Implementation notes:
- derivedmesh weight_to_rgb() is now exported to drawobject.c
- been doing cleanups in code (order of includes, var declarations, etc)
- weightpaint button handling now is generic

I've checked on Brecht's proposal for Custom Element data;
http://mediawiki.blender.org/index.php/BlenderDev/CustomElementData
It could have been used, but that would mean the existing code for
vertexgroup handling and armature deform couldn't be re-used. I guess this
is really a later todo.
2006-09-03 12:16:14 +00:00
5d1f64fc19 Bugfix: Sofbody baking included the 'start frame' for the object in
calculus, causing empty keys in the bake, and crashes.
2006-03-08 17:00:48 +00:00
a85d160a3e Feature: Sofbody bake "Local"
Sofbody simulation happens in global coordinate space, and this was also
used for baking softbodies. Too bad you cannot re-use or further animate
the baked softbody then... :)

If you now use the new "Local" button in the Bake menu, it will allow to
animate or move the baked object.
2006-03-01 23:45:25 +00:00
ff830a98f4 Dangerous typo in softbody.c... a missing '/' made a /* */ comment to
disable the entire next line of code too.
2006-02-14 11:30:43 +00:00
93de82c3d9 removing dead experimental code 2006-02-01 09:46:34 +00:00
a9077e3582 WIP
-- fast softbody collision /* caching colliding objects & some global bounding boxes */
-- to compare .. set rt to 666
2006-01-31 22:48:41 +00:00
d024452ebf Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.

Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
  groups.
- In Object buttons, a new (should become first) Panel was added, showing
  not only Object "ID button" and Parent, but also the Groups the Object
  Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
  temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group

But, the real power of groups is in the following features:

-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).

-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).

-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)

-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).

-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!

In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
ec2644fe5c Bugfix - own repertoire :)
- Curves without bevel or extrude didn't calculate the Z value for
  softbody when the "3d" option for curves was off.
- Typo in softbody.c, for switch of // comments to /* */
2005-11-30 18:58:10 +00:00
b6c5b24f4f no code changes (i hope)
review of lyrics/epics to replace '//' comments by /*ones*/
+ adaptive step size in a nutshell  comment
2005-11-19 21:35:06 +00:00
54c032440f bug: scaled lattice softbodies ( and the new ones ) shrinked/blew up to original size under SB dynamics
had a shadow in memory there was an issue ..
yes, spring calculation should care for scaling in object matrix
so here it is

note: for meshes the bp array is abused for caching -->
only 1 matrix multiplication compared to 2 per spring
2005-11-19 20:02:30 +00:00
dfb200d405 Made sure lattice and curve springs are calculated based on the original
(Non deformed) lenghts. Code for lattice (by Jens Ole) was already there
btw, was replaced accidentally by Daniel during his modifier craze :)

ALso added comments in code to clarify the softbody initialize flow, which
happens in 2 stages now. Goal weights and springs are read from the
original data, the vertex coordinates from the modifier data.
2005-11-19 18:19:41 +00:00
502fc2da31 One visit to studio orange, and voila a todo list!
- bug: posemode, bones were drawing names and axes even when hidden
- bug: using softbody guides actually worked on themselves, causing
  an infinite loop
- feature: when a pose/bone is completely locked for transform, a grab
  will change into rotate by default.
2005-11-17 18:01:07 +00:00
f0593ea8e8 Bug in SoftBody for Curve/Surface: in some cases the edge spring array was
not initialized, like when adding a SoftBody to Object in EditMode.
2005-11-17 12:24:29 +00:00
ec477f7a63 Another Orange sneak-in feature: SoftBody support for Curves & Surfaces.
Well, it already worked a bit, but without weight options or edge
stiffness. You now can set the weights using the "Properties" Panel in
the 3D Window (allows multiple selections too) or with Wkey in Edit Mode.
Bezier curves have this too.

NOTE: Lattice SoftBody Goal created yesterday won't work anymore!
I've had to recode weight support for Nurbs Points, using a new weight
variable... this because the existing W variable was in use for Nurbs
already. Also Lattices have this new Weight variable, so the code is nice
uniform. Sorry for the artists who already created complex Lattices... :)

NOTE2: Surface Objects don't support edge stiffness yet

NOTE3: I've removed ancient screen coordinates from the Bezier struct,
which makes - even with added weight and padding - the struct smaller!

Demo file:
http://download.blender.org/demo/test/2.40/softbody_curve_lattice.blend
2005-11-17 11:40:57 +00:00
befd6f3150 Special Orange request; support for SoftBody Goal weights for Lattices.
Animating detailed clothes with softbody becomes messy, so now we'll
try it this way. :)

It simply uses the W (weight) value, as already available in each Lattice
Point. Only had to make it editable;

- NKey panel
- or press W in editmode

Further there's a minimalistic W button in the softbody Panel!
2005-11-16 21:58:49 +00:00