Unity3d shader official tutorial translation (9) -- shader Syntax: Pass atomization Processing

Source: Internet
Author: User
Shaderlab Syntax: fog

Fog parameters are controlled with fog command.

Fog command to control atomization Parameters

Fogging blends the color of the generated pixels down towards a constant color based on distance from camera. fogging does not modify a blended pixel's Alpha value, only its RGB components.

The color of pixels produced by atomization mixing is based on constant colors (this constant color is based on the camera distance ). Atomization does not change the Alpha value of a pixel, but only changes its RGB component.

Tutorial: atomization is a graphic rendering technology that simulates the effects of fog in the natural world on the visual effects of scene objects. This technology gradually fades the color of the object from the viewpoint to the background color. Through atomization, it can better show the distance from the object to the viewpoint. (Perform fuzzy processing based on the distance from the object to the viewpoint)

Syntax
Fog {  Fog commands  }
Specify fog commands inside curly braces.
Specify the fog command in braces

ModeOff | global | linear | exp | exp2
Defines fog mode. Default is global, which translates to off or exp2 depending whether fog is turned on in render settings.
Defines a fog mode. The default mode is global. converting it to off or exp2 depends on whether the fog in the rendering settings is enabled.

Tutorial: Linear | exp | exp2 corresponds to gl_linear (linear), gl_exp (exponential), and gl_exp2 (exponential square) in OpenGL)

Color  Colorvalue
Sets fog color.
Set the fog color
Density  Floatvalue
Sets density for exponential fog.
Set the fog intensity
Range  Floatvalue  ,  Floatvalue
Sets near & far range for linear fog.
Set the nearest and farthest values of linear fog
Details details

Default fog settings are based onRender
Settings
: Fog mode is either exp2 or off; density & Color taken from settings as well.

The default fog setting is based on the rendering settings: The Fog mode is exp2 or off, and the intensity and color are also obtained from the settings.

Note that if you useFragment programs,
Fog settings of the shader will still be applied. on platforms where there is no fixed function fog functionality, unity will patch shaders at runtime to support the requested fog mode.

Note that if you use fragment programming, the shadow settings will still apply. On the unity3d platform, there is no fixed function fog function, and unity3d will fix the fog Mode Supported by the shader request at runtime.

 

Original at www.j2megame.com. For more information, see.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.