One : Light source parameters Attribute meaning of property panel :
Type: One of the four light source types .

1. Parallel light : The simplest light , We think that objects affected by parallel light receive the same direction of light ,unity The position of the parallel light source is irrelevant , It can be placed anywhere , This does not affect the direction of the light source .
2. Point source : Light from a point , Only the radius range is r In the sphere of , And the intensity of illumination decreases with the distance from the center of the sphere .

3. Spotlight : From the same point , But the illumination range is a conical area , We can think of him as a flashlight , On the macro level , He's a light source 1/n, The light will also decay , Because it's conical , It's a little more complicated than a circle , He has an open angle angle It can be adjusted .
4. Surface light source : Currently it only works when baking , Light emitted in a certain direction , It also decays .
Color: Light source color .
Mode: Real time lighting , baking , Mixed three models .
Intensity: Light intensity .
Indirect Multiplier: Indirect light intensity , That is, after the sunlight hits the object , The intensity of reflection between objects , The brightness can be adjusted .ShadowType: Shadow type :Hard
Shadows, Soft Shadows, No shadows.
RealtimeShadows: Real time shadow , Related parameters can adjust the shadow effect of lighting , At the same time, the consumption will be different .
RenderMode: Types of rendering calculations for lighting , It is used in delayed rendering .
important: When calculating the illumination, it will be calculated piece by piece .
not important: Compute lighting per vertex or more efficiently .
auto: from unity Decide the lighting calculation method of this light source .
Culling Mask: According to the object's layer That is, the layer controls the light source to affect the object , We can mark objects that do not want to be affected by light sources as uniform layer, Set them up here .

Two :BRDF( Illumination model ) Any performance that appears in the game is the result of mathematical calculations , So how do we make our light look more real , More in line with human perception , It depends on whether the lighting model we use is powerful .
1. Standard illumination model light = Self luminous + Ambient light + diffuse reflection +
Specular self luminescence : The light radiated by an object itself , It's simple , You can use the material's self luminous color ambient light directly : In the real world , Objects are not only illuminated by light sources , It is also illuminated by objects in the surrounding environment , We assume that ambient light is used to simulate the total diffuse reflection of the effects of surrounding objects on our objects : Independent of the direction of view , It is thought that the light reflected is random , Equal specular reflection : By surface normal , Light direction , The part affected by the direction of perspective , You can imagine the luster on the blade , It's the result of specular reflection , From different perspectives , The results are different

2. Computational Lambert's law of diffuse reflection : The intensity of the emitted light is proportional to the cosine of the angle between the surface normal and the direction of the light source ( The reader can draw a picture to understand ), In fact, the more light, the more vertical the surface , The stronger the diffuse reflection is , The calculation formula is :Clight Is the light color ,Mdiffuse Is the diffuse color ,Max take 0 The maximum value of the sum dot product result , That is to say, the result of point multiplication is less than 0 The section of is set to 0, This is also the surface of the object will be distributed different intensity of light , And the back is all black ( The dot product on the back is negative , Set to 0)
3. Calculation of specular reflection Clight Light color ,Mspecular Specular color ,n Is the normal direction ,h Add the light direction to the angle of view and normalize it ( simplified calculation , Avoid calculating the reflection direction )

4. Fresnel reflection. Think about this , You're standing by the river , The river was shining in the distance , Fish can also be seen in the nearby river , Does this contradict our conventional lighting model , It seems like this , The more perpendicular our view is to the surface , On the contrary, the weaker the reflection effect is , If we need to get richer and more detailed lighting effects , Fresnel reflection is also part of our consideration , For example, combine the finier reflection with the standard illumination model . Feng Lele's blog has an article that uses diffuse reflection, specular reflection and Fresnel reflection to add up , And after we know the principle , Adjusting the proportion of each part to get the result we want is the process of constant adjustment , There is no right or wrong, only the right and wrong ,“ If it looks right
So it's right ”.

5. Vertex by vertex or pixel by pixel, first we need to know a little bit , In the model , The number of slice elements is much more than that of fixed points , A triangle of three vertices , There can be dozens of pieces in it , Some data of these patches are the result of linear interpolation of three vertices , therefore , Obviously , Computing lighting in vertices costs less than computing in slices , The same effect will be slightly worse , This is relative , We need to choose .

more unity2018 Please visit paws3d Claw academy search .

Technology