Unity3d "Shader" Custom illumination model

Source: Internet
Author: User

First, the theory

Equation 1: The color formula that the illuminated object eventually renders

Final color = material Color * Glow Color

Equation 2: Material color

tex2d (_MAINTEX,UV)

Equation 3: Light color

Illumination color = Spontaneous light + ambient light + diffuse reflection + specular reflection

Equation 5: Self-illumination

emissive = coloremissive

Coloremissive Self-luminous colors

Equation 6: Ambient light

Ambient= ka*colorambient

Ka Ambient light factor

Colorambient Ambient light Color

Equation 7: Diffuse reflection light

Diffuse=kd*colorlight*max (dot (n,l), 0)

Kd Diffuse reflectance coefficient

Colorlight Light Color

N normal vector

L Light Source Direction

Equation 8: Specular reflection

Specular reflection: light to the surface smooth, normal uniform surface of the object, this reflected light is called specular reflection light. Ks Mirror coefficient colorlight The color of the light n unit normal vector L is the unit vector of the light source from the point to the units of the observer's unit vector H (l+v) vector, i.e. normalize (l+v) shininess Specular strength coefficient, the smaller the value, the more diffuse the high light, the higher the value, the more concentrated the high light. Facing if the dot multiplication of N and L is greater than 0, then facing is 1 and if less than or equal to 0, then facing is 0

Unity3d "Shader" Custom illumination model

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.