1Name 2 3 SGIX_fog_patchy 4 5Name Strings 6 7 GL_SGIX_fog_patchy 8 9Version 10 11 $Date: 1999/03/30 23:13:46 $ $Revision: 1.3 $ 12 13Number 14 15 XXX 16 17Dependencies 18 19 OpenGL 1.2 is required 20 21Overview 22 23 Patchy fog is a fog in which intermittent areas of dense fog may 24 be encoutered. This extension explains how the patchy fog 25 extension is supported. Patchy fog is needed because both 26 uniform fog density and fog layers can only specify a constant 27 density at a given elevation. The SGIX_fog_texture openGL 28 extension gives a mean to specify a patchy fog texture that will 29 modulate the fog density at a given elevation. The goal of this 30 document is to describe the modulation fuction and the fog 31 equation when patchy fog is enabled. No tokens, states, or 32 procedures are introduced in this extension. 33 34New Procedures and Functions 35 36 None 37 38Issues 39 40 - Since there is no API introduction is this extension the 41 good way to present things? 42 43 - Should we introduce a glEnable for patchy fog? 44 45 - We should move the description of the patchy fog equation 46 up to the overview but we do not want to disclose it for the 47 moment. 48 49New Tokens 50 51 None 52 53Additions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 54 55 None 56 57Additions to Chapter 3 of the 1.2 Specification (Rasterization) 58 59 3.10 Fog 60 61 In addition to uniform fog density and fog layers, patchy fog can 62 be specified. The patchy fog extension gives a mean to modulate 63 the fog density with a texture. 64 65 _____ _____ 66 density (d) ___| | | | 67 | * |____| * |__ To fog equation 68 __| | __| | (d*p*r) 69 | |_____| | |_____| 70 | | 71 | | 72 | | 73 patchy fog texture (p) __| | 74 | 75 | 76 range (r) ---------------------------| 77 78 79 The product (d*p*r) is used in the computation of the fog blending 80 factor (f). If the patchy fog texture is not enabled in SGIX_fog_texture, 81 then the patchy fog texture has no effect (p = 1.0). 82 83 The computation of the fog equation when patchy fog is enabled 84 requires multiple passes. It is hereby described as a 2-pass 85 approach. If there are more than one patchy fog layer or more 86 than one patchy fog color, the second pass will be repeated 87 multiple times. 88 89 1) In the first pass: compute an intermediate color at a given 90 fragment using the fog blending equation. In this first pass, 91 the fog patchiness is ignored (p=1). 92 93 [RGBl] = f1 x [RGBs] + (1-f1) x [RGBfog] 94 95 where, 96 - [RGBl] is the intermediate color stored in the frame buffer. 97 - f1 is the fog blending factor. It is a function of the fog 98 density (d) and the distance between the viewpoint and the 99 fragment in eye space (r). 100 - [RGBs] is the input fragment that is coming out from fragment 101 lighting in the rasterization pipeline. 102 - [RGBfog] is the fog color. 103 104 2) In the second pass: compute the final fragment color using the 105 result of the previous pass. In the second pass, the fog 106 patchiness is taken into account (p=patchy fog texture) 107 108 Destination = f2 * [RGBl] + (1-f2) * [RGBcloud], 109 110 where, 111 - Destination is the final fragment color 112 - f2 is the fog blending factor. It is a function of the fog 113 density (d), the distance between the viewpoint and the fragment in eye 114 space (r), and the patchy fog texture (p). In the hardware, the density 115 is first multiplied by the patchy fog texture and then 116 multiplied by the range r. 117 - [RGBl] is the intermediate color. Color that we would get 118 without patchy fog. 119 - [RGBcloud] is the patchy fog color. 120 121 122Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 123and the Framebuffer) 124 125 None 126 127Additions to Chapter 5 of the 1.2 Specification (Special Functions) 128 129 None 130 131Additions to Chapter 6 of the 1.2 Specification (State and State Requests) 132 133 None 134 135Additions to the GLX Specification 136 137 None 138 139Errors 140 141 None 142 143New State 144 145 None 146 147New Implementation Dependent State 148 149 None 150