Sign in to follow this  
Tubos

[HLSL] Passing float2x2 from VS to PS without using TEXCOORD

Recommended Posts

Hi!

I want to pass a 2D rotation matrix (float2x2) from VS to PS.

I cannot use the TEXCOORD registers, because I use point sprites. Some graphics cards overwrite ALL point sprite registers when using point sprites.

I found only two options:

1) Use COLOR1. Problem: the values are clamped to 0-1. Solution: Scale them into the 0-1 range.

2) Pass the rotation amount as 1 float via VFACE and create the rotation matrix inside the PS.

Is there any way I can pass my matrix directly from VS to PS?




Thanks!

Share this post


Link to post
Share on other sites
Not with extra tex-coords, enabling point sprites will thrash them (undefined behavior, the docs are enigmatic in this regard)

Recreating the matrix for every pixel sounds like wasted performance, so I'd go for 1). There was a XNA example somewhere which I currently don't find. Maybe you can (ab)use other semantics, never tried myself.

Edit: By the way: It does not look like you actually can write to VFACE from the vertex shader. Have you tried and did that work ?

Share this post


Link to post
Share on other sites
Thanks, COLOR works by scaling the values. I was just curious if there's a direct solution that doesn't involve scaling.

I didn't try VFACE, I just read it in the docs and thought you could use that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this