Open clonzeh opened 1 year ago
Are you trying to accomplish this by stacking multiple renderer features of type outlines? The renderer feature was not designed to be used that way, so that is possibly the reason for the weird artefacts, if that's the case.
Hey @Robinseibold, is there any way this asset can be used to create multiple outlines like in @clonzeh's case?
I'm also using multiple (2) ScreenSpaceOutlines feature renderers in my ForwardRenderer trying to achieve a similar effect. I'm running into some visuals issues and have been playing around with the layers to see if it's a matter of configuration. But I can't quite get it to work.
I'd like to use this for multiple forms of outlines in my project too but haven't found an ideal solution. Can this renderer feature be used to make differently colored outlines in some way? I'd like to not resort to outline vertex shaders since those can be messy/very case specific, but honestly any direction on how you'd tackle this problem would be really insightful.
Oh one more tidbit: I'm not trying to utilize two outlines on one object at the same time, but instead trying to selectively apply one of the two renderer features using layers. So one for all objects, and another just for player selected objects if that makes sense.
@adrian-miasik stacking multiple ScreenSpaceOutlines renderer features will result in undefined behaviour.
Instead what I would do is pack more data (like what color the outlines of one object should be) into the normal texture that is generated (ViewSpaceNormals.shadergraph
), and then utilise that data in Outlines.shadergraph
to alter for instance color of the outline.
I took a quick peek at the shaders, and sadly, this feels a bit out of my depth/out of scope for me. I'd likely have to re-watch your great outlines video to get a better understanding of what is technically happening and experiment with it when I have some free time.
But alas, I appreciate the input :)
I've been thinking about implementing different colored outlines in a side project of mines. Will post an update here if/when I do!
Ooo, that would be freaking amazing! I'd love to try it out if it comes out/when it's ready! (If you need a beta tester, hmu)
And this doesn't often get recognized enough, but thank you for all your hard work and providing open sourced solutions and knowledge out there for the rest of us. I know I personally appreciate it!
And this doesn't often get recognized enough, but thank you for all your hard work and providing open sourced solutions and knowledge out there for the rest of us. I know I personally appreciate it!
Thank you and likewise! 😊
@adrian-miasik You mentioned this should be fixed in #15, I'm wondering if you have still been using this feature without any issues? My results are similar to what you described in this issue on Jan 10th. My intent is to use black outlines for most of the world, player character, and then a special white outline for certain points of interest - no need to have multiple outlines on one object. In fact that's kind of my issue, the multiple outlines seem to be bleeding into each-other in some situations where they shouldn't be, here's some examples and my configuration.
ScreenSpaceOutlinesMain: Black outline on layers: Default, World. ScreenSpaceOutlinesHighlighted: White outline on layer: WorldHighlighted.
For reference, this is what the character model is supposed to look like without any artifacts:
Pic 1: This blue character model is in the Default layer, and should have black outlines. When it's "inside" of a WorldHighlighted model, the white outlines bleed onto the character, sometimes 'nicely' as seen in this image, and sometimes less so as seen in pic 2. While I'm colliding with the model in this image, I don't have to be, it happens even if I move smoothly through it.
Pic 2: Another example of the same issue with worse artifacts, and we can also see the black outlines slightly bleeding onto the bottom corners of the WorldHighlighted models:
Pic 3: The issue also sometimes happens when my character model occludes a model from the WorldHighlighted layer:
ScreenSpaceOutlines config:
The above screenshots were done with the Main/black outlines coming before the Highlighted/white ones in the renderer features. If I swap them around to have the Highlighted/white ones first, it fixes a lot of the issues described, however the black outlines bleed onto the highlighted models even more:
The issue persists if I change the render pass event to 'After Rendering Opaques'. Setting it to After skybox fixed some unrelated visual issues with the outlines in my case. Playing around with these and using different ones for the two outlines seems to give the same results as just changing their order.
I'm testing this on Unity 2022.3.1f1. I can confirm the models have the layers properly set recursively including every child GameObject.
All that said, the previous version from this repo I attempted to do this with (the one from Nov2022) entirely broke when I used 2 ScreenSpaceOutlines, so nice work even if any issues remain! (may be a config issue on my end though)
I'm trying to use this with 3-4 different outline types, but I'm having a lot of issues with specific things. I'm putting a Black outline on everything but then wanting to use red, green, and blue for specific objects.
I tried accomplishing this by making 3 different layers, no outline, red outline, blue outline, and it seems to work but when I add the 3rd render feature for blue outlines, it starts behaving weirdly with the red one.
https://i.imgur.com/zhB74ND.png (red and black) https://i.imgur.com/5lOhbWS.png (blue and black) https://i.imgur.com/7Bh3qjW.png (red, black, and blue)
Which is weird because I'm setting the red outline mask to the player, and the blue one to the chest, but when both are enabled it puts them both on the player and none of the chest.
Another issue I'm having is getting the outlines to behave correctly when behind other objects. In this case I have the blue outline which is occluding nothing: https://i.imgur.com/KxQijul.png And in this case I have the blue outline occluding the player's layer: https://i.imgur.com/bi72fec.png And in this case I have the blue outline occluding the ground: https://i.imgur.com/FuAzNme.png (with the chest being in the ground)
The effect I want to have is for the outline to just stop once it's occluded, I don't want it to create a new outline between object that's occluding it and itself.
Any pointers, ideas or features that expand on this is much appreciated!