Post processing effects using shaders

Hi everyone.

I am looking at implementing an effect for a game im working on. I see that there is a bloom effect for Unity Pro 4.0 http://docs.unity3d.com/Documentation/Components/script-Bloom.html. As I dont have pro can I just implement this myself using a custom shader? :face_with_spiral_eyes:

Many thanks

Dori

Pretty much all image effects require the ability to render to a texture, which is a Pro-only feature.

Thanks for the reply. So can I not implement a custom shader without pro? I thought I read you can write custom shaders in free (blur for example) and the difference was that you could only not apply them to the whole rendered frame at the end of the frame proceeding. Is that wrong?

No, it’s right.
You can implement a custom shader, however you have no access to already rendered pixels (which in Pro is available via RenderTextures, GrabPass or ImageEffects) which would be required for certain effects.
With some tricks you might render an object in a way that it appears blurred however those effects can’t be compared to what is possible in Unity Pro.

Thanks for the reply, much appreciated.

When your saying they cant be compared do you mean that trying to implement these effects on the render-pass will look rubbish (and I imagine will not be as simple to wrtie) compared to using pro and implemented on the already rendered pixels?

Thanks again

Certainly not as simple and not as fast and for most effects not the same look (doesn’t have always to be that ugly if done right).
For example a fake object blur could be achieved by rendering an object multiple times: first pass would be solid, then add semitransparent passes with extrusion along the normals. Or if you want to have a rotation blur for car wheels you would just rotate the semitransparent passes.
A glow effect might be faked in a similar way, here you would use additive blending instead of regular alpha blending. Or you could add halo sprites in front of the object.
It all depends on your creativity and what look you are trying to achieve. Also some “fake effects” are available in the asset store.

The reason for render textures is that you render the main scene to a texture, then use this texture as the basis for the shader. The shader then uses this texture blurred (via blit multitap usually), which is then rendered on a quad to the final camera with a useful blending such as add blend, and a threshold for how bright pixels need to be in order to qualify for bloom. This is your classic technique, so you need render textures to do it at any useful speed.

You can’t do this without render textures properly. You could probably every read n pixel from the back buffer and draw to a texture but it would look awful, and very low framerate. With render textures, you get to draw a camera to a texture, avoiding any sort of slow pixel operation.

Hmmm, my post didnt seem to send


Thanks for the replys - its a shame as I cant afford the pro version at this moment in time so I will have to go with a different engine :frowning: