Zhenya Posted March 31, 2022 Share Posted March 31, 2022 I'm making a first-person shooter and I want two cameras to work for me. The first - rendered the environment, and the second - hands with weapons. But I ran into a problem - Unigine shows the render only from the camera that has the Main Player check mark and ignores all other cameras. An attempt to set the Main Player check mark on two or more cameras only led to the fact that Unigine took the render of the lowest camera in the hierarchy, also ignoring all the others. How can I combine a render from two cameras? Link to comment
rohit.gonsalves Posted April 1, 2022 Share Posted April 1, 2022 @Zhenya It is unclear for me to understand what do you mean by Combine a render from two cameras? I generally do a two camera render and use it for multi viewing application. Some may use one render to show in virtual displays of main camera render. What exactly you want to achieve? May you clarify? Rohit Link to comment
silent Posted April 1, 2022 Share Posted April 1, 2022 I guess the main idea would be to render additional viewort on top of the main one with a help of WidgetSpriteViewort (similar to this example: https://developer.unigine.com/en/docs/latest/code/usage/mirrors_viewports_materials/). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
rohit.gonsalves Posted April 1, 2022 Share Posted April 1, 2022 14 minutes ago, silent said: I guess the main idea would be to render additional viewort on top of the main one with a help of WidgetSpriteViewort (similar to this example: https://developer.unigine.com/en/docs/latest/code/usage/mirrors_viewports_materials/). Exactly, But it will require to do certain programming. Using the additional RenderTarget, rendert to texture and then use that texture, for next rendering. But the above question asks for do it in scene graph. As @Zhenya trying to achieve it in editor. Rohit Link to comment
gr7.76 Posted April 1, 2022 Share Posted April 1, 2022 (edited) I think they mean "render in two passes/textures: 1 for the world, and 1 with the avatar". The final view combines the two. But anyway, the solution is still based on the answer already given by silent: 1. `renderTexture2D` for the scene 2. `renderTexture2D` for the player's hands 3. use custom shader to combine Tex1 and Tex2 (Warning: there's going to be overdraw where the pixels for the player's hand overlap the world) Edited April 1, 2022 by gr7.76 Link to comment
Zhenya Posted April 1, 2022 Author Share Posted April 1, 2022 4 hours ago, rohit.gonsalves said: @Zhenya Мне непонятно, что вы подразумеваете под объединением рендеринга с двух камер? Обычно я делаю рендеринг с двумя камерами и использую его для нескольких приложений просмотра. Некоторые могут использовать один рендеринг для отображения в виртуальных дисплеях рендеринга основной камеры. Чего именно вы хотите достичь? Можете ли вы уточнить? Rohit I want the renderers of the two cameras to overlap each other giving a result similar to this - 2022-04-01 12-22-09.mp4 Link to comment
Zhenya Posted April 1, 2022 Author Share Posted April 1, 2022 5 hours ago, silent said: I guess the main idea would be to render additional viewort on top of the main one with a help of WidgetSpriteViewort (similar to this example: https://developer.unigine.com/en/docs/latest/code/usage/mirrors_viewports_materials/). Yes, it looks like what I need. I tried to repeat the code and I got this code - https://paste.myst.rs/57w6e9rx . At startup, it gives me this error - Link to comment
Zhenya Posted April 1, 2022 Author Share Posted April 1, 2022 6 hours ago, Zhenya said: Yes, it looks like what I need. I tried to repeat the code and I got this code - https://paste.myst.rs/57w6e9rx . At startup, it gives me this error - I was able to solve my problem after all. The article that was shown helped me a lot. 2 Link to comment
Recommended Posts