TransWikia.com

White-Black ColorGradient in Graphics3D?

Mathematica Asked by Lanier Freeman on March 5, 2021

I have a 3D plot of 8 adjoining cubes–each of which I’ve color-customized with CYMKColor.

I’d like to be able to install a monochromatic gradient from white-to-black by z coordinates, but I’m having a bit of trouble as I can only seem to blacken the color with CYMKColor and not whiten it

Here’s my code and the graphic I have so far:

min = -10

med = 0

max = 10

arc = Graphics3D[{CMYKColor[1, 1, 0, 0, 0.7], 
   Cuboid[{min, med, med}, {med, max, max}]}]

arp = Graphics3D[{CMYKColor[1, 1, 0, 0, 0.7], 
   Cuboid[{med, med, med}, {max, max, max}]}]

alc = Graphics3D[{CMYKColor[0, 1, 1, 0, 0.7], 
   Cuboid[{min, min, med}, {med, med, max}]}]

alp = Graphics3D[{CMYKColor[0, 1, 1, 0, 0.7], 
   Cuboid[{med, min, med}, {max, med, max}]}]

llc = Graphics3D[{CMYKColor[1, 0, 1, 0, 0.7], 
   Cuboid[{min, min, min}, {med, med, med}]}]

llp = Graphics3D[{CMYKColor[1, 0, 1, 0, 0.7], 
   Cuboid[{med, min, min}, {max, med, med}]}]

lrc = Graphics3D[{CMYKColor[0, 0, 1, 0, 0.7], 
   Cuboid[{min, med, min}, {med, max, med}]}]

lrp = Graphics3D[{CMYKColor[0, 0, 1, 0, 0.7], 
   Cuboid[{med, med, min}, {max, max, med}]}]

Show[arp, arc, alp, alc, llp, llc, lrp, lrc]

Current Graphic

One Answer

RegionPlot3D[-10 <= x <= 10 && -10 <= y <= 10 && -10 <= z <= 
   10, {x, -10, 10}, {y, -10, 10}, {z, -10, 10}, Mesh -> 1, 
 ColorFunction -> Function[{x, y, z}, Blend[{White, Black}, z]], 
 Lighting -> {{"Ambient", White}}, Boxed -> False, Axes -> False, 
 MeshStyle -> Yellow, BoundaryStyle -> Green]

enter image description here

Correct answer by cvgmt on March 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP