2
$\begingroup$

Summary

I want to be able to look through an outer sphere - BlueSphere, and see another sphere inside - RedSphere

This is the target goal I'm trying to get to:

GOAL

Issues

Here is what I have tried, and the problems I'm having:

1)

If I set the spheres transparency alpha values to 0.75 - then the inner RedSphere does not take on its "true" colour and shows as blue instead of red.

enter image description here

2)

If I set the spheres transparency alpha to lower values of 0.5

  • the spheres lose their crispness which I don't want
  • and the inner RedSphere still does not take on its "true" colour

{ can't paste a 3rd sample - need more reputation points }

Background

I am animating two spheres, one inside the other, superimposed about a common origin.

  • At the start:

    • the outer BlueSphere is at full radius
    • the inner RedSphere is at zero radius
  • As time progresses:

    • the outer BlueSphere shrinks
    • the inner RedSphere expands

So what happens is the expanding inner RedSphere "bursts through" the contracting outer BlueSphere.

So the effect I am looking for is to see the RedSphere appearing as Red as it expands inside the BlueSphere.

Thinking/Logic

So I figure that transparency is not the way to go.

The transparency settings are behaving correctly - as one would expect, in a "real world" situation - the inner sphere (Red) takes on the colour of the outer sphere (Blue) seeing as we are looking through a (transparent) Blue material.

Any ideas on what approach to take ?

It's almost as if I should be "removing" the part of the BlueSphere that the RedSphere "occupies" so that we see the RedSphere directly without any BlueSphere between us and the RedSphere.

Some sort of masking ??

Advice, comments, suggestions welcome. Thanks.

[requested edit]

Using internal render.

[ My End Solution - Thanks for the guidance ]

Right, so here is the way I got to my final result:

1) I created python drivers for each sphere

  • I used the frame_current scene property for input
  • Passed that to a scripted expression which used sin() as the scaling factor
  • Used some if / elif conditionals against frame_current to make the spheres visible only when I needed them

2) I created 3 layers

  • On Layer-1 - background

    • I put RedSphere AND BlueSphere
    • with drivers driver_Outer_RedSphere() & driver_Outer_BlueSphere()
    • limiting the display of each sphere to show only where each radius > halfway
  • On Layer-2 - foreground-1

    • I put RedSphere ONLY
    • with driver driver_Inner_RedSphere()
    • limiting the display of RedSphere to show only where its radius <= halfway
  • On Layer-3 - foreground-2

    • I put BlueSphere ONLY
    • with driver driver_Inner_BlueSphere()
    • limiting the display of BlueSphere to show only where its radius <= halfway

3) I rendered each layer to .PNG sequence [RGBA] (alpha channel for transparency)

  • Render Layer-1 - background

    • background : [sky]
  • Render Layer-2 - foreground-1

    • background : [transparent]
  • Render Layer-3 - foreground-2

    • background : [transparent]

4) I brought all 3 sequences into the Video Sequence Editor

  • Strip-1 - background

    • blend [cross]
    • opacity [1.00]
  • Strip-2 - foreground-1

    • blend [alpha-over]
    • opacity [0.50]
  • Strip-3 - foreground-2

    • blend [alpha-over]
    • opacity [0.50]

5) Rendered the 3 layer final sequence to H.264

So the "aha moment" struck me right at the end when I was in the Video Sequence Editor:

  • "Don't try to make the Outer Spheres transparent, and see through to the Inner Spheres"
  • "Instead overlay the Inner Spheres over the Outer Spheres, and limit the opacity of the Inner Sphere overlay"

enter image description here

So now I see my Inner Spheres in their true colours, but the colours are muted due to the .75 opacity - and hence it gives the visual impression that the Inner Spheres are in fact inside the Outer Spheres.

Thanks all for the input - it got me going in the right direction.

$\endgroup$
1
  • $\begingroup$ I assume you are using blender internal render instead of cycles render, but, just in case, please edit your question to specify. $\endgroup$
    – 10 Replies
    Commented Jan 5, 2017 at 17:43

3 Answers 3

4
$\begingroup$

You might be able to accomplish the effect you want using Compositing and Render Layers.

https://www.blender.org/manual/render/post_process/layers.html

Put the red sphere on one layer and the blue sphere on another layer. Make sure the red layer is transparent ( Can Blender render pngs with the background transparent? )

Some of the compositor nodes you would need have screenshots in Using scenes and render layers to composite an object isolated on white background with shadow .

use an alpha over node in the compositor to put the red ball OVER the blue one. Both will keep their solid appearance. - Gez

When it comes time for the spheres to swap orders, you can have a second alpha-over node that puts the blue ball over the red ball. Then route those two alpha-over nodes into a Mix (under the Add > Color menu) node and animate its Fac to switch from 0 to 1. This animation can be keyframed, or if you want to get super-fancy you can rig a driver that uses python to compare the radius of the two spheres.

Unfortunately the layers property of an object can not be keyframed. I do not think there is a way to keyframe the visibility of an object within a single layer. It is possible to animate the hide_render property (the camera icon on the outliner) that affects its visibility on all layers. This enables an alternative where you just have 3 layers and one of them is an identical blue sphere that is unrenderable until the keyframe where it has shrunk enough that you want it to appear (you could also get fancy and use drivers). This technique does not require you to keyframe compositor nodes and slightly simplifies the node tree. It also works better if you have multiple nested spheres in the scene.

Having two distinct blue sphere objects can illustrate some properties of blenders datablock sharing system. If you animate the sphere and then create a duplicate for the other layer they will share the same action datablock and will animate the same. If you duplicate the sphere before you give it any keyframes (so at that time the original has no action), the two spheres will not share the action datablock (although you can later link it in using the Action Editor mode of the Dope Sheet window).

$\endgroup$
4
  • 1
    $\begingroup$ I'd only add that to produce the desired effect the red ball should be composited over the blue ball. In other words: Render the two separate renderlayers and use an alpha over node in the compositor to put the red ball OVER the blue one. Both will keep their solid appearance. It won't feel exactly as the red ball was inside the blue ball, but it wouldn't look that way anyway if it really was and the blue ball was translucent, as you already figured out. Another option is to combine this answer with the other answer: Composite the red ball over blue, then layer a blue fresnel on top of both $\endgroup$
    – Gez
    Commented Jan 6, 2017 at 0:56
  • $\begingroup$ Thanks - a layer approach totally makes sense, and yes @Gez, RedSphere layer transparent over BlueSphere layer. I'll use this approach to get to my desired target, and then experiment with a Fresnel to see if that "adds value". $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 10:33
  • $\begingroup$ Just to complete the thinking, after the radius of RedSphere exceeds the radius of BlueSphere, then I'll want to see BlueSphere as blue inside RedSphere. That will either need a 3rd layer, or else I'll need to swop which layer is in front, or else I'll need to swop which layer each sphere belongs to. Any comments on which of these three approaches is more "elegant" or efficient would be appreciated. $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 11:00
  • $\begingroup$ ^ or Option 4: Have 2 layers - LayerFront & LayerBehind. Duplicate RedSphere & BlueSphere onto both layers, behaving with the same driver timeline scaling on both layers. At the appropriate timing point, set visibility of RedSphere & BlueSphere per layer - i.e. Smaller_Sphere/Inner_Sphere is VISIBLE on LayerFront and Larger_Sphere/Outer_Sphere is NOT-VISIBLE on LayerFront. $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 12:33
1
$\begingroup$

Welcome to the world of Fresnel! Pronounced as Fray-nel.

enter image description here

$\endgroup$
4
  • $\begingroup$ I'll read up about Fresnel and play around with it. I think the layer approach above will get me to my goal, but your answer and @Gez suggestion may help me refine my visual. $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 10:37
  • $\begingroup$ "By using the fresnel as blending factor you're specifying that any light which is refracted through the glossy coating layer would hit the diffuse base and be reflected off that." That makes sense. Playing around with that now. $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 12:06
  • $\begingroup$ Just for my understanding: When I downloaded your .Blend and tried to render, I got a "No camera" error. I added a camera, and can now render, but why was there no camera to start with ? Am I missing something ? $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 12:08
  • $\begingroup$ @ TaoRich ... I did not have a camera in my default scene as I dont work on cpu on gpu rendering these days ... realtime is my new game these days. So sorry I forgot about the camera. $\endgroup$
    – hawkenfox
    Commented Jan 7, 2017 at 21:07
1
$\begingroup$

Best way to achieve this is probably with an inverted normals trick, and backface culling enabled

  • It should be render engine independent, only requiring some node tricks for Cycles
  • It works well in the viewport if you turn on Backface Culling in the Properties Shelf > Shading > Backface Culling
  • It won't need compositing or any post processing, and should be animation friendly.
  • It doesn't alter the colors of the underlying geometry

To achieve this just enter Edit Mode on your large sphere, select all faces and then use the Flip Normals operator from the Space Bar search menu

Flip Normals Backface Culling

Animated resizing

Resizing Animation

$\endgroup$
5
  • $\begingroup$ I think this would have problems with reflecting environment lights, because we see the back of the blue ball when we should see the front. $\endgroup$
    – lbalazscs
    Commented Jan 6, 2017 at 3:18
  • $\begingroup$ It might, but the user never mentions using environment lights. We don't even know what render engine will be used. From the looks of it I am guessing it will be some sort of physics based particle animation, which is often rendered in a non-photorealistic style with flat colors $\endgroup$ Commented Jan 6, 2017 at 3:23
  • 1
    $\begingroup$ Good guess @DuarteFarrajotaRamos ! It is a physics animation. That's why I originally used the physics term superposed which you edited to graphics terminology superimposed. I do however want the final lighting to appear "realistic" in the final result. $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 10:46
  • $\begingroup$ @taorich Apologies for the edit then, thought it was a typo. Feel free to revert any edits you feel changed the meaning of your question. $\endgroup$ Commented Jan 7, 2017 at 14:26
  • $\begingroup$ @DuarteFarrajotaRamos no worries mate. In the end they mean the same thing in my context: superimpose place or lay (one thing) over another, typically so that both are still evident superpose place (something) on or above something else, especially so that they coincide | So effectively "superimposed about a common origin" = "superposed". $\endgroup$
    – TaoRich
    Commented Jan 7, 2017 at 15:49

You must log in to answer this question.

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