alelievr / HDRP-Custom-Passes

A bunch of custom passes made for HDRP
MIT License
1.25k stars 136 forks source link

Render from different camera to a texture/rendertexture #35

Closed ArieLeo closed 2 years ago

ArieLeo commented 2 years ago

Is it possible to from different camera and output the frame buffer to a texture/rendertexture with custom pass? my use case is for minimap , a custom buffer for terrain deformation or water ripple. any chance to get a small sample scene for this? I guess it's similar to CopyPass sample but rendered from different camera?

alelievr commented 2 years ago

Yeah, it's possible with the RenderFrom functions in the CustomPassUtils class. You can have a look at this file for implementation details: https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/Scenes/CameraDepthBaking/CameraDepthBake.cs#L45 (instead of render depth, or normal, you can render the color)

ArieLeo commented 2 years ago

Is it required the camera component to be enabled? this could impact the performance isn't? Or i can disabled the camera component just like the FPS Foreground sample? https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/FPS%20Foreground/FPSForeground.cs

ArieLeo commented 2 years ago

Oh i see, it works now. In previous beta version this setup wasn't working, i guess it was bugged. Like the custom pass just render once. it doesn't updating unless i keep the camera component enabled

ArieLeo commented 2 years ago

@alelievr any idea why this is happened

https://user-images.githubusercontent.com/6450517/138471551-13d1b0e7-7daa-42b3-b75b-c1c5f73f481b.mp4

?

ArieLeo commented 2 years ago

oh i found the issue, need to set the depth stencil format to none in the render texture. Sorry false alarm image