Search code examples
x3dom

how do I put a gradient on a x3dom shape?


This is a simple question. How do I put a gradient on a x3dom shape? I have this:

<shape>
    <appearance>
        <material diffuseColor='green'></material>
    </appearance>
    <box height="1" />
</shape>

Solution

  • unfortunately its not possible on most primitive shapes i found this thread on x3d list http://www.web3d.org/x3d/publiclists/x3dpublic_list_archives/0504/msg00104.html

    here is how you can do it on a cylinder notice the pixel texture, thats the meat and potatoes:

    <X3D>
    <Scene>
    <NavigationInfo headlight='FALSE' type='"EXAMINE" "ANY"' />
    <DirectionalLight ambientIntensity='0.5' direction='1 -0.5 -1' />
    <Viewpoint DEF='VP1' position='0 0 10' orientation='0 1 0 0' fieldOfView='0.785398'      description = "Front" />
     <Transform translation='0 0 0'> 
      <Shape>
        <Appearance>
          <Material/>
          <PixelTexture image='1 2 3 0xFF0000 0x0000FF' repeatS='FALSE' repeatT='FALSE' />
        </Appearance>
        <Cylinder height='4' />
      </Shape>
    </Transform>
    </Scene>
    </X3D>