www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: BarbosaRTS on June 10, 2014, 03:45:52 pm

Title: Texture Scratching
Post by: BarbosaRTS on June 10, 2014, 03:45:52 pm
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?

Title: Re: Texture Scratching
Post by: EgonOlsen on June 10, 2014, 09:23:06 pm
You could blend both textures together using decal mode (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/TextureInfo.html#MODE_DECAL (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.
Title: Re: Texture Scratching
Post by: BarbosaRTS on June 11, 2014, 11:12:55 am
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 ......  ???
Title: Re: Texture Scratching
Post by: EgonOlsen on June 11, 2014, 12:35:49 pm
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.
Title: Re: Texture Scratching
Post by: BarbosaRTS on June 11, 2014, 02:59:49 pm
Finally I add two object3D, picture under, picture overground.

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

Thank you.