I am looking at mesh surfaces that intersect themselves and show both sides (inside/outside). It's easier to put one here than to explain. So far, I can not cycles render
it with transparency. It renders completely opaque for me. I'm toggling alt-z and it changes from semi-transparent to opaque in normal view (object mode) but always opaque in render. It is interesting to watch when toggling backface culling
.
I give the shape here, because there may be some strange thing due to the variety of surface normal directions.
I don't want glass or refraction, I just want to see the surfaces themselves in some way that I can see inside.
NOTE: it DOES render semi-transparent in blender render
. Using 2.74. I think I will have to play with multiple lights and diffuseness before it looks excellent.
import bpy
import numpy as np
nth, nph = 101, 200
th = np.linspace(-0.5*np.pi, 0.5*np.pi, nth)
phi = np.linspace(-np.pi, np.pi, nph)
y3 = np.sin(th) - 1.8*np.sin(th)**3
X = np.cos(phi)[None,:] * np.cos(th)[:,None]
Y = np.sin(phi)[None,:] * np.cos(th)[:,None]
Z = np.zeros_like(X) + y3[:,None]
verts = [tuple(thing) for thing in zip(X.flatten(), Y.flatten(), Z.flatten())]
faces = []
for ith in range(nth-1):
for iph in range(nph-1):
v1 = nph*ith + iph
v2 = v1 + 1
v3 = v2 + nph
v4 = v3 - 1
faces.append((v1, v2, v3, v4))
purple = bpy.data.materials.new("transPurple")
purple.diffuse_color = (1.0, 0.0, 0.67)
purple.alpha = 0.2
purple.use_transparency = True
me = bpy.data.meshes.new('wow')
ob = bpy.data.objects.new('wow', me)
ob.location = (0.0, 0.0, 2.0)
bpy.context.scene.objects.link(ob)
me.from_pydata(verts,[],faces)
ob.active_material = purple
ob.show_transparent = True
bpy.data.objects['wow'].select = False
bpy.data.objects['wow'].select = True
bpy.ops.object.shade_smooth()