- Home /
How to make part of image transparent?
I am new to unity and want to know how to make part of image transparent. So, that the image behind front image is visible from that part of transparent region in front image.
There are lots of ways to do that. The simplest method is to clear the blank area of the front image in Photoshop and save the image as a .png file. Then use it as your texture in a Transparent Cutout shader material.
Dear I want it dynamic. That is it can be any rectangular area of front image (that is on user choice) which need to be transparent so that user can see behind image.
If these are 3d objects then the object in front (the rectangle) can use a Depth Only shader to write to the depth buffer which will convince Unity that it shouldn't write that part of the back object. If it's GUI - I can't think of a way short of actually modifying the texture.
If my understanding of your intent is accurate, then I would recommend writing a shader that would clip the area bound by a given Length and Width parameter. An external script could then provide that shader with those parameters dynamically. Of course, such a method assumes that your images are used as textures for a plane.
Yes these are simply 2d textures. It is similar to crop some rectangular region from front image so that one can see through the it to the portion of back image from this hole. Any Help ???
Answer by whydoidoit · Sep 28, 2012 at 07:21 AM
So if you put your textures on planes, which face the camera and then use this shader to render something infront of it there by cutting a hole. If your textures are unlit you might have to fiddle with the order of the shader (I believe there are instructions on that on the wiki article I linked).
Your answer
Follow this Question
Related Questions
Errors! Nooooooooooo! :( 2 Answers
how to create checkbox preference regarding image effects?? 0 Answers
Rendering path bug/error 1 Answer
Distance from pixel to camera in shader 0 Answers