Suggestion for cycles - "lookup" node

I had an idea for a new node type for cycles - and wanted to gather some consensus on whether it would be useful.

Essentially the node would hold a list of values (X, Y). It would allow you to specify what X was in the node - and would output Y. This would be very flexible and could be used for many applications.

For example. You could hold a list of Gemstone names with their associated IORs.

Diamond, 2.417
Ruby, 1.762
Topaz, 1.609

By plugging this “lookup” node into the IOR slot of the glass shader - you could then set the IOR by specifying the gem name from a drop list on the lookup node.

Alternatively you could have a list of coloured names with their associated RGB values (stored as a hex value)

Indigo, #4B0082
Cobalt Blue, #3D59AB
Turquoise, #00F5FF
Gold, #EEC900

Again - you could set the colour of the object by simply selecting “Cobalt Blue” from the drop list on the lookup node.

I think this would be useful as it would allow you to store predefined colours, IORs etc in a generic shader. Imagine a generic shader for a gemstone. You would be able to specify that it is a “Red Ruby” - and the shader would know what colour and IOR to apply to make it look correct.

I have been thinking a bit more about this and have mocked up what I envisage such a node would look like:


I guess the data could be stored as XML or something like that:

<LOOKUP>
<MAT Material=“Ruby”>
<IOR>1.450</IOR>
<RGB>1.00,0.00,0.00</RGB>
</MAT>
<MAT> Material=“Diamond”>
<IOR>2.417</IOR>
<RGB>1.00,1.00,1.00</RGB>
</MAT>
<MAT> Material=“Emerald”>
<IOR>1.576</IOR>
<RGB>0.00,1.00,0.00</RGB>
</MAT>
<MAT> Material=“Saphire”>
<IOR>1.762</IOR>
<RGB>0.00,0.20,1.00</RGB>
</MAT>
</LOOKUP>

It would be a good way of storing pre-sets inside the materials themselves and could make materials more generic - e.g. you would only need one gemstone material - and the lookup node could store all of the possible pre-set variations of colour, IOR etc for common gemstones via a single drop list.

The way it works now - you have to store multiple materials, one for each gemstone - or set up a generic gemstone material, but have to research and change all of the settings individually if you want to recreate different gems.

It sounds like a handy node, but the procedure of creating a new preset with values seems a bit murky. As it currently is, you can just create a bunch of empty NodeGroups with multiple outputs in them and store all the values you want. This proposal would have to offer something more special that NodeGroups can’t do.

I guess you could have the + button like you do for new materials. Each time you press it would create a new entry in the list.