alelievr / HDRP-UI-Camera-Stacking

Optimized implementation of camera stacking for UI only in HDRP.
MIT License
173 stars 22 forks source link

Does not operate normally in build mode #18

Open seoyeon01 opened 1 year ago

seoyeon01 commented 1 year ago

Unity : 2021.3.0f1

There is no problem in editor mode. However, there is a problem with the runtime after the build. (exe)

Nothing is drawn on the screen. The screen is black.

To be exact, the screen visible through the camera is not rendered. The UI, which is ScreenSpace Overlay, is rendered.

Disabling the UI Camera Object at runtime will draw the screen normally. When reactivated, the screen turns black. There is no particular error message.

In order to accurately communicate the cause of this problem, I tried to create a similar environment in a clean project, but it was not reproduced. (It works normally even at runtime)

Variables not included in the Clean Project are:

Which part should I check?

seoyeon01 commented 1 year ago

Adds information from the frame debugger. image Problem occurs through the Composite UI Camera Stacking process. Before Composite UI Camera Stacking process, all results seem to be the same and normal. In Editor Mode, UI Camera and Main Camera images are well combined in Composite UI Camera Stacking. but In Runtime Build mode, The screen turns black during the composite UI Camera stacking process.

seoyeon01 commented 1 year ago

Problem solved. Added Hidden/HDRP/UI_Compositing to Always Included Shaders. Is it okay to solve the problem like this?

alelievr commented 1 year ago

Yes it's fine to fix the issue this way. Though the shader should already be included in the build as I tried to serialize it in the HDCameraUI component 🤔

seoyeon01 commented 1 year ago

I think the problem was caused by how to use the addressable. If it's okay to use it this way, I think it'd be good to do a close issue. Thank you for your quick and thank you for making a good project! It was a great help.

alelievr commented 1 year ago

Hey, sorry for the delay, I didn't see the message.

Can I use SpriteRenderer with this(not Canvas UI)?

As you can see here in the code: HDCameraUI.cs:166 this package renders all the transparent objects of the scene if they match the specified layer. So yes you should be able to use it to render 3D transparent objects and sprites.

Is it possible to apply it as a way to draw 3D objects?

Yeah, though with the current filtering options in the DrawRenderers() it will only pick transparent objects. Also, it's not possible to have lighting on your 3D objects if you render them through this package.