- Home /
Invisible block, Visible outline
The question of the hour is: How to make a transparent block with a visible outline? I am trying to make a platform who's outline is visible and it can't be stepped on. upon flipping a switch the block becomes solid. How can I make it invisible, but still have an out line? I've seen some solutions using shaders, but I have absolutely no clue how to manipulate that code. Or how I could turn it off when hitting a button. Any ideas?
Answer by Lo0NuhtiK · May 22, 2012 at 11:37 AM
A quick way be to just make a 32x32 image with a transparent background and a thin border (2px on mine) around the edges. Then make a material (transparent diffuse shader) and use that image for the texture. Then your box is transparent with a border. When looking 'through' the box, you won't see the other sides border's. Only see the borders on the outside of the box.
I tried making a texture in photoshop, the top layer being a dotted line for the outline, then the 2nd layer behind that had 0% fill. I added it to a transparent diffuse shader but the box still had a white fill on the face facing the camera, then a semi transparent for all the others, I can see inside the cube but I can't see through the cube. Any thoughts on that?
Used GI$$anonymous$$P, made a 32x32 image with transparent background, then lined the edges with 2px color border. Exported as .png .
Answer by kirpigiller · May 22, 2012 at 03:05 PM
You can try to use Alpha mask. For example, render your mesh with ColorMask A and Blend One Zero, then render the same but slightly scaled with ColorMask RGB(A) and Blend DstAlpha OneMinusDstAlpha.
Based on the number of things in here that I didn't understand, it sounds like it could work. I'm going to assume this has to deal with writing a shader script, as of yet I have no clue how to do that, I am looking that up now. And not that I want to be spoon fed, but, could you please provide a slightly dumbed down example?
Your answer
![](https://koobas.hobune.stream/wayback/20220613071759im_/https://answers.unity.com/themes/thub/images/avi.jpg)