Hello,
I’m trying to implement the outline effect when object being selected in three.js stroke effect in babylon.
The outline effect when object being selected in three.js is as follows: three.js examples
Here is some of the shader implementation code in three.js:
/////////////////////
but now I I’m facing with some problems:
1、I try to pass in textureMatrix ,but it doesn’t seem to be working out right;
2、I can not find texture2DProj and unpackRGBAToDepth in Babylon;
The Threejs code is quite complicated, there are several passes and several materials involved:
It would be a non trivial task to port it to Babylon, and unfortunately I don’t have enough time to dig into it myself. But if someone is willing to help you, that would be a nice project to tackle!
Could you use the edge renderer and just make any meshes that occlude the edge semi transparent (and move them to rendering group 1) - https://playground.babylonjs.com/#TYAHX#282
Our product manager thought that the function you mentioned could not meet his need for stroke, so he found the stroke effect of Three.js, hoping that I can implement it in babylon, so this is a work requirement, I am trying to find a solution. If it really cannot be achieved, it will communicate with the product manager that this function cannot be achieved in Babylon at present.
Hello,Can the Material Plugins support multiple Passes? Now I have finished the depth pass calculation and the stroke calculation,but I don’t know what to do next.
No, you can’t do multiple passes within a single material plugin. You can do multiple passes by using multiple RenderTargetTexture or multiple post processes (or both!), depending on your needs.
The method of using multi-passes that you mentioned is used in post-processing. What I want to know is whether the material used on the object currently supports multi-channel?For example, I want to stroke an object with two passes.
We tested Highlight Layer,But there are some problems.Our product manager wants the object selected to have a stroke, including the obscured part.At present, if two objects are highlighted, and in the same highlighting layer, the place where the two objects overlap will not be highlighted, if placed in two highlighting layers, it will seriously consume efficiency.
No, materials / material plugins don’t support multiple passes out of the box, but if you write a custom shader or create a node material, you can implement the different passes in the material yourself.