Jump to content
  • Advertisement
Sign in to follow this  
brett01

generating normals around a hemisphere *urgent pls*

This topic is 3631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In order to do this Im using Malley's Method CVector Ret; float X, Y; float u1 = UniformRandomNr(), u2 = UniformRandomNr(); ConcentricSampleDiskEx(u1, u2, &Ret.X, &Ret.Y); Ret.Z = sqrt(max(0.f, 1.f - Ret.X * Ret.X - Ret.Y * Ret.Y) ); return Ret; This will give a cosine distribution with a normal vector along the Z axis. So it needs to transform according to the normal vector of the surface.can some one help to how to transform normal vactor w.r.t to a surface pls.Thank you in advance.

Share this post


Link to post
Share on other sites
Advertisement
By the way I used

void buildFrame(const CVector3& normal, CVector3& v1, CVector3& v2)
{
v1 = normal.cross(CVector3(1, 0, 0));
if (v1.squareLength() < 0.01)
v1 = normal.cross(CVector3(0, 1, 0));
v2 = normal.cross(v1);
}

output(Ret.x * v1 + Ret.y * v2 + Ret.z * normal);

Im using this.but every time Im getting no of intersects as 0 for ambient occlusion.

Share this post


Link to post
Share on other sites
maybe I'm missing something, but is there any reason not to just normalise each point's position relative to the centre of the sphere and use that?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!