# \[SOLVED\] Highlight posteffect broken in Engine 1.66

**URL:** <https://forum.playcanvas.com/t/solved-highlight-posteffect-broken-in-engine-1-66/33923>\
**Category:** Help & Support\
**Tags:** editor, scripting\
**Created:** [November 23, 2023, 4:27pm UTC](https://forum.playcanvas.com/t/solved-highlight-posteffect-broken-in-engine-1-66/33923 "2023-11-23T16:27:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArthySlappyInc](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/arthyslappyinc/32/22625_2.png) [@ArthySlappyInc](https://forum.playcanvas.com/u/ArthySlappyInc)\
**Post date:** [November 23, 2023, 4:27pm UTC](https://forum.playcanvas.com/t/solved-highlight-posteffect-broken-in-engine-1-66/33923/1 "2023-11-23T16:27:53Z")

</div>

Hi everyone,

I have an application where I use some posteffects to achieve a sort of highlight effect to highlight an object.  
This effect seems to have issues since the 1.66 engine version where it seems like the object is having Z-fighting issues.

To give some context how I achieve this effect:

- There is a posteffect on the camera, in this case to edit the brightness and contrast to make the image washed out.
- I created another rendering layer (WorldNoPost).
- There is a script on the camera that sets this new layer to the amera.disablePostEffectsLayer.
- The highlighted object is added to this new layer which should ignore the posteffect.

I have created an example project to showcase the issue:  
[https://playcanvas.com/editor/scene/1905900](https://playcanvas.com/editor/scene/1905900)

Here is the desired result in 1.65.5 (Previous Minor):

 ![1.65](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/8/3/83d6f0a0f042d7182f443517b50111599e7b9288.jpeg)

And here is how it looks in 1.66.3:

 ![1.66](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/c/7/c78b2d89e977a1b4b86da2b0530ecb3b39b34e1e.jpeg)

It looks like there is some Z-fighting with the object that needs to be highlighted.  
If I remove the highlighted object from the normal ‘World’ layer, it is still correct in 1.65.5, but in 1.66 it just dissapears in the Z-fighting like pattern:

 ![1.66 no world](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/2/e/2e5defac0c02806de112a0322a8b8b4ceeef3090.png)

Hopefully someone can help me resolve this issue. (Or give me an idea if there’s another way to achieve this effect?)

Thanks in advance for the help!

---

<div class="post-metadata">

**Author:** ![mvaligursky](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/mvaligursky/32/11681_2.png) [@mvaligursky](https://forum.playcanvas.com/u/mvaligursky)\
**Post date:** [November 23, 2023, 5:30pm UTC](https://forum.playcanvas.com/t/solved-highlight-posteffect-broken-in-engine-1-66/33923/2 "2023-11-23T17:30:21Z")

</div>

Try this in PostTest.js

```javascript
var PostTest = pc.createScript('postTest');

// initialize code called once per entity
PostTest.prototype.initialize = function () {
    this.entity.camera.disablePostEffectsLayer = this.app.scene.layers.getLayerByName('WorldNoPost').id;
    this.brightnessPost = this.entity.script.brightnessContrast;
    this.layer = this.app.scene.layers.getLayerByName('WorldNoPost');
    this.layer.clearDepthBuffer = true;
};

PostTest.prototype.update = function (dt) {
    //flip post effect
    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.brightnessPost.enabled = !this.brightnessPost.enabled;
        this.layer.clearDepthBuffer = !this.layer.clearDepthBuffer;
    }
};

```

---

<div class="post-metadata">

**Author:** ![ArthySlappyInc](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/arthyslappyinc/32/22625_2.png) [@ArthySlappyInc](https://forum.playcanvas.com/u/ArthySlappyInc)\
**Post date:** [November 24, 2023, 8:05am UTC](https://forum.playcanvas.com/t/solved-highlight-posteffect-broken-in-engine-1-66/33923/3 "2023-11-24T08:05:19Z")

</div>

Yes, this worked to get the desired result again.

Thank you for the help!
