NVIDIAGameWorks / rtx-remix

Combined repo for the RTX-Remix runtime
https://www.nvidia.com/en-us/geforce/rtx-remix/
MIT License
1.38k stars 69 forks source link

Possible solution for replacing random material hashes attributes whenever diffuse texture changes #215

Open Ekozmaster opened 1 year ago

Ekozmaster commented 1 year ago

User story

Expected behaviour

A replacement material would set the roughness to a low value, and the diffuse texture would still be the same as the one set by the original game.

Actual behaviour

Since for each new customization the player does to the car (base paint, decals, vinyls...), a new diffuse texture is generated, the material captured by the runtime will have a new random hash for each combination of customizations (which is an exponentially large number) Look at the Vinyl on the door image 8F3682C3DBBF78F8 [EDIT]: Replacing the mesh's material with a new one, even if is just a roughness overwrite in the USD, also implicitly set the diffuse attribute to null.

Proposed Solution

Allow the diffuse texture (and likely other attributes) from the original game for the mesh to be forwarded to the replacement material, as long as the material's USD doesn't explicitly defines a diffuse asset input to replace with.

With that, a material could replace only the attributes it needs to and any other from the game would still render the same, instead of replacing every attribute implicitly. With this constructive/incremental material overlay at attribute level, we could replace the mesh's materials for a lot of cases in which the resulting one would be a random mat_SOMEHASH, like animated ones, ingame generated textures like the mentioned case above, and so on.

MarkEHenderson commented 1 year ago

Note: this will also mean we need to identify the material by a hash that does not include its primary texture.

Ekozmaster commented 1 year ago

Could a logic agnostic of the current material be implemented, so it only cares about which mesh is being rendered? So a mesh replacement could use it's custom mat_SupraHood independent of the generated material, only the textures and the mesh matter. Does it makes sense?

NV-DM commented 1 year ago

REMIX-2020 for triage.