Color Ramp WIP

I’m still working on an updated color ramp with extra color blending modes e.g. Original Blender, RGB with independent alpha, HSV+ and HSV-.

Here is a screenshot with the a blend from transparent to cyan with the different blend modes. Small differences but the HSV blends give stronger colors in the falloff.

http://homepage.ntlworld.com/charlie.jolly/blender/ramp_blend_modes.png

I’m hoping to create a patch soon but I just need to iron out some of my maths with the HSV,

http://homepage.ntlworld.com/charlie.jolly/blender/hsv.png

This is looking very interesting. Keep it up!

It might help if you provided some real-life examples of how this will come in handy when creating advanced materials.

Been doing some more work on the color ramp. I’d appreciate some feedback from users who can build with the attached patch.

Image:
http://homepage.ntlworld.com/charlie.jolly/blender/color_ramp_wip_22dec.png

This started as a learning excerise so I could build Blender. I then decided to try my hand at programming. So this is newbie stuff code wise.

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 anticlockwise.

Each colour element can be set to influence RGB, Alpha or RGB+Alpha.

Cleaned up patch:
http://homepage.ntlworld.com/charlie.jolly/blender/colorramp_22dec.diff

Default presets:
http://homepage.ntlworld.com/charlie.jolly/blender/presets.zip
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

Patch contains:

  • 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).

Known issues:

  • 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 this case.
  • 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 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.

Thanks
Charlie

This will be useful for many things, thank you for this wonderful contribution.

BTW: I don’t know whether or not it will be accepted considering Brecht has put up design docs. on a refactor of the entire Blender shading system.

I think this is the way!! small steps and optimization :slight_smile:

thankyou!

Hi
will be this patch integrated in blender release official ?
It’s a very interesting feature.

Sorry, I doubt that this will be included as I’ve not updated the patch for a while, it would certainly need some work applying the patch. Unfortunately, my computer is on it’s knees!! However, some of the ideas could easily be incorporated by an interested developer until I get a new system. I was also waiting to see some news about the shading re-factor.

I think now the shading refactor is not going to start until after the Durian project.

Meanwhile it would be neat to see you assist Brecht on the shading refactor when it starts since you’ve been learning the shading code, I do hope Brecht will allow the help of multiple developers since it will get things done faster.

Also, a low end Quad Core with a decent GPU should not cost more than 1000 USD right now because of the fact it’s long been surpassed by the i-series of chips, Quad core machines are now considered mid-range.

YA it seems functional.