Cut hole though centre of shader on camera

Hi,

Is it possible to cut/put a hole through the centre of a shader effect applied to the camera so I can see through?

I purchased the Camera Filter Pack from the asset store while its on sale and I’m using theCameraFilterPack_FX_Hexagon_Black effect and would like to put a hole through it faded at the edges if possible, as I have no clue about writing shaders any help, advice would be appreciated, thanks.

I recommend talking to the person who wrote the original.

Thanks for the reply, I’ve tried but he’s not responding … :frowning:

OK I’m really stuck on this one …

I’m using a post processing effect shader on the camera that requires the Render Texture function of Unity Pro, post processing shaders are different from regular shaders as there is no model to stick the material on.

So cannot use a depth mask , alpha shader or at least I think I cannot, as I said before I’m no shader programmer so was looking for some advice.

Thats why I’d like to know if I could add/code into the shader to see through the centre … or use another post processing shader to mask the centre.

Thanks.

you should be able to use alpha values and set the shader to transparent. try

if (uv.y < 0.5){color.a = 0} to make half of the shader transparent, if that works you can make a hole.

drudiverse thanks for the input …

OK, I’ve managed to get a blank square in the middle but can’t get it transparent …

1735866--109626--Screen Shot 2014-08-15 at 17.02.44.png

what a cool shader!!!

try this at the top of the shader:

    }
    SubShader {
        Tags {"Queue"="Transparent" "RenderType"="Transparent"}
        LOD 200
        //ZWrite On
       // Cull Off
        Blend OneMinusSrcAlpha One
        CGPROGRAM

and then to make a round zone do something like if(xx + yy -0.5 <= 0){color.a = 0}
iphone - How to find the distance between two CG points? - Stack Overflow to find all point smaller than distance from centre.

If it’s a full-screen effect then standard blending won’t work: it’s expected to produce 100% of the final output. You’ll need to add a bit to the end of the fragment shader to blend in the original input over the resampled result.

OK, got the zone sorted, thanks drudiverse, just the alpha now, and Daniel Brauer thanks for the input.

1736591--109657--Screen Shot 2014-08-16 at 07.53.51.png

drudiverse the code snippet does not work, Daniel Brauer can you elaborate on your answer please.

what’s going on in that shader, is that a complex effect is being applied on top of a regular render texture. in the image effect code it will have the raw render texture code, incolor.rgb prior to the distortions and outcolor.rgb after the distortions, at the very beggining and end of the pixel shader/surface shader function… so you can probably go in the code and add 2-3 lines at the end merge the two rgb values, try "if y > 0 use incolor.rgb else use outcolor.rgb

have fun with the pixel shader and go up the signal chain of rgb values going from the end, find the output rgb, and then go up the maths code and see how the rgb values change over time, until you find the original in one at top of code. it should all be inside a single fragment shader with in rgb and out rgb and perhaps functions and maths in the middle.

And here we are. Thanks for the suggestion.

AAA Super Hexagon now available on Camera Filter Pack v1.3

1 Like