Jump to content

[SOLVED] WidgetSprite image masking


photo

Recommended Posts

  • 2 weeks later...
Hi Ivan,

 

Could you provide more information about your case? Give us some specifics about what you're trying to do, and we'll try to figure out all the ways to reach it.

 

Thanks!

Link to comment

Thanks for the answer and apoligies if my post wasn't clear.

It's something like this.

IN7cu.png

I want to create level bar filling another shape different from a rectangle. For example a bottle for water, or a heart for a health level.

Link to comment

Could this be handled by some Unigine script code based on Image class by copying (or combining) mask 1-channel image into A-channel of image RGBA instance ?

Link to comment

Hi Ivan,

 

Unfortunately, you need to write your own shaders to implement this.

Fortunately, we wrote a sample for you :)

 

Short description:

 

sprite/textures contains a sprite and a mask for it

sprite/material contains a material for the sprite and a mask

sprite/shaders contains vertex and fragment shaders for the material

 

In code, we create a new WidgetSpriteShader with the sprite and assign created material.

 

P.S. Don't forget to add binaries and core files to make the sample works!

 

Sorry for inconvenience caused.

 

 

 

 

sprite_mask.zip

Link to comment
×
×
  • Create New...