Hi all,
Thanks for reading (and sorry if this is a bit wordy), I've had a Google and a think on this but can't seem to work out what's happening. I'm new to shaders and after a few tutorials have started to try to write my own, and I've started by trying to attempt to emulate old VHS/CRT effects for a game I'm planning. So far I've done a very basic colour blur/bleed effect, which works, and I've set it as the render material for the Main Camera using SetReplacementShader() as I'm intending to use it as an image effect. The shader code is here: http://pastebin.com/09NaxyKU
It works to a degree, and all the objects in the scene are rendered with their colours displaced, but it seems to be sampling on a per-texture basis rather than sampling from the whole screen as I had expected. This means that the effect on a 50x50 texture is way more obvious (and less convincing) than on a 500X500 texture, and scaling the images down or up doesn't change the effect size, just makes the pixels look really blocky. The effect also abruptly cuts off at the edge of the sprite instead of having it bleed over into the background which is what I was expecting.
I wanted the effect to apply to the whole screen equally rather than varying on each texture, and I thought by applying it to the camera it would do so. Is there something I've missed/fundamentally not understood (more likely!) I am suspicious that _MainTex needs to be set to a render texture or something but can't for the life of me work out how to capture a render texture, apply the effect, then display the result.
Any help would be greatly appreciated!
Thanks
↧