Author Topic: Texture Scratching  (Read 717 times)

Offline BarbosaRTS

  • byte
  • *
  • Posts: 8
    • View Profile
Texture Scratching
« 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?

« Last Edit: June 10, 2014, 03:49:24 pm by BarbosaRTS »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11749
    • View Profile
    • http://www.jpct.net
Re: Texture Scratching
« Reply #1 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) 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.

Offline BarbosaRTS

  • byte
  • *
  • Posts: 8
    • View Profile
Re: Texture Scratching
« Reply #2 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 ......  ???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11749
    • View Profile
    • http://www.jpct.net
Re: Texture Scratching
« Reply #3 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.

Offline BarbosaRTS

  • byte
  • *
  • Posts: 8
    • View Profile
Re: Texture Scratching
« Reply #4 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.