#Shadow maps

1 messages · Page 1 of 1 (latest)

dreamy geyser
#

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.

unreal coral
#

wait quick question can you change the distance in runtime?

dreamy geyser
#

You can swap Shadow maps at runtime if I recall correctly. Whether that works for you game is another thing

unreal coral
#

I meant the shadow render distance

dreamy geyser
#

Yes, you can change settings at runtime. That's how video settings would be controlled from an options menu

unreal coral
#

good good, right why did I ask that, that brings me to an idea tho, thanks a lot

unreal coral
dreamy geyser
#

Sure, can't promise I'll have an answer though

unreal coral
#

I have been thinking about gpu instancing but then collisions wouldn't work right?

dreamy geyser
#

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

unreal coral
#

so a bunch of empty gameObjects?

dreamy geyser
#

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.

unreal coral
#

but that feals stupid as well

dreamy geyser
#

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.

unreal coral
#

hm allright that sounds like a plan, I hope that will increase the performance of the trees because they are not great.

dreamy geyser
#

Are you on SRP?

unreal coral
unreal coral
dreamy geyser
#

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

unreal coral
dreamy geyser
#
GDC

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...

▶ Play video
dreamy geyser
unreal coral
dreamy geyser
#

It would combine rendering of multiple meshes into a single draw call

#

fewer draw calls is the general goal for performance

unreal coral
dreamy geyser
#

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

unreal coral
#

But would my game feel then very repetetive?

dreamy geyser
#

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.

unreal coral