Static Environmental Reflections: Difference between revisions
Lou Montana (talk | contribs) (Some wiki formatting) |
Lou Montana (talk | contribs) m (Text replacement - "[[Image:" to "[[File:") |
||
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
Environmental map may looks like this: | Environmental map may looks like this: | ||
[[ | [[File:EnvironmentalMap.jpg]] | ||
For use gradually ensue set of shaders which will use environmental map. | For use gradually ensue set of shaders which will use environmental map. | ||
==== New shader for glass ==== | ==== New shader for glass ==== | ||
[[ | [[File:Glass.jpg|Sklo]] | ||
New shader was made which can work with environmental map.It's used for glass sheets.On input it has besides environmental map also lookup texture for fresnel equations.Is it possible to generate fresnel texture inside TexView2 with use of code. Yet it is easier to use procedural texture. | New shader was made which can work with environmental map.It's used for glass sheets.On input it has besides environmental map also lookup texture for fresnel equations.Is it possible to generate fresnel texture inside TexView2 with use of code. Yet it is easier to use procedural texture. | ||
Line 46: | Line 46: | ||
Specular portion of imaging formula equation got following form: | Specular portion of imaging formula equation got following form: | ||
<code>S = (lightS * matS * (H.N)^P + envS * matS) * lerp(1, tD.rgb, tD.a)</code> | <code style="display: block">S = (lightS * matS * (H.N)^P + envS * matS) * lerp(1, tD.rgb, tD.a)</code> | ||
where lightS is light color, envS is value from environmental map, matS is specular value from material, tD is value of basic (diffuse) texture. | where lightS is light color, envS is value from environmental map, matS is specular value from material, tD is value of basic (diffuse) texture. |
Latest revision as of 23:11, 20 November 2023
This technology allows show environmental reflections on materials.Environment is static what only changes is only its lighting accordingly to time of day.Environment is characterized by texture which is called environmental map.In our case environmental map presents hemisphere projection into plane.
Environmental map may looks like this:
For use gradually ensue set of shaders which will use environmental map.
New shader for glass
New shader was made which can work with environmental map.It's used for glass sheets.On input it has besides environmental map also lookup texture for fresnel equations.Is it possible to generate fresnel texture inside TexView2 with use of code. Yet it is easier to use procedural texture.
#(ai,64,64,1)fresnelGlass()
In this case is used index of refraction 1.7 - common glass. It's possible to enter it as parameter:
#(ai,64,64,1)fresnelGlass(1.9)
Whole material for glass may look like this (it's good in future use second pass - here it is left out only for simplicity):
renderFlags[] = { NoAlphaWrite };
specular[] = { 1,1,1,0 };
specularPower = 5;
PixelShaderID = "Glass";
VertexShaderID = "Glass";
class Stage1
{
texture = "#(ai,64,64,1)fresnelGlass()";
uvSource = "none";
};
class Stage2
{
texture = "env_co.tga";
uvSource = "none";
};
If very low value (0) appears inside alpha within basic glass texture then whole texel cease to draw (nothing will reflect in that spot and it will look like hole in glass).
Imaging formula
Specular portion of imaging formula equation got following form:
S = (lightS * matS * (H.N)^P + envS * matS) * lerp(1, tD.rgb, tD.a)
where lightS is light color, envS is value from environmental map, matS is specular value from material, tD is value of basic (diffuse) texture.
IOR table
Material | Index |
---|---|
Vacuum | 1.00000 (exactly) |
Air (STP) | 1.00029 |
Acetone | 1.36 |
Alcohol | 1.329 |
Amorphous Selenium | 2.92 |
Calspar1 | 1.66 |
Calspar2 | 1.486 |
Carbon Disulfide | 1.63 |
Chromium Oxide | 2.705 |
Copper Oxide | 2.705 |
Crown Glass | 1.52 |
Crystal | 2.00 |
Diamond | 2.417 |
Emerald | 1.57 |
Ethyl Alcohol | 1.36 |
Flourite | 1.434 |
Fused Quartz | 1.46 |
Heaviest Flint Glass | 1.89 |
Heavy Flint Glass | 1.65 |
Glass | 1.5 |
Ice | 1.309 |
Iodine Crystal | 3.34 |
Lapis Lazuli | 1.61 |
Light Flint Glass | 1.575 |
Liquid Carbon Dioxide | 1.20 |
Polystyrene | 1.55 |
Quartz 1 | 1.644 |
Quartz 2 | 1.553 |
Ruby | 1.77 |
Sapphire | 1.77 |
Sodium Chloride (Salt) 1 | 1.544 |
Sodium Chloride (Salt) 2 | 1.644 |
Sugar Solution (30%) | 1.38 |
Sugar Solution (80%) | 1.49 |
Topaz | 1.61 |
Water (20 C) | 1.333 |
Zinc Crown Glass | 1.517 |