Sign in to follow this  
~Helgon

Compute tangent of partial derivates

Recommended Posts

~Helgon    361
UPS!!:

Title wrong - should be: Compute [b]Normal[/b] of partial derivates

Hey, I've created a bezier surface and want to compute the normal of each vertex. To solve the problem I've read that I have to compute the cross product of the partial derivatesbut the partial derivates in this case are a float4 vector and the normal is a float3 vector. If i calculate just with the .xyz components i have a kinda leaking result, or?

This is my approach:

[CODE]
[domain("quad")]
DomainOut DS(
PatchTess patchTess,
float2 uv : SV_DomainLocation,
const OutputPatch<HullOut, 16> bezPatch)
{

DomainOut dout;

float4 basisU = BernsteinBasis(uv.x);
float4 basisV = BernsteinBasis(uv.y);
float3 p = CubicBezierSum(bezPatch, basisU, basisV);

dout.PosH = mul(float4(p, 1.0f), gWorldViewProj);
dout.PosW = mul(float4(p, 1.0f), gWorld).xyz;
float3 NormalL = cross(basisU.xyz, basisV.xyz);
dout.NormalW = mul(float4(NormalL, 1.0f), gWorldInvTranspose);
return dout;

}
[/CODE]

Can u give me a hint how it's done correctly?

Thanks Edited by ~Helgon

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