Skip to content

Fix render target transparency not working with outlines#49

Open
TaniCorn wants to merge 1 commit intoRobinseibold:mainfrom
TaniCorn:main
Open

Fix render target transparency not working with outlines#49
TaniCorn wants to merge 1 commit intoRobinseibold:mainfrom
TaniCorn:main

Conversation

@TaniCorn
Copy link
Copy Markdown

@TaniCorn TaniCorn commented Sep 3, 2025

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.
image

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.
image
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
image

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.
image

Remarks:

Depending on the Render Targets resolution, a thin line of the camera clear color may still appear
image
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.

Added the URP Sample Buffer Alpha channel with the Opacity that gets used in the final Blend node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant