0
\$\begingroup\$

I have a plane object (a normal Unity 3D Plane, but it can be a complex floor in the future) and a cube is moving on the plane.

Currently, the plane is transparent. I want to make the plane opaque as the cube passes along it. But I want it to do this thing in an incremental way. I mean that as the cube passes through the area, the passed area becomes opaque.

I can do this by cutting the plane into smaller pieces and then, as the cube pass through each piece, I change its opacity using this logic. But dividing the plane into smaller chunks, each of which is a separate models, is not an efficient approach. Is there any way to do this using shaders or something else?

\$\endgroup\$
7
  • \$\begingroup\$ "Opaque" is not a verb. Have you looked into past Q&A about painting effects? It seems to me this is the same as painting an image or mask, except that the cube is your paintbrush instead of the mouse cursor. \$\endgroup\$
    – DMGregory
    May 12 at 9:39
  • \$\begingroup\$ Thanks, I have changed the title but i don't think it is related to painting as I am not willing to change or apply color. I want to enable the same color of the object but as my cube passes through the object. Nevertheless thanks for the "painting effects" hint. I will check it. \$\endgroup\$ May 12 at 9:54
  • \$\begingroup\$ Are you trying to change the alpha of the whole object or the part of the object that is masked by the cube? \$\endgroup\$
    – Mangata
    May 12 at 9:54
  • \$\begingroup\$ Hint: the alpha value (transparency) is part of the colour. So you can paint into just the alpha channel, or use a texture that is only alpha. \$\endgroup\$
    – DMGregory
    May 12 at 9:55
  • 1
    \$\begingroup\$ basically a scratch off effect? gamedev.stackexchange.com/questions/101453/…. Instead of having an area covered, thats your original map. The scratched parts are your transparence/ opaque \$\endgroup\$
    – Zibelas
    May 12 at 10:40

0

You must log in to answer this question.

Browse other questions tagged .