- Home /
The question is answered, right answer was accepted
Smoothing pixels via Shader / Tree Leaf Shader
Hi! I was hoping for some help regarding shaders.
Being able to paint surfaces is the main feature of our game. We do this by giving each level 2 textures, "MainTex" and "PaintTex" which we combine using a custom shader. The MainTex is the level textures, while the PaintTex is a transparent texture that our weapons can paint onto.
The problem is that we need to keep the resolutions of PaintTex low for performance reasons, which makes the paint look noticably pixelated as you can see here:
However, we're able to dramatically reduce texture resolution AND eliminate the pixel-problem by using Unity's "Nature/Tree Soft Occlusion Leaves" shader and using it's Alpha Cutoff setting. With this shader we're able to use tiny pixel art textures and let the shader smooth it out to produce results like this:
Sadly by using this shader we lose all of the features of our custom shader such as bump-map mixing. I was hoping to add this smoothing functionality from the Tree Leaves shader to my existing shader but I don't know where to start.
Does anybody know how to accomplish this? Thanks for any help!
TL/DR: Does anyone know how to make a shader that smooths pixels like the inbuilt Leaves shader?
Sorry to bump but I'm really struggling with this and can't move on with development until I've solved this. If this is against the rules I'll withdraw this comment.
Answer by cjdev · Jan 05, 2016 at 01:52 AM
Unity actually distributes the source for their shaders, the download is just not exactly advertised. You can go to "Get Unity" > "Free Download" > "Windows" > "For Windows" > "Built in shaders". The one you're looking for is under "\DefaultResourcesExtra\Nature\SoftOcclusion". It's a pretty simple shader so I don't think you'll have much trouble integrating it with your own.
Thankyou for your help. Sadly Unity Answers didn't let me know I'd had a reply. After a bit of searching I found the shader sources and have accomplished what I needed to.
If I'd have been notified I would have saved a lot of time! Thanks again!
Follow this Question
Related Questions
CRT/LCD screen shader (for materials) 4 Answers
Combining 2 black-white textures 2 Answers
Are shaders more efficient than manual pixel replacement? 0 Answers
Rendering Depth Texture 0 Answers
How to use a shader to write to a mipmap (partial mipmap update) 2 Answers