15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci SGIX_fog_patchy 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_SGIX_fog_patchy 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciVersion 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci $Date: 1999/03/30 23:13:46 $ $Revision: 1.3 $ 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNumber 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci XXX 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciDependencies 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci OpenGL 1.2 is required 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciOverview 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Patchy fog is a fog in which intermittent areas of dense fog may 245bd8deadSopenharmony_ci be encoutered. This extension explains how the patchy fog 255bd8deadSopenharmony_ci extension is supported. Patchy fog is needed because both 265bd8deadSopenharmony_ci uniform fog density and fog layers can only specify a constant 275bd8deadSopenharmony_ci density at a given elevation. The SGIX_fog_texture openGL 285bd8deadSopenharmony_ci extension gives a mean to specify a patchy fog texture that will 295bd8deadSopenharmony_ci modulate the fog density at a given elevation. The goal of this 305bd8deadSopenharmony_ci document is to describe the modulation fuction and the fog 315bd8deadSopenharmony_ci equation when patchy fog is enabled. No tokens, states, or 325bd8deadSopenharmony_ci procedures are introduced in this extension. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciNew Procedures and Functions 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci None 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciIssues 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci - Since there is no API introduction is this extension the 415bd8deadSopenharmony_ci good way to present things? 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci - Should we introduce a glEnable for patchy fog? 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci - We should move the description of the patchy fog equation 465bd8deadSopenharmony_ci up to the overview but we do not want to disclose it for the 475bd8deadSopenharmony_ci moment. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciNew Tokens 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci None 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci None 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 Specification (Rasterization) 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci 3.10 Fog 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci In addition to uniform fog density and fog layers, patchy fog can 625bd8deadSopenharmony_ci be specified. The patchy fog extension gives a mean to modulate 635bd8deadSopenharmony_ci the fog density with a texture. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci _____ _____ 665bd8deadSopenharmony_ci density (d) ___| | | | 675bd8deadSopenharmony_ci | * |____| * |__ To fog equation 685bd8deadSopenharmony_ci __| | __| | (d*p*r) 695bd8deadSopenharmony_ci | |_____| | |_____| 705bd8deadSopenharmony_ci | | 715bd8deadSopenharmony_ci | | 725bd8deadSopenharmony_ci | | 735bd8deadSopenharmony_ci patchy fog texture (p) __| | 745bd8deadSopenharmony_ci | 755bd8deadSopenharmony_ci | 765bd8deadSopenharmony_ci range (r) ---------------------------| 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci The product (d*p*r) is used in the computation of the fog blending 805bd8deadSopenharmony_ci factor (f). If the patchy fog texture is not enabled in SGIX_fog_texture, 815bd8deadSopenharmony_ci then the patchy fog texture has no effect (p = 1.0). 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci The computation of the fog equation when patchy fog is enabled 845bd8deadSopenharmony_ci requires multiple passes. It is hereby described as a 2-pass 855bd8deadSopenharmony_ci approach. If there are more than one patchy fog layer or more 865bd8deadSopenharmony_ci than one patchy fog color, the second pass will be repeated 875bd8deadSopenharmony_ci multiple times. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci 1) In the first pass: compute an intermediate color at a given 905bd8deadSopenharmony_ci fragment using the fog blending equation. In this first pass, 915bd8deadSopenharmony_ci the fog patchiness is ignored (p=1). 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci [RGBl] = f1 x [RGBs] + (1-f1) x [RGBfog] 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci where, 965bd8deadSopenharmony_ci - [RGBl] is the intermediate color stored in the frame buffer. 975bd8deadSopenharmony_ci - f1 is the fog blending factor. It is a function of the fog 985bd8deadSopenharmony_ci density (d) and the distance between the viewpoint and the 995bd8deadSopenharmony_ci fragment in eye space (r). 1005bd8deadSopenharmony_ci - [RGBs] is the input fragment that is coming out from fragment 1015bd8deadSopenharmony_ci lighting in the rasterization pipeline. 1025bd8deadSopenharmony_ci - [RGBfog] is the fog color. 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci 2) In the second pass: compute the final fragment color using the 1055bd8deadSopenharmony_ci result of the previous pass. In the second pass, the fog 1065bd8deadSopenharmony_ci patchiness is taken into account (p=patchy fog texture) 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Destination = f2 * [RGBl] + (1-f2) * [RGBcloud], 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci where, 1115bd8deadSopenharmony_ci - Destination is the final fragment color 1125bd8deadSopenharmony_ci - f2 is the fog blending factor. It is a function of the fog 1135bd8deadSopenharmony_ci density (d), the distance between the viewpoint and the fragment in eye 1145bd8deadSopenharmony_ci space (r), and the patchy fog texture (p). In the hardware, the density 1155bd8deadSopenharmony_ci is first multiplied by the patchy fog texture and then 1165bd8deadSopenharmony_ci multiplied by the range r. 1175bd8deadSopenharmony_ci - [RGBl] is the intermediate color. Color that we would get 1185bd8deadSopenharmony_ci without patchy fog. 1195bd8deadSopenharmony_ci - [RGBcloud] is the patchy fog color. 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 1235bd8deadSopenharmony_ciand the Framebuffer) 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci None 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 Specification (Special Functions) 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci None 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 Specification (State and State Requests) 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci None 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ciAdditions to the GLX Specification 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci None 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ciErrors 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci None 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ciNew State 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci None 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ciNew Implementation Dependent State 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci None 150