Ink Cartridge

Im trying to do an ink cartridge: I was thinking that it could basically consist of a capsule with a solid color and a float representing the percentage of the capsule to render from top to bottom or vice versa, what ever is doable. I see it is possible to add float properties to a shader.

My question is: Is it possible to make a shader that only renders a percentage of the capsule? Or am i going about this in the wrong way?

Funktionality wise it is somewhat compareable to the Reveal Non-Uniform Texture shader on the wiki, only i don’t really need all the alpha channel stuff only need to not render some percentage of the capsule based on the float property value.

Regards,
Marc

Without a special shader, it seems a little scaling and texture coordinate manipulation could get you the exact same effect. That is, if I’m understanding your question. Maybe a quick diagram could help.

You are right. Ended up doing a capsule and just scaling it, figured it out after posting the question, but would still know if it is possible to do with a shader though, just out of curiosity.