Filling Space

FillProperties • Attributes

An white IndexedFaceSet with gray hatching on three sides.

Hatching is a nice addition but there is no control over line spacing or stroke width. To achieve more of a pencil drawing look, you'll need to use an ImageTexture.

 

Rotate the vrignette to view the geometry.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3'  xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.3.xsd '>
<head>
<meta name='title' content='FillProperties'/>
<meta name='description' content='FillProperties Example'/>
<meta name='creator' content='Ian Hollidae'/>
<meta name='created' content='May 18, 2024'/>
</head>
<Scene>
<WorldInfo title='FillProperties Example'>
</WorldInfo>
<NavigationInfo headlight="TRUE" type="ANY">
</NavigationInfo>
<Viewpoint position="0.0 0.0 15.0" centerOfRotation="0.0 0.0 0.0">
</Viewpoint>

<!-- Shapes -->
<Transform translation="-2.0 0.0 0.0" rotation="1 0 0 0.392">
<Transform rotation="0 0 1 -0.0.196">
<Group>
<Transform rotation="0 1 0 -0.700">
<Group>

<!-- Front -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="3">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="-2.0 2.0 0.0, -2.0 -2.0 0.0, 2.0 -2.0 0.0, 2.0 2.0 0.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

<!-- Right -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="3">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="2.0 2.0 0.0, 2.0 -2.0 0.0, 2.0 -2.0 -4.0, 2.0 2.0 -4.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

<!-- Back -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="3">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="2.0 2.0 -4.0, 2.0 -2.0 -4.0, -2.0 -2.0 -4.0, -2.0 2.0 -4.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

<!-- Left -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="3">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="-2.0 2.0 -4.0, -2.0 -2.0 -4.0, -2.0 -2.0 0.0, -2.0 2.0 0.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

<!-- Top -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="4">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="-2.0 2.0 -4.0, -2.0 2.0 0.0, 2.0 2.0 0.0, 2.0 2.0 -4.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

<!-- Bottom -->
<Shape>
<Appearance>
<Material diffuseColor="0.80 0.80 0.80">
</Material>
<FillProperties filled="TRUE" hatchColor="0.2 0.2 0.2" hatched="TRUE" hatchStyle="3">
</FillProperties>
</Appearance>
<IndexedFaceSet coordIndex="0 1 2 3 0">
<Coordinate point="2.0 -2.0 -4.0, 2.0 -2.0 0.0, -2.0 -2.0 0.0, -2.0 -2.0 -4.0">
</Coordinate>
</IndexedFaceSet>
</Shape>

</Group>
</Transform>
</Transform>
</Transform>

<Background skyColor="0.25 0.25 0.75" groundColor="0.25. 0.75 0.25">
</Background>
</Scene>
</X3D>