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

Texture Sampling behaviour issues #27

Open
Omnituens opened this issue Nov 12, 2023 · 0 comments
Open

Texture Sampling behaviour issues #27

Omnituens opened this issue Nov 12, 2023 · 0 comments

Comments

@Omnituens
Copy link

Omnituens commented Nov 12, 2023

I was attempting to do some texture sampling from an png in a function, but I found some odd behaviour.

Make a colour source of colour ff00ff in an OBS scene and a 10x10 png of a different solid colour (I used ff8811). You can also create another colour source to sample from, it is not exclusive to loading from a graphics file.

Apply the following shader to the colour source, setting testTexture to the png.

uniform texture2d testTexture;

float4 getColour(float2 uv)
{
	return testTexture.Sample(textureSampler, uv);
}

float4 mainImage(VertData v_in) : TARGET
{
	float2 testuv = {0.5f, 0.5f};
	return getColour(testuv);
	float4 sourceColour = image.Sample(textureSampler, testuv);
}

You will observe that the colour being returned is the colour source, when it should be the colour from the texture.
Commenting out the float4 definition after the return OR replacing the GetColour call with sampling the testTexture directly has the desired behaviour and returns the sampled texture rather than the source.

OBS is 30.0 and plugin version is 2.1.3

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

No branches or pull requests

1 participant