Previous | Next --- Slide 17 of 63
Back to Lecture Thumbnails
treetrunk

How would something like this be denoted in an SVG file? Would the triangles have to be broken up into smaller triangles of varying depths?

motoole2

@treetrunk For SVG 1.1 (not sure about later versions), there is no depth-buffer or notion of depth. The objects are specified to be drawn to the screen based on the order that they appear in your SVG file. Therefore, interpenetrating surfaces do not occur when rasterizing two triangles, since one triangle will always fully overlap the other. (To render the slide above using the SVG 1.1 specification, you need to break up your geometry into smaller triangles.)

jfondrie

Based on https://stackoverflow.com/questions/17786618/how-to-use-z-index-in-svg-elements and https://www.w3.org/TR/SVG2/render.html#RenderingOrder it seems like SVG 2.0+ allows for a depth value per element that just defines rendering order. So, the example above would still have to be made of multiple smaller triangles, as the depth is constant for the entire element.

motoole2

@jfondrie Nice! And this makes sense. Vector graphics software, like Adobe Illustrator, supports layered content, by assigning objects to one of several discrete layers. Each layer is then rendered in some sequence, and typically supports blending as well. It is still not a full-blown depth-buffer as used in standard 3D graphics pipelines, but this provides some information about rendering order.