![]() My custom renderer should do much better than Camera.Render given the same scene. The game scene I showed isn’t even half the maximum. Note that this is already the hypothetical maximum. The highlighted part (9.368ms) are my custom rendering systems. My custom renderer can render all these in 7-10ms. I also added one layer for non static sprites that has 4,500 units. I prepared 5 layers for static sprites that has 16,380 sprites per layer. I simulated the hypothetical maximum number of sprites in our game. I improved my custom sprite manager to handle static sprites more efficiently. So I made a separate project to test if my hypothesis is correct. There should be no problem if I just dump these monolithic meshes to the GPU for rendering. I already have a tool that collects sprites into a single mesh and render that one mesh instead. Modern GPUs should be able to chew thousands of polygons easily. That got me into thinking that maybe I don’t need culling for this game. My hypothesis is that Camera.Render takes too much time calculating for culling and batching quad meshes. I keep thinking about those 3D games that renders meshes with hundreds to thousands of polygons and still run at 60fps. Thus, Camera.Render usually processes more objects and performs slower. However, for a simulation game like Academia, players would usually play zoomed out because they want to see how the school is doing. The game does perform well when the player zooms into the map, which means the camera sees less objects and majority are culled. ![]() It’s not that I didn’t try to make the effort to optimize rendering and encourage batching. I don’t have the CPU budget anymore for game logic. The rendering alone takes more than that. That’s a lot! Remember that you need to run a frame at 16ms at most to achieve 60fps. The timeline for Camera.Render hovers around 20-30ms. When I run this through the profiler, this is what it looks like: Click here for enlarged image. ![]() This doesn’t cover the game’s whole tilemap yet but it does already have lots of objects in it. I'll probably just figure out a way to not have 3D objects in the canvas to begin with.One of my pet peeves with our game is that it’s a 2D game but it’s rendering is horrendous. Is there a way around this? I saw another thread suggesting the use of render textures or stencils, which is far too complicated a solution in this context. But this is a non-starter.when you turn a camera into an overlay, you lose the ability to set a viewport rect for it. I also thought about making a new base camera to hold both old and new cameras. Other URP docs suggest setting the canvas camera to an overlay, but in my situation, none of my base cameras are appropriate, because they are restricted to specific parts of the viewport. I would've expected it to render directly over the existing contents of the screen. It's as if the camera is rendering to its very own screen-sized render texture, then blitting the whole thing over the screen buffer. When configured as a base camera with output texture set to "None", the canvas camera seems to clobber everything in the screen buffer, even if I set its skybox setting to "Uninitialized". To do the latter, I need to add another camera. On top of this, I'd like to add a canvas that renders 3D objects. I've got multiple base cameras rendering into different parts of the viewport.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |