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

[feature] Implement texture scaling #32

Closed
Derpius opened this issue Aug 12, 2022 · 3 comments
Closed

[feature] Implement texture scaling #32

Derpius opened this issue Aug 12, 2022 · 3 comments
Labels
binary module Issues relating to the binary module enhancement New feature or request
Milestone

Comments

@Derpius
Copy link
Owner

Derpius commented Aug 12, 2022

Is your feature request related to a problem? Please describe.
Textures are incorrectly scaled on many surfaces

Describe the solution you'd like
Multiply UV coordinates by the texture transforms before being used in sampling and texture LoD calculations

Additional context
Code from the Source SDK for initialising a 2x4 mat from a 3x4 mat

void CBaseVSShader::SetVertexShaderTextureTransform( int vertexReg, int transformVar )
{
	Vector4D transformation[2];
	IMaterialVar* pTransformationVar = s_ppParams[transformVar];
	if (pTransformationVar && (pTransformationVar->GetType() == MATERIAL_VAR_TYPE_MATRIX))
	{
		const VMatrix &mat = pTransformationVar->GetMatrixValue();
		transformation[0].Init( mat[0][0], mat[0][1], mat[0][2], mat[0][3] );
		transformation[1].Init( mat[1][0], mat[1][1], mat[1][2], mat[1][3] );
	}
	else
	{
		transformation[0].Init( 1.0f, 0.0f, 0.0f, 0.0f );
		transformation[1].Init( 0.0f, 1.0f, 0.0f, 0.0f );
	}
	s_pShaderAPI->SetVertexShaderConstant( vertexReg, transformation[0].Base(), 2 ); 
}
@Derpius Derpius added the enhancement New feature or request label Aug 12, 2022
@Derpius Derpius added this to the v0.10.0 milestone Aug 12, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 12, 2022

Implemented, need to test

@Derpius Derpius added the binary module Issues relating to the binary module label Aug 13, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 18, 2022

Transformation is completely incorrect

@Derpius
Copy link
Owner Author

Derpius commented Aug 18, 2022

Added in 15fa7e8

@Derpius Derpius closed this as completed Aug 18, 2022
@Derpius Derpius moved this to Backlog in VisTrace Dec 16, 2022
@Derpius Derpius added this to VisTrace Dec 16, 2022
@Derpius Derpius moved this from Backlog to Done in VisTrace Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary module Issues relating to the binary module enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant