#Shadow maps
1 messages · Page 1 of 1 (latest)
I think it's a dropdown in the settings, can't recall what the highest is. I assume either 4k or 8k?
You can try baking where possible since that will allow for multiple maps and give more space for dynamic objects that need to cast shadows.
the problem is my sun is moving constantly
wait quick question can you change the distance in runtime?
You can swap Shadow maps at runtime if I recall correctly. Whether that works for you game is another thing
I meant the shadow render distance
Yes, you can change settings at runtime. That's how video settings would be controlled from an options menu
good good, right why did I ask that, that brings me to an idea tho, thanks a lot
oh yeah can I ask you another thing?
Sure, can't promise I'll have an answer though
So if you do not use unitys terrain system do you then just simply instantiate the trees, and have them as gameObjects? Cause that feels kinda stupid
I have been thinking about gpu instancing but then collisions wouldn't work right?
In general? There are a few different ways to do it. The terrain system is just one and there are a few other approaches that use vertex painting and similar things.
GPU instancing would only affect rendering, collision would stay separate
In editor it would look like a bunch of prefabs but when actually rendering it would be smarter under the hood
but if I use gpu instancing then I would still need a bunch of colliders for every tree?
so a bunch of empty gameObjects?
If the trees were 100% generated on GPU? Yes. That's not how GPU instancing works, though.
At runtime it would see the same mesh being used for multiple objects and render them together with a single copy of the mesh.
I do not really umderstand what you are trying to say. My idea was to just simply use drawmeshinstancedindirekt for the trees but then seperatelly have empty gameobjects as colliders
but that feals stupid as well
Oh, that also would work. I've done something similar on a project. I would disable mesh renderers at runtime and use DrawInstanced and pass in the position and rotation manually. In my case it was for a bullet hell game which had many hundreds of identical 3D projectiles in the scene at any given moment.
That was mostly to prevent transform access and lighter physics but the end result was the same.
hm allright that sounds like a plan, I hope that will increase the performance of the trees because they are not great.
Are you on SRP?
Ok, but what if I would have so many different tree models that its not the same mesh anymore, what could I do to improve fps there cause I can't instance them anymore
yes built in render pipeline
good because everything I mentioned is specific to built in, SRP is quite different.
Dynamic batching can still kick in with different meshes but they would either need to share the same material or use material property blocks to make sure they still batch. Static batching would also help. A good foliage material should be able to give a lot of variation across different trees but foliage shaders are a whole field to themselves.
GPU Gems 3 has a few solid articles on approaches for this. An old book but the techniques are still used. It's actually mentioned in a GDC talk about horizon's vegetation system
you mean a foliage shader that would offset the vertecies in a way that it looks like a new tree?
Chapter 16. Vegetation Procedural Animation and Shading in Crysis Tiago Sousa Crytek At Crytek, one of our primary goals for Crysis was to define a new standard for computer game graphics. For our latest game, we have developed several new technologies that together comprise CryENGINE 2. A key feature of Crysis among these technologies is vegeta...
In this 2018 GDC session, Guerrilla Games' Gilbert Sanders discusses what the studio learned in order to bring the lush and vibrant vegetation of Horizon Zero Dawn to PS4 while keeping an eye on overall performance.
Register for GDC: https://ubm.io/341ZiaZ
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https...
ah no, in this case they would be different meshes and you wouldn't be using GPU Instancing to share the mesh. You can still have them batch together even with other techniques, like material property blocks. Actually, GPU Instancing uses MPBs.
ok thank you I understand everything except the batch part, what would that do?
It would combine rendering of multiple meshes into a single draw call
fewer draw calls is the general goal for performance
ah that makes sense, would that mean I could do all the trees in one draw call?
In practice, no. There are limits to dynamic batching related to vert counts. Static batching can do a lot more but it's a trade off so it's not always what you'd want. For full control (assuming your mesh is static) you could combine things yourself code at runtime, build time, or externally in your 3D program of choice
But "theoretically", yes
ok allright I will research about this some more, the question is now tho, how many different tree models I want, cause if it isn't that many I could probably just gpu instance them right?
But would my game feel then very repetetive?
Models can be different, it's the material that really matters for batching
at least in built-in
LODs also help with the batching since lower LOD has fewer verts and more can dynamically batch together, if that's the approach you are taking
It really depends on a lot of factors, though. art style, game design, camera, target platform, etc. Best bet is to profile now and then and keep things under control as you go.
I tried to enable static batching for my trees but it seams like the draw calls does not decrease and that the fps stay the same as well