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 enter image description here Rendered mode enter image description here

  • 1
    $\begingroup$ 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. $\endgroup$ – Rich Sedman Aug 19 '18 at 22:58
  • $\begingroup$ @RichSedman Done $\endgroup$ – sam1370 Aug 20 '18 at 2:52
  • $\begingroup$ 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. $\endgroup$ – 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.enter image description here

  • 2
    $\begingroup$ 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). $\endgroup$ – 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.

base piece

full dna

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

  • $\begingroup$ 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. $\endgroup$ – sam1370 Aug 25 '18 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.