# ColorRamp works in Material mode but not when it's rendered

I have a problem: I'm trying to model a DNA. I have it set up, but when I have a color ramp set to two different colors, it only shows one when rendering. But when I click Material in the 3d view, I can see it fine...Does anyone know what is happening?

EDIT: As requested, here is my .blend file:

Here are some screenshots of what happened (and my nodes)

Material mode Rendered mode

• I can't replicate this behaviour - please Edit your question to add additional details of how your scene is set up. For example, I've assumed each of the 'bars' is a separate mesh, but all with the same material. It would also be useful to be able to see your .blend file - please upload it to blend-exchange.giantcowfilms.com and edit your question to include the link. – Rich Sedman Aug 19 '18 at 22:58
• @RichSedman Done – sam1370 Aug 20 '18 at 2:52
• I can't replicate what you're seeing when I try your file on Blender 2.76 - in fact, I see exactly the opposite (ie, Material view shows all green but Rendered shows alternating colors). It is as if in Material mode that the object Location is always zero. – Rich Sedman Aug 20 '18 at 6:20

If I change the interpolation mode in the colorramp to something else than constant. It works correct. But I cannot tell the why I'm afraid.

• I think the maths are producing values from the Modulo node that alternate between 0.0 and 0.5 resulting in the 'green' color in each case - it is never higher than 0.5 so never hits the yellow region. Setting to Ease or other interpolation moves the yellow region below 0.5. However, even so I can't replicate the original behaviour since I always seem to get an object Location of zero when in Material mode - I can only get alternating colors in Rendered mode (after a similar change to the color ramp as you have discovered). – Rich Sedman Aug 20 '18 at 6:26

Another approach is to assign a single colour material to each piece. You only need to model a segment with one of each colour and then use an array modifier to duplicate it to length.

In this example I created a section and used an array modifier to duplicate it a few times and then a simple deform to twist it 360 degrees, then I used a second array modifier to duplicate that multiple times.

You can also use an object to define the offset with a rotation as shown here.

• Thank you so much! I knew nothing about array modifiers...I thought you had to do a complicated solution like the node setup I had then. :) I am accepting the other answer though because it was a quick and easy solution. – sam1370 Aug 25 '18 at 2:35