For the scene in editor there seems to be something called “SceneSelectionPass” @ Unlit.shader, I’d like to use the same effect for the in-game selections. How can I achieve that?
Note that I’m fairly skilled at low-level rendering techniques, but I have yet to dive into HDRP source code.
Does this require me to fork and modify HDRP to my needs, or can Unity’s RP be somehow extended to include such feature?
You probably won’t be able to use it as is.
But basically, this selection pass shader is used to render a buffer with object ids that is later on used in the scene view in a post process to draw the outline.
You could probably implement something similar by using a custom post process and render you in-game selected object in a separate render texture as a mask.
So the way to go is through PostProcessing Stack ?
If I understood it correctly, inside of a custom PostProcessEffectRenderer, I would have to re-render the object I want to outline with my shader and merge it with the final image buffer. An example would be nice to have, otherwise I’ll look into myself later and see if I can figure out. Thanks!
I previously participated in this thread which may be of some use possibly. Not sure how well (or if at all) it will translate to working in an SRP, but maybe it is a starting place.
If you end up figuring anything out please do share. I will probably try playing around with some things myself as well once I get some free time.
Remy, could Unity consider implementing outline effects from the scene window? It works well with the HDRP and all released Unity versions. We might have to add in some extra filtering and passes to make it more in-game presentable but it seems like a good standard feature to be included.
Maybe you should go to the feedback site and ask for the feature : https://feedback.unity3d.com/
I’m not sure it’s an absolute necessity. I don’t know the proportion of games that need a selection highlight for example.
And for those who need it, maybe they don’t want it to be exactly how the selection in the editor is done…
I’ve written a simple version for the stack, will put the first rough version on the Asset Store for free soon. (As I also noted in the Feedback thread)
This isn’t exactly a proper solution but a lazy one nonetheless.
The way I did it is using two cameras, one to render the scene and another one with this postprocessing applied ( without RenderReplacementShaderToTexture ). One camera renders everything except Outline layer, while the second camera renders only Outline layer, depth clear and with this PostProcess effect applied.
edit:
Actually it draws over every other object, not a good lazy solution. So ignore this
Remy,
Pretty much all FPS/TPS games use it for showing selection, possible selection and in world highlighting.
All tycoon/RTS games live off on this as mouse over effect is absolutely a must.
Any 3d game with a tutorial will probably use outline effects to guide the player.
The proportion of games is definitely very very high and something this obvious should not be going through “feature-request-channel”. The real question should be the feature set of the implementation and the performance increase by having a built in component. Seriously we have deferred decals, atmospheric scattering, subsurface scattering, vertex animation, 20+bone weight support, cinematic post processing and all the cool stuff that blows any developer’s mind, but here we are thinking if outline effect should be included…
Ohhhhh, sorry, ok, now I understand it. You posted this asset to tell that one can learn how to do it by buying this asset and taking a look at the sources.
I would like to vote for an Outline system done by Unity. It seems to be connected very closely to the render pipeline / shaders, etc.
Therefore I think it should be Unity’s work to provide such an Outline function, and it would also serve as a test scenario for them.
Thank you.