Usage of two unused render states for special game scenarios (force material hash and texture categories) #79
+31
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements logic allowing the usage of two unused d3d9 render states to aid with special game scenarios whilst having game code access.
The specific purpose of this PR
I'm currently working on a portal 2 - remix compatibility mod (via reverse engineering - asi loading) and faced an issue with how the game is rendering the speed/jump gel's.
The game is building a dynamic texture that keeps track of which surfaces on the map are covered by gel. It is very similar to a lightmap texture and because it is a dynamic texture, the hash is dynamically changing as well. This prevents me from remixing it in the toolkit.
The gel texture also requires two remix texture categories to be set (
IgnoreOpacityMicromap + Decal
) for it to look correct.This is not possible with the hash constantly changing.
Footage of gel being applied to surfaces (Showcase Discord):
https://discord.com/channels/1028444667789967381/1028600697463263314/1294618442346926152
In short:
When the hidden remix option 'useUnusedRenderstates' is enabled via the rtx.conf:
device->SetRenderState((D3DRENDERSTATETYPE)42, IgnoreOpacityMicromap | DecalStatic);
device->SetRenderState((D3DRENDERSTATETYPE)150, 0x1337);
Thoughts
Rendering the gel using the remixAPI is currently not possible as the api only works with paths to actual dds textures on disk and does not expose a way to use "texture data" by providing a
IDirect3DBaseTexture9
pointer. I'll create a separate feature request for that. (Even if that would work, I'm not entirely sure if I could render the gel using the api)This PR is only useful for people working on compatibility mods for shader heavy game with game code access. It should not affect or change anything for other remix supported games as the render states utilized are unused since ... ?