Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
mcposition noisescale intensity abs abs abs abs in

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;


You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File

Uploaded by : Lori Wood