Jump to content

Three questions about HighlightLayer


Newland
 Share

Recommended Posts

Hello,

I run into three questions  when I use BABYLON.HighlightLayer.

The first question is:I create two planes that are very close to each other ,and I set useLogarithmicDepth=true  to avoid z-fighting。But when I set HighlightLayer on the farside plane,the nearside plane looks flickering:https://www.babylonjs-playground.com/#2A2DG0.How can I avoid this flickering?

Secondly,when I distance the distance between two planes,there still is a hightlighted edge on the nearside plane.How can I remove the Unwanted edge?

Third,how can I adjust the thickness of the hightlighted edge?

Thanks!

 

 

Link to comment
Share on other sites

Hi Newland, welcome to the forum.

https://www.babylonjs-playground.com/#2A2DG0#1

1.  Flickering was removed by killing line 15.

2.  Unwanted highlighting was caused by not excluding plane2 from the highlighter.  (line 27)

3.  Thickness of blur is adjusted with lines 29 & 30.

Highlighter docs... http://doc.babylonjs.com/how_to/highlight_layer

Working better?  I hope this helps.  Report back if you have more questions/comments.

Link to comment
Share on other sites

Thank you for your help, Wingnut.

Your work make things better, The Flickering and the Unwanted highlighting were removed in the scene.

But the imperfect thing is,when we get close to the planes and tilt the camera,we will find the  green plane and the blue highlighting cross over the red plane.

For the third question,when I tried to set blurSize on lines and tube,I found that It did not perform well. The Thickness adjustment is not work for lines.For tube,it makes a lot of Light color highlightlayer and between the layers is  abrupt crack. https://www.babylonjs-playground.com/#NW3VF1#2

I wonder if we can combine the highlightlayers and make it strong,just like a lightsaber? :D

Link to comment
Share on other sites

Hello,

So About the light saber the tube with an additive higlight would be the best and to go even further I would rely on a glowLayer with emissive color 🙂

About the line, it is almost impossible to do as blurrring the color of a single pixel would require extra passes and be slower.

So as a demo I render to a pretty tiny texture to prevent losing to much intensity in the blur but unfortunately, this results in a lot of aliasing as you can see here:

https://www.babylonjs-playground.com/#NW3VF1#4

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...