Fix render target transparency not working with outlines#49
Open
TaniCorn wants to merge 1 commit intoRobinseibold:mainfrom
Open
Fix render target transparency not working with outlines#49TaniCorn wants to merge 1 commit intoRobinseibold:mainfrom
TaniCorn wants to merge 1 commit intoRobinseibold:mainfrom
Conversation
Added the URP Sample Buffer Alpha channel with the Opacity that gets used in the final Blend node.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and Source:
I had a camera that rendered a single object to a Render Targetm with RGBA channels. A Raw Image would then render this Render Target to it.

However when using the Outline effect, no matter what settings were changed in the effect and URP pipeline, it would generally render the Camera's clear color in the background, even if the alpha was 0. Changing depth information would render the effects background color, even if it had an alpha of 0.

The camera has to render a clear color. If it renders the skybox, the skybox is rendered. If the background is uninitialised the default behaviour is to render on top of non-existing pixels leading to ghosting effects on the RT.
This was a fix for my own very specific use case, however I don't think it negatively affects the function of any other parts of the tool, as far as I've tested. I also believe it may answer the Issue #7
Fix:
The fix is to add the alpha value of the URP Sample Buffer (BlitSource) to the final Opacity value in Outline.shadergraph

Result:
The result is that Render Targets rendered from a camera, can now use the outline effect and still render to Render Targets with a transparent background.

Remarks:
Depending on the Render Targets resolution, a thin line of the camera clear color may still appear

Just make the camera's clear color the same as the outline color and it is not noticeable.
Personal Comments:
I apologise if this is not an issue or is irrelevant to the repo. This is my first contribution I've made to a public repo, and I'm mostly doing it just because I had a specific issue with the plugin.
I also realise that the repo is no longer active, however on the off chance someone may need this solution I would like to open this for consideration or just in case someone was doing what I did which was searching the issues and PR's to see if there was a solution.