Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'CameraData.renderer' is inaccessible due to its protection level #39

Open
skyburchard opened this issue Oct 11, 2020 · 5 comments
Open

Comments

@skyburchard
Copy link

skyburchard commented Oct 11, 2020

I added KawaseBlur render feature to my project from the 3DCharacterUI project and unity complains:

'CameraData.renderer' is inaccessible due to its protection level

It seems as though the renderer is no longer accessible from "renderingData.cameraData" in the execute method of ScriptableRenderPass. It must be marked protected at some point in development. Is there a new way to access the renderer, or even better the "cameraColorTarget" from this Execute function? I am using Unity 2019.4.1.1f1 / UniversalRP 7.3.1

@skyburchard
Copy link
Author

i figured out a solution. posting here for anyone who has the same issue.

  • first make "cameraColorTexture" public
  • comment out the offending line "cameraColorTexture = renderingData.cameraData.renderer.cameraColorTarget;"
  • just above the line "renderer.EnqueuePass(scriptablePass);" in the AddRenderPasses method add the following line: "scriptablePass.cameraColorTexture = renderer.cameraColorTarget;"

@bodardr
Copy link

bodardr commented Oct 15, 2020

Thank you soooo much! I've been looking for this! Made my day :)
I jumped to conclusions too fast. Sadly, this did not work for me :(. Luckily, I found a solution.
To get the cameraColorTarget, you can instantiate a RenderTargetIdentifier with the _CameraColorTexture address (or _AfterPostProcessTexture if you need it) and this will give you access to the color target.

@thickiran
Copy link

Thank you soooo much! I've been looking for this! Made my day :)
I jumped to conclusions too fast. Sadly, this did not work for me :(. Luckily, I found a solution.
To get the cameraColorTarget, you can instantiate a RenderTargetIdentifier with the _CameraColorTexture address (or _AfterPostProcessTexture if you need it) and this will give you access to the color target.

i have failed to do this, can you explain in detail

@bodardr
Copy link

bodardr commented Oct 18, 2020

In KawaseBlur.cs, line 64, the cameraColorTexture normally references the now internal renderer.

Instead, you can replace it by this : cameraColorTexture = new RenderTargetIdentifier("_CameraColorTexture");

In the Frame Debugger, you can see the _CameraColorTexture in action notably in the Copy Color Pass.
If you want the full post-processed screeen, you can dig up the _AfterPostProcess texture as well.

Capture

Once you have a RenderTargetIdentifier, you can use Blit on the command buffer as a source or destination texture. Happy Post-Processing ;)

@thickiran
Copy link

In KawaseBlur.cs, line 64, the cameraColorTexture normally references the now internal renderer.

Instead, you can replace it by this : cameraColorTexture = new RenderTargetIdentifier("_CameraColorTexture");

In the Frame Debugger, you can see the _CameraColorTexture in action notably in the Copy Color Pass.
If you want the full post-processed screeen, you can dig up the _AfterPostProcess texture as well.

Capture

Once you have a RenderTargetIdentifier, you can use Blit on the command buffer as a source or destination texture. Happy Post-Processing ;)

this solved the problem cheers mate

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

No branches or pull requests

3 participants