Static Environmental Reflections

From Bohemia Interactive Community
Revision as of 09:26, 8 September 2020 by R3vo (talk | contribs) (Text replacement - " it's" to " it is")
Jump to navigation Jump to search

Description

published mainly for compatibility reason as SuperShader (includes environmental map/fresnel) replacing this functionality

This technology allows show environmental reflections on materials.Environment is static what only changes is only it is 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:

EnvironmentalMap.jpg

For use gradually ensue set of shaders which will use environmental map.

New shader for glass

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.

#(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:

,where ligthS 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