3
$\begingroup$

I have this idea of being able to apply Complimentary color theory in scene to minimize the time (I know results might be differ when applied in post and when applied in the scene). So, my idea was kinda like this: Adding 2 light source in any point of space and giving them both a different color following the Complimentary color theory, and add an empty to control the colors; Or maybe use 3 empty to control the HSV.

To accomplish this I tried using the drivers for the light color. So basically when I move the empty in a certain axis the HSV will change, and the lights will simulate the Complimentary color.

Everything is fine but the reason i’m here asking the question is because when I add driver on the color in the driver editor it shows RGB and it’s really complex comparing to HSV where I only had to change the H value from the HSV value sliders (for those who wondering then add the driver on HSV value slider. You can’t I mean we can’t put driver on color values only on the color itself).

So in short, How can I change the RGB on driver editor to HSV. If I can’t do thatis there any other way to overcome this problem? In both Cycles and Eevee.

$\endgroup$
3
  • $\begingroup$ are u using eevee or cycles? $\endgroup$
    – Chris
    Nov 8, 2021 at 4:40
  • $\begingroup$ im using cycles $\endgroup$
    – Mahir
    Nov 8, 2021 at 4:45
  • $\begingroup$ then just read my answer ;) $\endgroup$
    – Chris
    Nov 8, 2021 at 4:47

1 Answer 1

4
$\begingroup$

Solution for EEVEE

create this script:

import colorsys


import bpy

def driver_func(val):
    
    print(val)
    
    col = colorsys.hsv_to_rgb(val, .8, 1)
    
    return col    # return val squared

# add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

Run it once.

In your driver editor configure this (e.g. for the b value)

enter image description here

Then the color will change if you move the cube on the x-value.

Note: this might only work on x - values from 0-1 ...so maybe you might finetune this script a bit.

Solution for cycles:

Use this node setup:

enter image description here

Here you can add drivers to e.g. the H value.

$\endgroup$
7
  • $\begingroup$ This seems to be not working in eevee.Any way to use this trick or any other similer hack to use in eevee ? Can use plane with emission shader but I think the plane with emission shader and a light is very different. Correct me if I'm wrong. $\endgroup$
    – Mahir
    Nov 8, 2021 at 4:51
  • $\begingroup$ you said your are using cycles.....😳, that's why i asked $\endgroup$
    – Chris
    Nov 8, 2021 at 4:56
  • $\begingroup$ Yes I'm using cycles, but what if i want to use it in eevee. $\endgroup$
    – Mahir
    Nov 8, 2021 at 4:59
  • 1
    $\begingroup$ i updated my answer. $\endgroup$
    – Chris
    Nov 8, 2021 at 4:59
  • $\begingroup$ Thanks a lot man. $\endgroup$
    – Mahir
    Nov 8, 2021 at 5:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .