Skip to main content
gamedev.net
🔒 Locked

Magic Numbers [R2VB]

Started by doogyhatts Jun 25, 2007 at 11:30 AM 0 replies 1.1k views
Original Post
doogyhatts
doogyhatts
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.