Jump to content
  • Advertisement
Sign in to follow this  
doogyhatts

Magic Numbers [R2VB]

This topic is 4188 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

Ok I was looking at the R2VB particle system sample from the ATI Radeon SDK and happen to notice a set of magic numbers when the author tried to calculate a higher precision order random value. //initPhysics.shd
float rand0 = tex2D(Rand, -texCoord).w;
float rand1 = tex2D(Rand, 10.2428 * texCoord).w;
float rand2 = tex2D(Rand, -4.724 * texCoord).w;
float rand3 = tex2D(Rand, 0.5128 * texCoord).w;
	
//create a higher precision random value from the four 16bit values
float rand = frac(8.0 * rand0 + 4.0 * rand1 + 2.0 * rand2 + rand3);

The magic numbers I am referring to are the -texCoord,10.2428,etc... Somehow I did have the feeling that there were precomputed instead. Does anyone know how the author arrived at such numbers?? I also checked, the "Rand" texture isnt clamped. thx! Edwin

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!