cakeslice / Outline-Effect

Outline Image Effect for Unity
MIT License
1.48k stars 201 forks source link

[Bug] All Objects with Outline component are drawn #53

Closed JeReT closed 3 years ago

JeReT commented 4 years ago

All objects which have an outline component are drawn all the time. Regardless if eraseRenderer is set to true or not. Maybe I misunderstood the concept of the component. But if the outline should not be displayed when eraseRenderer is off, you would need to apply the following patch in OutlineEffect.OnPreRender:

// ...
            if(outlines != null)
            {
                foreach(Outline outline in outlines)
                {
                    LayerMask l = sourceCamera.cullingMask;

                    if(outline != null && l == (l | (1 << outline.originalLayer)))
                    {
                        //PATCH START
                        if (outline.eraseRenderer)
                            continue;
                        //PATCH END

                        for (int v = 0; v < outline.Renderer.sharedMaterials.Length; v++)
// ...
cakeslice commented 3 years ago

The point of eraseRenderer is to draw an object on top of the outline buffer so it "erases" outlines behind it so yes, it's supposed to render.