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

Add VR preprocessor def for GrassShader #22

Merged
merged 1 commit into from
Jul 11, 2023
Merged

Conversation

alandtse
Copy link
Collaborator

This is an initial attempt to combine flat and VR GrasShader code. However, the flat code does not appear to work and still needs to be fixed.

VR looks like it works. Flat DLL looks broken using the build. The combined Rungrass.hlsl appears to work fine in Flat using the Nexus version of the Flat DLL.

This is an initial attempt to combine flat and VR grasshaders. However,
the flat code does not appear to work and still needs to be fixed.
DirectX::XMFLOAT3 position{};

worldPos = worldPos - state->GetVRRuntimeData().posAdjust.getEye();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doodlum note this flat code was wrong since it's use GetVRRuntimeData(). Even though I fixed it, there appears to be an alignment issue. Perhaps the attempt to combine the positionWS and positionWS2 into an array breaks at alignas16? The Flat code is significantly different because it does try to update positionVS (which should be positionWS[1] now.

See
https://github.com/doodlum/skyrim-community-shaders/blob/main/src/Features/Clustered.cpp#L76-L80. Even writing to the positionWS[1] with the older XMVector3TransformCoord(light.positionWS, state->GetVRRuntimeData().cameraData.getEye().viewMat); didn't seem to solve the issue I'm seeing.

@@ -52,52 +52,59 @@ void GrassLighting::DrawSettings()
}
}

void GrassLighting::ModifyGrass(const RE::BSShader*, const uint32_t descriptor)
void GrassLighting::ProcessFrame(PerFrame* perFrameData, PerFrameVR* perFrameDataVR)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke out a helper function since the data structure changes between VR and Flat. The code should be identical though although the diff doesn't really show it well.

@doodlum doodlum merged commit 9a123aa into doodlum:vrfixes Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants