Skip to content

Instantly share code, notes, and snippets.

@andreasplesch
Created August 20, 2024 15:24
Show Gist options
  • Save andreasplesch/6776aad92cdc069138634985a8a8d00a to your computer and use it in GitHub Desktop.
Save andreasplesch/6776aad92cdc069138634985a8a8d00a to your computer and use it in GitHub Desktop.
animated directional light
<X3D>
<Scene>
<NavigationInfo headlight='true'></NavigationInfo>
<!-- <NavigationInfo headlight='false'></NavigationInfo> -->
<!-- look down to the north at 90-75 degrees from vertical, adjust position by subtracting 15 degrees lat. -->
<GeoViewpoint DEF='SanDiegoVP' position='27.715, -117.1625, 30000000' orientation='1, 0, 0, -1.31' centerOfRotation='0 10 -6371000' description='oblique SanDiego'></GeoViewpoint>
<Background skyColor='0 0 0'></Background>
<!-- This works -->
<!-- <DirectionalLight on='true' direction='1 1 -0.3' color='1 1 0.7' intensity='1'></DirectionalLight> -->
<!-- But this does not work -->
<Transform DEF='earthAxis' rotation='0 0 1 0'>
<DirectionalLight on='true' direction='1 0 -0.3' color='1 1 0.7' intensity='2'></DirectionalLight>
<DirectionalLight on='true' direction='-0.5 0.87 -0.3' intensity='.15'></DirectionalLight>
<DirectionalLight on='true' direction='-0.5 -0.87 -0.3' intensity='.15'></DirectionalLight>
</Transform>
<Transform DEF="SimpleGlobe" translation='0 0 0' rotation='1 0 0 1.57'>
<Shape DEF="SimpleGlobeShape" visible='true'>
<Appearance DEF="Appearance">
<Material DEF="Material" emissiveColor='0.0 0.0 0.0'></Material>
<ImageTexture _url='"https://i.postimg.cc/gJ2xrrkZ/3-no-ice-clouds-8k.jpg"' url='"https://i.postimg.cc/d3nnrh8c/earthtex.jpg"'></ImageTexture>
<TextureTransform translation='-0.25 0'></TextureTransform>
</Appearance>
<Sphere DEF="ball" radius="6371000"></Sphere>
</Shape>
</Transform>
<TimeSensor DEF='oneDay' cycleInterval='10' loop='true'></TimeSensor>
<OrientationInterpolator DEF='dayRotor' key='0 0.5 1' keyValue='0 0 1 0, 0 0 1 -3.14, 0 0 1 -6.28'></OrientationInterpolator>
<ROUTE fromNode='oneDay' fromField='fraction_changed' toNode='dayRotor' toField='set_fraction'></ROUTE>
<ROUTE fromNode='dayRotor' fromField='value_changed' toNode='earthAxis' toField='set_rotation'></ROUTE>
<OrientationInterpolator DEF='logoRotor' key='0 0.33 0.66 1' keyValue='0 0 1 0, 0 1 0 3.14, 1 0 0 3.14, 0 0 1 6.28'></OrientationInterpolator>
</Scene>
</X3D>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment