Page MenuHome

strange output from Cycles Vector Curves Node
Closed, ResolvedPublic


System Information
GNULinux (fedora 22) intel cpu, nvidia gpu

Blender Version
Broken: (example: 2.69.7 e5e1010
Worked: ?

Short description of error
when Vector Curves are not linear, and we have a point at 0,0 feeding in zero doesn't give zero but some non zero output. I'm unable to predict or understand what the math going on here is supposed to be...

Exact steps for others to reproduce the error

  1. download the attached .blend{F262008}
  2. open it in blender
  3. turn on viewport rendering
  4. try plugging in R then G then B into the Emission Strength, you get a black cube
  5. the same for Y and Z, but if you plug in X you get some greyness
  6. plug in Y, you should get a black cube again
  7. now create a point in the middle of the Y curve and move it away from the linear curve
  8. You now get a grey cube!

what I expect is the cube to stay black since the input is zero/zero/zero and all the curves have a point at zero, zero

Event Timeline

bassam kurdali (bassamk) set Type to Bug.
bassam kurdali (bassamk) created this task.
bassam kurdali (bassamk) raised the priority of this task from to Needs Triage by Developer.
Sergey Sharybin (sergey) triaged this task as Confirmed, Medium priority.Dec 3 2015, 11:36 AM

This isn't really a bug, just some specific of how curve mapping works in Cycles in general and how Vector Curve works in particular.

The thing here is -- any curve mapping in Cycles is expected to be Use Cllipping-ed, because internally the curve is getting rasterized in [0..1] range.

This makes color mapping working as expected (mainly), because colors are not negative. Only issue here is that Cycles will clip the input (solving this is in my TODO).

But vectors are usually negative, so what Curve Mapping node is doing is it maps input values from [-0.5..0.5] range to [0..1], applies the mapping and then goes back to [-0.5..0.5] range. This makes it so curve point corresponding to curve's x=0.5 is actually defines mapping for the input value of 0.

it's not really a bug, but quite confusing logic here and not sure how we can solve this without intruding regressions.

What we can do, is to solve the clipping limitation, make it so Curve Mapping is default to -0.5..0.5 range, do some do-versions code to preserve existing renders. IMO, this is most friendly approach.

@Brecht Van Lommel (brecht), do you have any inputs here from your side?

Submitted a patch which implements the logic above, D1672.

@bassam kurdali (bassamk), mind giving it a whirl and see if it's indeed behavior you was dreaming about?