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

GENERATE_NORMALS generates completely useless normals #2608

Open
1 task done
Einheit-101 opened this issue Apr 26, 2022 · 5 comments
Open
1 task done

GENERATE_NORMALS generates completely useless normals #2608

Einheit-101 opened this issue Apr 26, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@Einheit-101
Copy link

Describe the bug

Recently i tried this HLSL value and the result is bad. I dont know if this can even be fixed but in its current state GENERATE_NORMALS is literally useless:

https://imgur.com/a/CsVJDTL

Steps to reproduce

  1. Export a model with vertex prelight and vertex color (Doing so will export the model without vertex normals due to DFF limitation)
  2. Replace any object
  3. Apply a dynamic lighting shader to that object that uses normals to calculate the light, it will be completely screwed

Version

Multi Theft Auto v1.5.9-release-21166

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@Einheit-101 Einheit-101 added the bug Something isn't working label Apr 26, 2022
@borsuczyna
Copy link
Contributor

It doesn't generate any normals, takes them from model, if they are not present normals will be 0,0,0

@Einheit-101
Copy link
Author

How is it possible that there are no normals? The faces must face in a direction. It should take these values. What it currently does looks like fully random.

@borsuczyna
Copy link
Contributor

borsuczyna commented Apr 27, 2022

bool CAdditionalVertexStreamManager::MaybeSetAdditionalVertexStream(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices,
UINT startIndex, UINT primCount)
{
// Cache info
SCurrentStateInfo state;
// Save call arguments
state.args.PrimitiveType = PrimitiveType;
state.args.BaseVertexIndex = BaseVertexIndex;
state.args.MinVertexIndex = MinVertexIndex;
state.args.NumVertices = NumVertices;
state.args.startIndex = startIndex;
state.args.primCount = primCount;
// Cache info about state streams etc
UpdateCurrentStateInfo(state);
// For now, this only works if the original has 3 decl elements (0:D, 1:P, 1:T) and stream 1 has a stride of 20
if (!CheckCanDoThis(state))
return false;
SetAdditionalVertexStream(state);
return true;
}

CheckCanDoThis looks like reason of this

@Einheit-101
Copy link
Author

It seems that the normal handling needs improvement and this solution has been made transitional only as long as there is nothing better available

@tederis
Copy link
Member

tederis commented May 3, 2022

It doesn't generate any normals, takes them from model, if they are not present normals will be 0,0,0

That is not true. See CAdditionalVertexStreamManager::UpdateAdditionalStreamContent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants