Sign in to follow this  
fire67

Sine-based Tiled Procedural Bump

Recommended Posts

Hey everyone,

 

I am trying to implement this formula to generate bump but I am facing some issue. The result doesn't look the same it's much darker.

 

kUWt5.png

 

Here is my result (without same parameters) but it is much darker and I don't get why.

 

9GUF2.png

 

And here is the associated code.

// randx, randy and frequencies are array with some random values for each sin wave.
for (int x = 0; x < _width; ++x)
{
	for (int y = 0; y < _height; ++y)
	{
		float color = 0.0f;
		for (int i = 0; i < _iterations; ++i)
		{
			val += Mathf.Sin(Mathf.Sqrt(Mathf.Pow(x - randx[i], 2.0f) + Mathf.Pow(y - randy[i], 2.0f)) * 1.0f / (2.08f + 5.0f * frequencies[i]));
		}
		color /= (float)_iterations;
	}
}

Any idea why I am getting this result ?

Thanks a lot !

Edited by fire67

Share this post


Link to post
Share on other sites

@fire67 do you think it's possible to share the code or at least show how you define the random values as I'm also not having an easy time with this ?

Edited by lipsryme

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