Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize frustum fitting for shadows #9

Open
chadrik opened this issue Aug 29, 2018 · 1 comment
Open

Optimize frustum fitting for shadows #9

chadrik opened this issue Aug 29, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@chadrik
Copy link
Contributor

chadrik commented Aug 29, 2018

At the moment the code does lots of extra work for each light that has changed. We should cache the extents and transformations for each shadow caching object, optionally implement an acceleration structure to make traversals quicker.

Note, this is not critical for the prototype.

For comparison the frustum fitting takes 0.02msec for 5 meshes, and 3msec (absolutely worst case, if all the meshes are inside the frustum) for 1000 meshes. This cost only occurs if the light is moved or its parameters are changed. So probably you would need a few thousand meshes to dip below 60 fps.

However, it's still worth optimizing as it's really expensive right now. There are a few challenges associated with this though.


First of all, precalculating certain values for the meshes coming from maya is relatively cheap, since we can directly track what changed and precache certain calculations. But since we want to allow feeding the renderindex from multiple delegates, we have to go through the render delegate to list all the meshes and access their values.

@sirpalee was thinking about providing some base utilities in HdMayaDelegate (the one all custom scene delegates need to inherit from) to creating/deleting rprims and dirtying them, so we can explicitly track when an rprim have changed and update their bounding boxes in our cache. That way we can get rid of the most expensive operations, like the constant interaction with the HdRenderIndex and the Maya base classes.


Secondly, we need to create a bbox cache (similarly to UsdGeomBBoxCache), that allows quick and efficient traversal of all the bounding boxes, and keeps most of them in memory, as creating these usd classes is quite expensive.

@chadrik chadrik added the enhancement New feature or request label Oct 10, 2018
@sirpalee
Copy link
Contributor

With #31 fixed, this issue lost most of its urgency. It would be still a good thing to do, but most likely only after #28 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants