[Bf-committers] Color ramp additions
charlie.jolly at ntlworld.com
Tue Dec 22 04:27:28 CET 2009
Message copied (with additional edits) from BA thread:
Not sure Blender Tests was the best forum to post to!
Been doing some more work on the color ramp. I'd appreciate some
feedback from users who can build with the attached patch.
This started as a learning exercise so I could build Blender. I then
decided to try my hand at programming. So this is newbie stuff code
The original 2.49 ramp blends colours using just the RGBA values. The
new ramp adds both HSV blending and also separate Alpha blending. The
four HSV modes are nearest hue, furthest hue, clockwise and
Each colour element can be set to influence RGB, Alpha or RGB+Alpha.
Cleaned up patch:
Unzip to preset folder in build/install preset folder under scripts.
e.g. Extract them to ..../blender/release/scripts/presets prior to
building or the hidden install folder ...../.blender/scripts/presets
+ Additional colour blend modes, RGBA, HSV etc
+ 249 mode for comparison
+ Updated GUI
- ctrl click to add colours, (on new ramptype, not 249, clcick on the
top to add alpha, bottom to add new colours)
- alt click to remove colours
- dragging left right changes position
- dragging up/down changes alpha
- alpha slider
- preset loading/saving added
+ Input functions (useful for animation)
- Repeat/cycle the ramp x times
- Shift ramp postion
- Posterize (limit ramp to x number of colours)
- Reverse (reverse ramp direction, not GUI)
- Pingpong (for use when repeat/cycle is set over 1.0)
Also in patch:
+ Noise added to Blend procedural texture, textures by default have 0.25
noise size, this should be set to zero for plain blends
+ New REPLACE colour blend mode which ignores the base colour. Useful
for testing and stencil type effects.
+ 2D texture mapping mode for procedural textures (experimental hack).
+ Subclass some RNA noise functions (only needs updating in one place)
- HSV interpolation is not always perfect, especially for B-spline and
Cardinal interpolation modes.
- RGB-HSV conversion sets Saturation and Hue to zero if Value is zero.
This means that the colour would blend to/from black instead of a very
dark red for example. Suggest that Value is set as a very small value in
- Add/Remove buttons resize when scaling the gui.
- Preset saving is limited to each type of color ramp. Node ramps do not
have preset saving. This was copied fromm the SSS preset code.
Known issues with 2.5:
- Animation of position does not work properly with ColorBand because
the data is sorted when it is changed. RNA dose not have a unique path
for each element. This is something I was able to fix by moving the
sorting function to the do_colorband function but it broke when
adding/removing elements. I also think that it is not a very efficient
solution as the do_colorband function is called a lot.
- Even though some items are animateable, they do not always appear in
the graph editor. Aligorith kindly gave me some tips to fix this but
this is beyond my skill level at the moment.
More information about the Bf-committers