Ru/$envmap: Difference between revisions
| Churkinator (talk | contribs) No edit summary | Churkinator (talk | contribs)  | ||
| Line 148: | Line 148: | ||
| : {{note|Despite common misconception, setting this to 0 does ''not'' enable a "fancy specular" mode, it simply disables specular rendering entirely.}} | : {{note|Despite common misconception, setting this to 0 does ''not'' enable a "fancy specular" mode, it simply disables specular rendering entirely.}} | ||
| {{IO|mat_specular|param=bool|Отключает или включает зеркальные отражения, выгружает или загружает зеркальные материалы из памяти. По умолчанию 1.}} | {{IO|mat_specular|param=bool|Отключает или включает зеркальные отражения, выгружает или загружает зеркальные материалы из памяти. По умолчанию 1.}} | ||
| {{IO|r_showenvcubemap|param=bool|Команда для отображения всех  | {{IO|r_showenvcubemap|param=bool|Команда для отображения всех карт-кубов на всех динамических объектах в полную яркость. Использовалось для создания изображения в начале статьи.}} | ||
| == Смотреть также == | == Смотреть также == | ||
Revision as of 10:43, 12 April 2025
$envmap  - это   материальный параметр шейдера, доступно для всех игр на движке  Source.
 Source. 

You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.
It most commonly used to approximate the specular reflections seen on smooth surfaces, such as metals, glass and plastics. This is achieved by mapping the vertex normals of a model to positions on a cubemap - specified by $envmap - and adding the sampled color from the cubemap to the model's surface. Typically, the cubemap is a simple, static "environment map" which has been pre-rendered (although a custom cubemap can be animated).
When $envmap is set to env_cubemap and buildcubemaps has been run on the map, the engine will automatically select the environment map contained in the BSP which is nearest to the model as it moves through the world, providing a very rough approximation of dynamic reflections.
The other form of specularity supported by Source is the Phong type, which provides simpler reflections on both static and dynamic models.
Доступность
$envmap был представлен в  Source в
 Source в  и
 и  . Также доступен во всех поздних играх.
. Также доступен во всех поздних играх.
 Примечание:Большинство текстур в
Примечание:Большинство текстур в  Half-Life: Source по-умолчанию используют статичные отражающие изображения вместо
 Half-Life: Source по-умолчанию используют статичные отражающие изображения вместо env_cubemap. Поэтому если вы уже построили карты-кубы, то большинство из этих текстур продолжат использовать статичные отражающие изображения, до тех пор пока их .vmt файлы не будут отредактированы.Синтаксис
$envmap env_cubemap
"env_cubemap" is typically used, which tells VBSP to swap in the name of the nearest env_cubemap when the map compiles. However, it is also possible to use a static cubemap image that has been manually created.
 Примечание:Если
Примечание:Если $envmap используется без указания $basetexture, то даже в таком случае зеркальные отражения будут отображены. Примечание:Большинство текстур карт-кубов не будут иметь отражения, если использовать их как оверлеи или декали[Уточнить].
Примечание:Большинство текстур карт-кубов не будут иметь отражения, если использовать их как оверлеи или декали[Уточнить]. Примечание:На прозрачность карты-куба влияет альфа-канал $basetexture, даже при использовании $envmapmask.
Примечание:На прозрачность карты-куба влияет альфа-канал $basetexture, даже при использовании $envmapmask.Создание пользовательской текстуры карты-куба
Creating a custom cubemap texture might be required for some circumstances and is used occasionally in some Valve models.
 Баг: Cubemaps flagged as sRGB will only properly load as sRGB when HDR is disabled. Either include an HDR
Баг: Cubemaps flagged as sRGB will only properly load as sRGB when HDR is disabled. Either include an HDR .hdr.vtf equivalent for an sRGB-encoded SDR .vtf cubemap, or encode the SDR cubemap in regular RGB. 
 Подтвердить:What games can actually load SDR cubemaps in HDR mode?
 Подтвердить:What games can actually load SDR cubemaps in HDR mode?  handles such fine (printing warnings about missing a proper HDR cubemap in the console), but
 handles such fine (printing warnings about missing a proper HDR cubemap in the console), but  seems not be able to load SDR cubemaps in HDR mode (regardless of sRGB-ness), resulting in the surface glowing white.
 seems not be able to load SDR cubemaps in HDR mode (regardless of sRGB-ness), resulting in the surface glowing white.В VTFEdit
For this to work you will need to have the 6 sides of the cubemap saved as individual textures in the correct orientation for it to appear correctly in the Source Engine. So some faces might need to be rotated either clockwise or counter clockwise. Each face will need to be mirrored horizontally before orientation.
 Примечание:Pre-
Примечание:Pre- Alien Swarm games require 7 faces for the cubemap to work. The seventh in this case is a round texture, used as a sphere map for the (broken)
 Alien Swarm games require 7 faces for the cubemap to work. The seventh in this case is a round texture, used as a sphere map for the (broken) $envmapsphere parameter. VTFEdit can generate this face automatically, via the "Advanced" tab when importing.To the right hand side of this page you will find two guide images to aid in properly rotating each side of your environment render.
Save one or both of those guides on your computer and then import your environment render onto it or recreate it in a smaller scale, then rotate your sides as instructed by the images.
Save every side as a separate image file, their names should be the number found on that specific square. This will ensure that the environment texture will be built correctly, as the numbers also represent the import order in VTFEdit.
Once you have all the image sides ready you can just import them all into VTFEdit and select "Environment Map". Texture format is up to you, generally DXT1 will do.
Enable the "Clamp S" and "Clamp T" texture flags.
Then just save it all as a .vtf file and use it in your VMT like so:
"$Envmap" "effects/my_cubemap"
"effects" is the usual folder for environments/cubemaps You may put yours anywhere you like
В VTEX
VTEX will automatically mirror and orient your faces, you need only to provide correctly named textures. Name each file something like envmap001a*.tga, where * is put BK, FT, LF, RT, UP, or DN. If you took a cubemap screenshot in-game, this step will already by done, but to make them work properly with Vtex.exe you must use HDRShop (but before you need to change textures format to BMP, because HDRShop can only work with that kind of format) and then covert them to PFM files format.
Create a text file the same name as your textures (e.g. envmap001a.txt). If building for HDR write in the following, otherwise leave it blank:
pfm 1 // read .pfm file instead of .tga
pfmscale 1 // higher values will result in a brighter sky
nocompress 1 // disable compression (HDR compression is only supported by skyboxes)
Put these files into materialsrc and then just drag-n-drop .txt file into vtex.exe and you should end up with a working cubemap! HDR envmaps will be named like envmap001a.hdr.vtf, and only need to exist to work.
Параметры и Эффекты
$envmapmask
$envmaptint
$envmapcontrast
$envmapsaturation
$envmapframe
$envmapmode
$basetexturenoenvmap
$envmapoptional
$envmapsphere
$noenvmapmip
$fresnelreflection
$envmapfresnel
$envmapfresnelminmaxexp
$envmaplightscale
$envmaplightscaleminmax
$envmapanisotropy
$envmapanisotropyscale
Консольные команды
- buildcubemaps
- Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid reflection, white in Ep1 and pink checkerboards in MP.
- envmap
- Generates an environment map at the player's position and dumps it in cubemap_screenshots/, in six separate PFM files (or, if running without HDR, TGA files).
 Совет:Cubemaps created this way will capture dynamic entities and models in them, which are normally hidden when using Совет:Cubemaps created this way will capture dynamic entities and models in them, which are normally hidden when using- buildcubemaps.
- mat_envmaptgasize <целое число>
- Устанавливает разрешение для файлов созданных с помощью envmap. Значение по умолчанию: 32
- mat_fastspecular <булева переменная>
- Quickly disable or enable specular rendering without reloading materials. This does not affect performance, only appearance. mat_specularmust be used for proper performance testing.
 Баг:Не работает в некоторых играх.  [нужно проверить в ?] Баг:Не работает в некоторых играх.  [нужно проверить в ?]
 Примечание:Despite common misconception, setting this to 0 does not enable a "fancy specular" mode, it simply disables specular rendering entirely. Примечание:Despite common misconception, setting this to 0 does not enable a "fancy specular" mode, it simply disables specular rendering entirely.
- mat_specular <булева переменная>
- Отключает или включает зеркальные отражения, выгружает или загружает зеркальные материалы из памяти. По умолчанию 1.
- r_showenvcubemap <булева переменная>
- Команда для отображения всех карт-кубов на всех динамических объектах в полную яркость. Использовалось для создания изображения в начале статьи.
Смотреть также
- $envmapmask (маска зеркального отражения)
- $phong (для рассеянного отражения)
- Cubemap


































