Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Mcposition noisescale intensity abs abs abs abs intensity clamp

15.5. Turbulence

We can achieve an effect that looks like a pit of hot molten lava or the surface of the sun by using the same vertex shader as the cloud shader and a slightly different fragment shader. The main difference is that we scale each noise value and shift it over so that it is centered at 0; then we take its absolute value. After summing the values, we scale the result again to occupy nearly the full range of [0,1]. We clamp this value and use it to mix between yellow and red to get the result shown in Color Plate 24 (see Listing 15.5). (In Chapter 16, we examine some ways of animating these textures to make them more interesting.)

Listing 15.5. Sun surface fragment shader

abs(noisevec[3] - 0.03125);


varying float LightIntensity;
varying vec3 MCposition;

uniform sampler3D Noise;
uniform vec3 MarbleColor;
uniform vec3 VeinColor;

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
Uploaded by :
Page 1 Preview
mcposition noisescale intensity abs abs abs abs in
Sell Your Old Documents & Earn Wallet Balance