如何使 3D 对象具有不同颜色的正面和背面

How can I make a 3D object have different color front and back faces

是否可以使 3D 对象的每一面都具有不同的颜色(正面和背面对象的一侧是一种颜色,如 红色 ,另一侧是另一种颜色,如 blue) 使用冲浪?

%example
[x y] = meshgrid(-1:0.1:1); % Generate x and y data
z = zeros(size(x, 1)); % Generate z data
surf(x, y, z, 'FaceColor', 'red') % Plot the surface

如何让冲浪对象的另一面变成另一种颜色,比如蓝色?这可能吗?

我正在使用类似于 Matlab 的 Octave 5.1

几乎每台计算机都使用 OpenGL 在屏幕上绘制内容,MATLAB(和 Octave AFAIK)也是如此。由于 MATLAB 使用 OpenGL 基元在屏幕上绘制内容,因此您不能做任何 OpenGL 基元不能做的事情,例如在每一侧绘制不同颜色的图元。有了这样的理解,结论就是,要做你想做的事,你需要绘制两次曲面。

surf(x, y, z, 'FaceColor', 'red') % Plot the surface
hold on
surf(x, y, z-z*0.001, 'FaceColor', 'blue') % Plot the surface