Skip to Content
Author's profile photo Mark Doberenz

“Fill Level” of a tank or container

I’ve had a few people ask whether it’s possible to show a fill level in a tank and a recent request made me want to put a formal example together in case it would help anyone else out.

This method uses a texture image and an animated UV layout to get the desired effect. There may be other ways to do this, but this one’s the best/only option I know about.


Download the attachment which is a zip file. Inside it, there is a capsule_files.txt file. This file is actually a zip file, so extract it and rename it to and unzip it so you will have the files referenced below. Sorry for the weird attachment, but it’s the only way I could attach more than three files this post.

  1. Start of by creating an empty scene using the File -> New menu option.
  2. Then, Create -> Create Primitive -> Capsule
    1. The Primitive objects are a nice way to build up an object from more basic objects, but we will just use the capsule for this example.
  3. Modify the properties of the Capsule by double-clicking on it
  4. Select the Object tab in the Properties window that appears
  5. Change the following values using the up/down arrows at the end of their respective line
    1. Slices: 24
    2. Stacks: 15
  6. Leave the Properties window open
  7. Make sure the capsule is selected and right-click on it and press Tools -> Convert to Polygon Mesh
    1. This will allow us to create a different UV layout which is required for the effect to work
    2. Notice in the Properties window, the information for the object changes because we removed all the Primitive information. It’s now a dumb mesh object.
  8. Press Close to close the Properties window
  9. Press the F key to switch to the Front view
    1. Download the 01_capsule_mesh.rh file to start from this point
  10. Turn on the Decal Mapping toolbar
  11. Press the Settings button on the Decal Mapping toolbar (the last icon that looks like a Play button)
  12. Uncheck the Apply to Visible Mesh Faces Only
    1. This is so that the texture will get applied to the back of the capsule also
  13. Press the OK button to close the Settings window
  14. Download the capsule.png image
  15. Press the Load Texture Image button on the Decal Mapping toolbar (the first icon)
  16. Select the capsule.png image you just downloaded
  17. Resize the image using the handles and use the middle-mouse wheel to zoom in on the capsule so that the capsule sits entirely inside the light-blue area as closely as possible.
  18. Once it’s lined up, press the Stamp Decal button (the second icon)
    1. The capsule should now be the nice light-blue color
    2. Download the 02_capsule_mapped.rh file to start from this point
  19. While holding down the SHIFT key on the keyboard, double-click on the capsule to open its Material Properties window
  20. Select the Maps tab of the Material Properties window
  21. To test our map, change the Offset V value on the right-hand side to -0.5 and you will see it turn dark-blue
    1. What we want to do now is set up an Animation which controls the Offset V value so we can animate the fill level
  22. Set the Offset V value back to 0
  23. Turn on the Animation and Animation Controls Panels
  24. Create a new Sequence using the Create Sequence button of the Animation panel (the first icon that looks like a movie frame)
  25. Right-click on the new Sequence-1 sequence and select Properties
  26. Rename the Sequence to be Capsule
  27. Change the FPS value to 100 which will also change the End value to 100
    1. This is so that we will have a smooth transition between values of 0 and 100
    2. This may seem strange since normal animation FPS values are 30. However, we are using 0-100 to make it easier to set the value from a web page using the API. See the capsule.html file for an example of this.
    3. Imagine getting a fill level from an external system between 0 and 100. Since the animation length is 100 frames, just set the frame value to the value received from the external system and you’re done.
  28. Press OK to close the Sequence Properties window
  29. Hold down the SHIFT key and on the Animation Controls Panel, press the Record Keyframes (the red icon with a key on it)
    1. This will turn the Animation slider Red and move the slider to the last frame (100)
  30. Using the Material Properties window, change the Offset V value to -0.5
  31. Press the Record Keyframes button again to turn it off
  32. Press the Close button on the Material Properties window to close it.
  33. Now, drag the animation slider back and forth to fill and unfill the capsule.
    1. Download the 03_capsule_animated.rh file to see the final product
  34. The final thing would be to create an HTML app to demonstrate it. Run the capsule.html file to see an example.
    1. The capsule.html file also shows how to access the animations of a scene and to change their CurrentTime value

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thank you, sounds interesting and might suit something I have been working on.   I was intending to attempt to create the same sort of effect by animating a cutting plane (to expose an object bit by bit).

      I cannot, however, see your examples.  The zip file contains just a text file.

      Author's profile photo Mark Doberenz
      Mark Doberenz
      Blog Post Author

      Vic, I'm not sure if the clipping plane option would work b/c I think it would clip other objects in the scene, but I'm not positive.

      Also, if you extract the txt file from the attachment and rename it to .zip, then open it, you should see the files. I know it's hacky, but I couldn't figure out any other way to upload the files.

      Author's profile photo Former Member
      Former Member

      Great post Mark.

      To create your own own custom image map, open up your favorite image editor (Microsoft Paint, Adobe Photoshop etc.) and do the following:

      1. Create a new file with a width of 50 and a height of 100.
      2. Make the top half the color of the empty tank and the bottom half the color of the contents.
      3. Save out as a .png or .jpg
      Author's profile photo Trinoy Hazarika
      Trinoy Hazarika

      Hi Mark,

      I am trying to run the HTML file. The viewer comes embedded in the HTML page with the capsule but animation is not working.

      what i have done.

      1. Unzip with you capsule file 2 type and got the files.
      2. Created a Dynamic web project in eclipse and copied all the files in the web
          content folder

      3. Then i try to run the HTML file on apache tomcat server.

      I see the viewer and the capsule but animation doesn`t work. please let me know if i am missing something here.

      Trinoy Hazarika

      Author's profile photo Mark Doberenz
      Mark Doberenz
      Blog Post Author

      In the HTML file at the top, there is a Mark of the Web (MOTW) line that you may want to try removing. It may make it work correctly then.

      Author's profile photo Trinoy Hazarika
      Trinoy Hazarika

      Hi Mark,

      Do you mean this line when you say MOTW.


      DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">



      Author's profile photo Mark Doberenz
      Mark Doberenz
      Blog Post Author

      No, this is the MOTW line:

      <!-- saved from url=(0016)http://localhost -->

      Just delete the whole line, save the HTML file, and then close IE and re-open to test it.

      Author's profile photo Former Member
      Former Member

      Hi Mark,

      Where is the attached zip file? I've not found in your post.



      Author's profile photo Mark Doberenz
      Mark Doberenz
      Blog Post Author


        Good to hear from you! I hope you're doing well!

        The zip is at the end of the post and it's called "" and at the top of the post, there's a section called:


        Which describes what to do with this file.

      Hope this helps!


      Author's profile photo Former Member
      Former Member

      Thanks my friend! it's all ok in Italy...I hope the same for you!