\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
\newif\ifcuboidshaded\cuboidshadedfalse\tikzset{get projections/.style={insert path={let \p1=(1,0,0),\p2=(0,1,0) in [/utils/exec={\pgfmathtruncatemacro{\xproj}
{sign(\x1)}\xdef\xproj{\xproj}\pgfmathtruncatemacro{\yproj}{sign(\x2)}\xdef\yproj{\yproj}\pgfmathtruncatemacro{\zproj}{sign(cos(\tdplotmaintheta))}\xdef\zproj{\zproj}}]}},pics/cuboid/.style={code={\tikzset{cuboid/.cd,#1}
\path[get projections];
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/bottom face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,\cubey,0) -- ++(-\cubex,0,0) -- cycle;
\ifnum\yproj=1
\draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/yz face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
\else
\draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/yz face] \ifcuboidshaded [shading angle=\n1] \fi (0+\cubex,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
\fi \ifnum\xproj=1
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} in [/tikz/cuboid/every face,/tikz/cuboid/xz face] \ifcuboidshaded [shading angle=\n1] \fi (0,\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
\else
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} in [/tikz/cuboid/every face,/tikz/cuboid/xz face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
\fi \ifnum\yproj=-1
\draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/yz face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
\else
\draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/yz face] \ifcuboidshaded [shading angle=\n1] \fi (0+\cubex,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
\fi \ifnum\xproj=-1
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} in [/tikz/cuboid/every face,/tikz/cuboid/xz face] \ifcuboidshaded [shading angle=\n1] \fi (0,\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
\else
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} in [/tikz/cuboid/every face,/tikz/cuboid/xz face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
\fi
\draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} in [/tikz/cuboid/every face,/tikz/cuboid/top face] \ifcuboidshaded [shading angle=\n1] \fi (0,-\cubey/2,\cubez) -- ++(\cubex,0,0) -- ++(0,\cubey,0) -- ++(-\cubex,0,0) -- cycle;
}},cuboid/.cd,x/.estore in=\cubex,y/.estore in=\cubey,z/.estore in=\cubez,rounding/.estore in=\rounding,rounding=0.2pt,every face/.style={fill=blue},bottom face/.style={},top face/.style={},xz face/.style={},yz face/.style={},shaded/.code=\cuboidshadedtrue}
\begin{document}
\tdplotsetmaincoords{75}{110}
\begin{tikzpicture}[tdplot_main_coords]
\pgfmathsetmacro{\cubedist}{4}\path[cuboid/.cd,x=2.4,y=4.8,z=1,every face/.style={fill=blue}] (0,-\cubedist,-1) pic{cuboid} (0,\cubedist,-1) pic{cuboid};
\path[fill opacity=0.3,cuboid/.cd,shaded,x=2,y=4,z=4,xz face/.style={top color=orange,bottom color=blue},yz face/.style={top color=red,bottom color=blue},bottom face/.style={fill=blue},top face/.style={fill=red}] (0,-\cubedist,0) pic{cuboid} (0,\cubedist,0) pic{cuboid};
\path[cuboid/.cd,x=2.5,y=12.4,z=1,every face/.style={fill=red}] (0,0,4) pic{cuboid};
\end{tikzpicture}
\end{document}