You probably read the title and said out loud something along the lines of “What?”
Click here and look at the pictures. This isn’t the best example but its the one I could find that has pictures. Imagine the blender 3D workspace was filled with a 3D checkerboard of white/black. This checkerboard was static relative to the origin, but not visible to the user directly. I want objects to be textured as if they were “carved out” of this 3D checkerboard, and the textures to change when the objects are rotated/transformed/scaled.
I don’t know if what Im after is actually possible, but hopefully someone can shed some light on that subject.
I’ve had limited success in setting face colors programmatically from python, by setting up materials of solid colors and toggling back and forth between them. This doesn’t actually always guarantee me a checkerboard pattern and doesn’t seem to reliably give me the same pattern each time:
def run(origin): # Create two materials
black = bpy.data.materials.new('Black')
black.diffuse_color = (0,0,0)
white = bpy.data.materials.new('White')
white.diffuse_color = (1,1,1)
# Create mesh and assign materials
bpy.ops.mesh.primitive_uv_sphere_add(segments = 16,ring_count = 8,location=origin)
ob = bpy.context.object
ob.name = 'MultiMatSphere'
me = ob.data
me.materials.append(black)
me.materials.append(white)
# Assign materials to faces
i = 0
for f in me.polygons:
f.material_index = f.index % 2
I figure there has to be a way to do this, and hopefully on a per-object basis but working with a worldspace material instead of having to create one for each object.
Looking forward to hearing thoughts on the subject.