View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Compute tangent of partial derivates

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1~Helgon  Members

Posted 12 December 2012 - 12:06 PM

UPS!!:

Title wrong - should be: Compute Normal 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:

[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;

}


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

Thanks

Edited by ~Helgon, 12 December 2012 - 12:07 PM.

from time to time i find time

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.