Texture Scratching

Started by BarbosaRTS, June 10, 2014, 03:45:52 PM

Previous topic - Next topic

BarbosaRTS

Hi,

I would like to realize an effect of scratching, with the touch scratch a texture to appear the other one.

I puts an image " scratch here " in first texture on a plane object and second image in the second texture.

You have an idea?


EgonOlsen

You could blend both textures together using decal mode (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/TextureInfo.html#MODE_DECAL) and modify the "scratch here" texture's alpha when scratching by using an ITextureEffect implementation. However, this causes texture uploads to the gpu and these aren't very fast. It might be feasible though, if how don't need 60 fps in this case.

BarbosaRTS

Thank you.

I blend both textures, it's ok for apply effect with seteffect.
But now how make this effect to apply alpha reduction.

ITextureEffect :

init, apply, containsAlpha ......  ???

EgonOlsen

Let containsAlpha() return true and set the new alpha in the destination int[] array. The format is ARGB, i.e. alpha is located in the upper 8 bits of the int.

BarbosaRTS

Finally I add two object3D, picture under, picture overground.

When getAction return MOVE i reduce transparency of Object :D.

Thank you.