Mixing SSS with Glass--what am I doing wrong?

  • I am trying to create a White Russian sort of drink where the creamy top layer is sort of slowly filtering down into the refractive bottom layer. I'm still learning the basics of putting Cycles nodes together and I cannot figure out where I am failing to put this one together correctly. Here is what I have so far, but it just either renders solid one shader or the other, or has a sharp, untextured transition with no gradient.
    0_1558591083182_mixed mat.png

  • Additional notes:
    I decided to give up on blending the SSS and glass for now, and just concentrate on getting a gradient to work, so I spent time researching Cycles gradients and how to map them. A lot of trial and error later, I wound up with a gradient texture attached to a colorramp plugged into the diffuse color of the SSS material of my drink (I am using Vince Bagna's "Milk" shader for this). In the preview, it looks perfect! But it doesn't render that way at all...in the render, the colors are blended half and half up top, and then down at the very bottom is a sliver of the darker color. I wondered if it might be a faulty model, so I created a prop and went with an empty glass. That didn't work, so I exported the prop as an object, reimported it and deleted the original prop, and that didn't work either.

    0_1558597607946_drink shader fail.png

    Another note: I've noticed that I cannot get a vertical gradient by changing the rotation of my Y axis in the Mapping node, and had to use a variable node instead. Weird. Location mapping still works, at least in preview.

  • Intresting Problem.
    I have to admitt, i have no clue how to deal with it.
    Maybe there is a differend aproach to this.
    I will search for some reference picture on the white russian subject and try to build something.
    ...and in the end, BB comes up with a perfect solution and at least three differend ways to do it. 😊

  • Poser Ambassadors

    I would start with nothing more than a V texture node on the liquid prop and verify visually that the V coordinate does what you think it does.

    I can, in parallel, demonstrate with a glass I make myself, but would probably be more helpful if I worked with the same prop. Is it something you can point me to or share?

  • Poser Ambassadors

    Here is a glass with liquid prop I found long ago. I hid the glass - this is just the liquid plug (and a straw inside).

    I set up a simple gradient of red to white using the V coordinate. No scatter or diffuse whatever - just show the color.

    On the liquid plug, we see a completely useless coordinate mapping that does not offer what we expect in terms of applying a modulation using the V coordinate. This glass (as with so many free things) is unsuitable for our purpose of a gradient liquid. (Note that it works perfectly well as an unmodulated liquid)


  • Ugh, well there it is. Thank you, I would've never suspected the model itself, it was a purchase. So I'll try to find one that actually renders the blend properly and then go from there.

    0_1558646020237_liquid model.png

  • I took the liquid model into Silo and tweaked it, got rid of the UV seams and then made new vertical UVs for it. Got it working right with the vertical gradient now. My second attempted shader with the colorramp now works properly and I'm rendering that. My first one with the attempt to mix SSS and Glass....uh...no. But maybe that's just too advanced for where I'm at right now, so I'll be happy with the latte.

  • Still can't figure out how to mix SSS with Glass but at least I managed to work out my colorramp. It was really faded until I made an inverted version of the texture gradient and plugged it into the SSS strength. Forget the latte, I made some Thai tea! :)
    0_1558661860961_Thai Tea.png

  • @minyassa my shader will mix SSS with gloss. Not sure if it will do any of the other crazy stuff you are doing there.

  • @ghostship Thank you, I've downloaded it and will see what it lets me do! (I adore your lights, that's what I'm using now in fact!)

  • @ghostship It worked! Didn't take very long to figure out what to plug where. I'm pretty pleased with this. Thank you for sharing that!
    0_1558712233552_White Russian.png