当前位置:网站首页>Unity3d office scene lighting layout, light and shadow baking and post-processing [2020]

Unity3d office scene lighting layout, light and shadow baking and post-processing [2020]

2020-12-08 13:33:43 osc_ th8jvcw7

   Let's take a look at some screenshots of this case :

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




   This article takes an office space as an example , Discuss again with the children's shoes Unity3d Lighting layout for indoor scenes 、 Light and shadow baking and post-processing , Hope to help beginners , In this case 3dmax The scene is shown in the following two figures , The second one is a screenshot from the back . The number of model faces in this scene was originally 90 More than ten thousand , The surface lines crisscross , Like a spider web , In order to optimize the scene and facilitate the illustration , Miss, sister 3dmax The optimization of low face number reduced one-sided modeling method reconstructs the scene , From the statistics in the upper left corner of the figure below , The number of faces has been reduced to 21.5 ten thousand . No matter use Unity3d, still UE4, perhaps CE And other engines ,3d Models must be constructed with as few faces as possible , Otherwise, the later stage of light and shadow baking and real-time operation will encounter catastrophic stuck , This is a topic repeatedly emphasized by my little sister , I believe that some children's shoes have already felt the same , But there are still some children's shoes, which are hard headed and rush forward , Continue to use the modeling method of rendering and animation to build the scene , Finally, because the number of models is too high, I will trip on the ridge of light and shadow baking and real-time operation of works . So for VR And game scenes , The modeler must use the optimized single-sided modeling method with low number of facets to construct , No matter use 3dmax、maya、C4D、Blender、Sketchup、Modo, Or something else 3D Modeling software , Should strive to reduce the number of model surface .







Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   As can be seen from the two pictures above , The scene reconstructed by little sister , Topology Routing is simple and smooth , It looks comfortable , And the editing operation is smooth and free of jamming .

1. Scene structure analysis

   In order to facilitate the understanding of children's shoes for the follow-up of this example , First of all, miss, give a detailed explanation of the structure of this scene . You can see from the above two pictures that , This scene is an office space , From bottom to top -1 layer ( The basement )、1 layer 、2 The layer consists of three parts , For the convenience of observation , Miss, open the three floors as shown in the figure below . If you have children's shoes, you may think that none of the three floors has a roof , It's not , Because the little sister is a scene constructed with one-sided modeling , This scene is mainly about indoor , So the front of the roof is down , What you see from above is the back of the roof , So it looks like it's hollow , This is the feature of one-sided modeling , The back of the face is hollowed out , And when we look inside , The roof is visible , As shown in the second picture below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   There are three floors through the staircase , As shown in the figure below , In order to let people see the relationship , Miss, I moved the stairwell out horizontally , And the stairwell has a glass curtain wall , For lighting .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   At first glance, the scene looks complicated , Careful children's shoes will find 1、2 The layers are roughly symmetrical , As shown in the figure below , Since then , about 1、2 layer , We just need to figure out the red line in the second picture below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's first look at the right half of the second floor , The interior furnishings are shown in the following two pictures , There are sofas 、 tea table 、 ornament 、 Hang a picture 、 Water dispenser 、 Data cabinet 、 The chair 、 The reception desk 、 Corner desk and chair 、 Centralized desks and chairs 、 The printer 、 The photocopier 、 Desktop computer 、 laptop 、 shelves 、 Drinking cup 、 Desk lamp 、 Wash basin 、 closestool 、 Bookcase 、 Glass partition, etc .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The functional partition of the right half of the second floor is shown in the figure below , The right half of the stairwell has a reception area 、 Big office area 、 Two small office areas 、 Parlor 、 corridor 、 Toilet, etc .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Through the above diagram , I believe you can make clear the structure of the right half of the second floor , meanwhile , The whole two-tier structure ( As shown in the figure below ) It's clear that .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   After the two-tier structure is clear , Let's take another layer ( As shown in the figure below ), As shown in the figure below , The furniture layout on the first floor is different from that on the second floor , The building structure is exactly the same .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's take a look at -1 layer , As shown in the figure below , This layer is relatively simple , Be clear at a glance , No windows , It depends mainly on the lighting of the roof .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The stairwell and the basement 、 First floor 、 The connection of the second floor is shown in the following three figures , From the picture, you can see that there are skirting lines and internal corner lines in the walls of these three floors .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Through the above diagram , You should have a detailed understanding of the structure of this scene , At the same time, we can also see that the optimized single-sided modeling method with low number of faces can construct the scene with simple and smooth edges , The editing operation is clear and fluent , It can greatly reduce the number of model faces .


2. Model phase preprocessing



   The little sister emphasized repeatedly in other articles , be used for VR And the model of the game , Whether you use 3dmax、maya、C4D、Sketchup、Rhino、lightwave、softimage、
blender still modo And other software modeling , It is necessary to use the optimized method of single side modeling with low number of faces to construct the scene to greatly reduce the number of model faces , In order to make sure Unity3d The speed and quality of the scene baking and the smooth running of the final work in real time , At the same time, after the model is built , It should also be targeted at the model 、 texture of material 、 Mapping 、 The light 、 Cone culling 、 Occlusion culling 、LOD、 And the collision object to optimize the pretreatment , To avoid importing scenes Unity3d After that, I found that it was a waste of time to return to the modeling software for preprocessing .

  VR And game development is a multi person collaboration , Although the modeler is not involved in the art and the program , But it is also important to understand the requirements of these two stages for the model phase , In addition to the optimization of the low face number of simplified single-sided modeling method to construct the scene , The modeler should also know some knowledge points of optimization preprocessing , The following little sister on this aspect of knowledge to make a detailed explanation .

⑴. Optimization of modeling methods

   A lot of them just came into contact with Unity3d Children's shoes , It has been using the modeling method of drawing and animation before , That is to say, we are used to using the standard geometry provided by modeling software , Or stretch with two-dimensional lines 、 rotate 、 Object lofting, etc , Using Boolean operations to open holes without interruption , The number of object faces constructed by this modeling method is very large , Model selfing is serious , A lot of them are useless ,Unity3d even to the extent that UE4、Cryegine、 Frost and all the engines , It is strongly recommended to use the optimized low facet reduction one-sided modeling method to construct the scene , In short , Use the least number of faces to build the scene , Because the number of model faces is the biggest cause of machine jam , Some children's shoes are paranoid , Just don't change bad habits , You have to model in your own way , That's no problem. , Take a few steps forward , Must be stuck on the number of superelevation model surfaces . Modeling methods are different , The number of faces constructed for the same object varies greatly , Because of the game and VR The engine scenario is implemented , Unlike renderings and animations , Finally, it is only rendered as still frame picture or picture sequence , Starting with modeling , We don't pay attention to the number of model faces , It will lead to a lot of subsequent processing difficult to promote . Optimization of low face number and simplification of single side modeling , It's simple poly, Through the tangent plane line , And then push and pull to construct the object , It effectively avoids model self intersection , It can also greatly reduce the number of model faces , So we suggest that you use the method recommended by little sister to build the scene , The case scenario you see above , It was built by the young lady herself , The surface line is flat and simple , The number of noodles is very low . It's for Miss Xiaojie 《Unity Model preprocessing, lighting, baking, post-processing, special effects, art scene optimization, actual combat video tutorial 》 Support , Miss miss will give you a video on how to optimize one side , All of the max Model 、 Mapping 、Unity3d scene 、 Source code 、 Plug ins and more cases are included , Copy a number of cases , To really get rid of the tutorial , Make a high appearance and have a good appearance unity works , Otherwise, it's like reading a recipe and learning how to cook , As soon as we see it , As soon as it's done, it's useless .

⑵. Model topology routing optimization preprocessing

   In the previous illustration , You must see the object shown in the figure below , We might as well move it out alone , Someone must ask , Why does little sister model like this ? This is the so-called topological routing problem , That is to say, the layout of the boundary line on the object . In general , object (poly) The wiring should be based on the shape of the object 、 texture of material 、 Mapping 、 Deformation and resolution UV2 We need to deploy , At the same time, the layout of these sidelines determines the number of model faces , Unreasonable wiring will make the number of faces of the model rise sharply .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   There are many questions about children's shoes with single side modeling , I think that single side modeling is to reduce the number of model faces as much as possible , Some models don't need boundary lines on some surfaces , But it was found that some of the surfaces were lined instead , This is exactly the wiring of the object according to the shape of the object 、 texture of material 、 Mapping 、 Deformation and resolution UV2 The reason why we need to deploy . Let's talk about the wiring according to the shape of the object ( That is to say, the edges and faces of an edit polygon can be cut or divided ), Because there's a window in the position above , We need to open a window in that position , In general , According to the optimization of low face number, one side modeling method is simplified , First construct a geometry the size of the window wall ( This is shown in the first picture below ), Then, two lines are laid on the upper, lower and left and right sides of the surface to be opened ( That is to connect two lines or split two lines ), Form the mesh face shown in the second picture below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, select the center face ( The red part of the first picture below shows ) Delete , Form the opening shown in the second picture below , Empathy , There is also a hole like this in the back , Then bridge the edge lines of the two openings , Form the window hole shown in the third picture .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Some children's shoes that have used one-sided modeling think that the window opening is ready , however , The little sister thought , There is also a need to further optimize the wiring . The reason is that the above method divides the front of the window wall into 8 Face to face ( As shown in the figure below ), More Than This , The back is also divided into 8 Face to face , meanwhile , Two nodes are added to each outer line , Divide each outer line into three segments , Import Unity after , The top surface will be added with two nodes at the front and the back respectively , The automatic connection node is generated as shown in the second figure below 6 A triangle , The bottom surface and the two sides are also generated 6 A triangle , This window wall will become 64 Face to face ,unity3d The surface of the model is treated as a triangular surface , That is to say 3dmax It's the four sides of u3d in , It will automatically connect the diagonals of each quadrilateral face into a triangular face , above 64 Face to face , Namely 64 A triangle ,64 How did the noodles come from , Front and back walls 8 Four sides , Namely 16, Window hole 4 Four sides , Add up to 20 Four sides , Automatic conversion to triangulation is 40 individual , The top of the window wall 、 Bottom 、 The left and right sides will automatically become 6 A triangle , And then there is 24 A triangle ,40 A triangle +24 Trigonometry , in total 64 A triangle .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   If you do some optimization on the wiring , In the next picture 2、3 Nodes and nodes 1 Welding ( Or merger ),5、6 Nodes and nodes 4 Welding ,7、8 Nodes and nodes 6 Welding ,10、11 Nodes and nodes 9 Welding , Form the wiring shown in the second figure below , The front of the window wall is just divided into 4 Four sides , It also doesn't split the edges of adjacent faces , Since then , The whole window wall ( Before and after 4 Four sides , Top, bottom and left and right sides 4 Four sides 、 Window holes 4 Four sides ) in total 16 Four sides , Import u3d Auto convert to 32 A triangle , This is half the difference from the previous wiring method , Some children's shoes say , Half the difference doesn't matter much ,1 and 2 Half the difference , No difference , Don't forget , A scene 50 Wanmian and 100 Ten thousand faces ,200 Wanmian and 400 There's a big difference .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   If Topology Routing is not optimized , Such objects are copied in large numbers , The number of model faces will increase exponentially , The example of little sister is simple , If it's complicated , Topology Routing is not optimized , It's not 2 The relationship between times , This is the reason why the elder sister used this kind of wiring in this scene .

   Now compare the same object in 3dmax In the different wiring after quadrilateral and vertex difference and import Unity3d Then it's converted to the case of triangular faces and vertices , As shown in the following two figures .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   As can be seen from the diagram above , Different topology routing , The number of faces and vertices of a model is different , Children's shoes , Why emphasize the number of vertices in the model ? Because the surface of the model is made up of lines , A line is made up of vertices , It's not so much that the number of faces in the model is too much , Rather, it's caused by too many vertices , There are children's shoes must not accept , Then we can construct a teapot with tens of millions of faces by modifying the number of segments in our familiar modeling software , Then delete all faces , Leaving only the top , We will find that , Even if there is no model surface , The vertices is too laggy and very stuck , That is to say, the real jam is actually caused by the vertex , So when modeling , Control the number of faces , Also control the number of vertices , The little sister uses oblique wiring to let multiple triangles or quadrilateral faces share vertices , To control the number of vertices , The object shown below , If you use solid modeling , The number of vertices and faces will exceed a thousand , The little sister only used dozens of faces and vertices .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Some children's shoes are not satisfied with the optimized low face number and single side modeling recommended by little sister , I'm not convinced , Come on , Little sister, give you some pictures to shock you , Please see the picture below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The above low facet model is to use the optimized low face number to simplify the single-sided modeling and to cooperate with the following split UV1 The ultra-low facet number model is constructed , If you're a modeler , Or modeling at the same time , If you don't master the optimization of low face number to simplify single side modeling , I don't think you can do it VR And the model of the game , Not to be scolded to death by subsequent artists , I was fired by the boss , If you do it yourself , Scene Caton's going to piss himself off .

   Of course, some children's shoes will say , We don't need the single side modeling mentioned above , The front window wall can use several box Come and pile up , That's ok , The problem is a few box A pile of walls , The surface area is much larger than the one-sided modeling , Split UV2 when , Wall of UV Blocks can only be shrunk to fit , This will reduce baking quality . Therefore, it is strongly recommended to use the optimized low face number simplified one-sided modeling method to build the model , The topology routing of the model should be optimized and preprocessed , To further reduce the number of model faces , According to the object modeling needs of wiring, that's all .

   Let's talk about the topology routing according to the material needs , When different surfaces of an object need different materials, they are , You need to wire at the junction of the material , This is easy to understand .

   When an object has the same material , And different faces need different textures , You also need to wire the edges of the textures to split the faces .

   For wiring according to the deformation requirements of the object , It can be seen in curved objects 、 Alien objects 、 Role modeling , Wiring around a turn or corner of an object , It's easy to understand .

   According to the split UV2 The required wiring ( As shown in the figure below ), This may not be easy to understand , The little sister explained with a familiar example in our life , When we are cooking , Always cut off the food , If you don't cut off , The dishes will be in an overhead frying pan , Make the frying pan a lot of space wasted , I understand this , So it's easy to understand according to the split UV2 The requirements of wiring , That is, when the aspect ratio of some surfaces of an object is large , It needs to be properly wired on these sides , Divide this face into several faces with small growth width ratio , Because when the aspect ratio is too large , These surfaces are flattened to UV In space , To accommodate the longer sides , The other side will become very narrow , That is to say, these surfaces are in UV There is a slender shape in the space , Not only is its width insufficient to show the light and shadow of these surfaces , It will also make all of UV The blocks are concentrated in UV A corner of space , It's just like an overhead frying pan without cutting vegetables , It's not good for UV A uniform arrangement of blocks , Many make UV Space is wasted , Finally, the baking quality is reduced .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   The above inner wall wiring is both split UV2 The need for , It's also the need to copy the same object when modeling , It is the best choice to meet various requirements at the same time when wiring , As the saying goes, kill two birds with one stone . This kind of routing will increase the number of model faces , But the number is limited . In order to improve the subsequent baking quality , Add 100 faces , Nothing surprising .

⑶. overlap 、 Hidden face optimization cleaning

   Whether you use solid modeling , Or use the optimized low face number to simplify one-sided modeling , Inevitably, overlapping and hidden model faces will appear , The following image shows the overlapping faces , There are many such faces in this case scenario , It's impossible to mark them out here , But according to the diagram , I believe that you can judge which model faces belong to overlapping surfaces . These faces are invisible when running in real time , If you don't delete , It will keep the number of model faces of the scene high , Some children's shoes think that some overlapping surface is very small , You can ignore , This is the wrong idea , all 3d Software face recognition , Regardless of its size , So these surfaces in the modeling process , You should delete , Especially before copying the same object, you should delete it , If you wait until the layout of the whole scene is finished, delete it , The workload is terrible ! In addition, if these faces are not deleted , I'll talk about splitting later UV1 when , Manual splitting can be a lot of work , At the same time, it's splitting UV2 when , These useless surfaces are flattened , It's going to squeeze a lot of UV Space , Make really effective UV Block reduction , It reduces baking quality and prolongs baking time . Therefore, deleting overlapping faces is an important factor that can not be ignored to reduce the number of model faces and improve the baking quality and speed up baking , This is also a lot of children's shoes scene surface can not be reduced 、 The secret of poor baking quality and slow baking .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The following image shows a hidden face , These surfaces are different from overlapping faces , Although it doesn't overlap with other model faces , But in Unity3d When the work runs in real time , From the height of the camera , It's like these faces are hidden , You can't see , These surfaces exist , It not only increases the number of model faces of the scene , It will also be split for later UV1 Increase the workload , At the same time, the faces are splitting UV2 Flattened when , It's going to squeeze a lot of UV Space , Flatten the effective model surface UV Block reduction , It not only reduces the baking quality , It also slows down the baking process , So these faces should be deleted in time when modeling , It is also strongly recommended to delete these faces before copying the same object , Of course , Some models are before copying , Due to the location factor , Some have no backs against walls or other objects , But in another place after copying , The back will be against the wall or close to other objects , Form a hidden surface , These have to be copied and then deleted . Delete hidden face is also a lot of children's shoes scene face number can not be reduced 、 Low baking quality 、 Another important secret of baking for a long time .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   There is also a hidden surface , It's when you build something by copying something , by mistake , Formed by not removing useless surfaces in time , As shown in the middle of the picture , It is formed when a continuous wall is constructed by copying a wall with an end face , If this kind of face is not deleted , After baking, there will be black cracks in the wall , As shown in the second picture below , There is a lot of this hidden surface , Not only will it increase the number of model faces , And it affects the splitting UV2 The speed of , At the same time, it will reduce the baking quality .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




⑷. texture of material 、 Optimized preprocessing of maps


  Unity3d The more materials in the scene , The greater the load , The more textures there are 、 The bigger the size , The greater the load , So the material should be controlled 、 The number of textures and the size of the maps .Unity3d Only support all kinds of 3d The standard materials of modeling software and the multi-level and material generated by standard materials , Don't support all kinds of 3D Advanced materials of modeling software and Vary、MentalRay、FinalRender 、Brazil Third party renderers, etc , So it's used for Unity3d Model of , You just need to 3d In the modeling software, we can distinguish different materials by simple mapping of standard materials ,Unity3d It has its own material system , It's no less effective than third-party renderers .

   Let's take a look at the material and texture of this case scene , The red line in the following figure identifies the sample ball of the material in the scene , The figure is visible , The whole scene uses only two materials .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's take a look at the first material ( As shown in the figure below ), This material is made of 3dmax The standard material of , There's only one on the solid colored channel 512x512 The texture of , And the texture is special , In the past, all the textures were single texture , And this map contains multiple textures and color blocks .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Some of the textures and color blocks in the above map correspond to the maps of objects in the scene, as shown in the following figure , See this map , Many children's shoes are puzzled , Usually use a single texture to paste the material through repeated mapping , There are so many textures in this texture , How to stick it to an object ? You bet , This kind of texture can't be directly attached to objects , You can't use duplicate maps , It needs to be split up UV To post , It's also known as the exhibition UV, In the other examples above, my sister talked about splitting UV2, And the split here UV It's a split UV1,UV2 The control is the light and shadow map ,UV1 The control is texture mapping , Next, miss, I'll use a few examples to demonstrate how to split UV1 To map objects , It should be noted that , The texture of an object is attached to the object through the material , Maps can't be applied directly to objects .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Make a keyboard according to the following figure ( Red stuff ), Then assign the first material in front to the object , As shown in the second picture below , Obviously , The texture of the material is not correct , Now let's split UV1( Also known as flattening UV1 Or show UV1) To map the keyboard correctly .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Select the keyboard object , Add a Unwrap UVW( Flattening UVW) Edit modifier , As shown in the figure below , Then click... In the picture “ open UV Editor ” Button .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   In the pop-up UV Editor ( As shown in the figure below ) We see a white wireframe , This white wireframe is used to control keyboard object mapping UVW coordinate , Its form is also a box, This white wire frame is box Looking down , The top and bottom surfaces overlap , The four sides correspond to the four sides of the keyboard , Because the texture is flat , You can't stick it on the side like this , So try to flatten the sides , And pull apart the overlapping bottom and top surfaces .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   To flatten the keyboard object UV1, Follow the steps shown below , Will automatically flatten all faces UV.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Automatically after flattening UV A mesh of faces ( As shown in the figure below ), According to its shape, we can roughly determine which faces of the keyboard object these meshes face , When these faces are meshed, they are selected , Which side of the keyboard object do these grids face , Click on any one with the mouse , The corresponding face of the keyboard object in the scene is highlighted in red .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   When you click on this with the mouse UV At the bottom of the editor UV Face time , The keyboard object in the scene is highlighted in red , Illustrate this UV Face to face is the keyboard object above ( As shown in the figure below ).

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   We can also use the mouse click to select the face on the keyboard object in the scene ,UV The editor corresponds to this object face UV The face is also highlighted in red , for example , When we select the left side of the keyboard ,UV The second one in the editor UV The face is highlighted in red , Illustrate this UV Face to face with the left side of the keyboard ( As shown in the figure below ).

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Master the search object surface and UV After the correspondence of faces , Now let's display the texture map according to the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, use the mouse box to select all the flattened UV Noodles , Drag it out of the black line , The black line is the scope of the screenshot , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, click on the corresponding keyboard UV, Drag it to the approximate location of the keyboard pattern , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   And then UV Change to node mode , Use mobile 、 Zoom tool , Adjust the keyboard object UV The four vertices of the map are roughly coincident with the four vertices of the keyboard pattern in the map , At this point, the keyboard map should be displayed correctly on the keyboard object in the scene , But there was no change , It's still a mess , What's the reason ? This is a problem often mentioned by many online second goods , That is to change the texture of the material UV, The texture on the object doesn't change .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's first look at the channel of the map in the material panel identified in the figure below , Channel value is 1, In other words, the texture of this material is in the channel 1 On . Let's look at the bottom right corner flattening UVW The editor's UV Control channels . Channel value is 2, in other words , This flattens UV The map channel controlled by the modifier is the channel 2, The problem has been found ? This is the corbel tied to the horse's crotch , If someone doesn't understand it yet , I'm just explaining , in other words UV In the editor UV It's the channel that controls 2 The texture on , The texture of keyboard objects is in the map channel 1 On , Keyboard object map channel 2 There's nothing on it , The natural texture will not change .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, follow the tips below , Will flatten UV The channel value of the modifier is changed to 1.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Da da da da , Change it to 1 after , The keyboard map correctly shows , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, use the node mode to move the rest out of the map range UV Adjust to roughly square , Then put these UV Overlap , As shown in the second picture below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   And then all of the UV The four vertices of are adjusted to coincide with each other , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Use the face mode box to select all overlapped UV, Use the zoom and move tools to adjust it to 1 That's ok 2 In the color block of the column ( As shown in the figure below ), Because the color of this color block is close to the color of the keyboard .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Zoom in UV Edit view , That will overlap UV Adjust to within the color block , Can't intersect with adjacent color blocks , Now we can see , The rest of the keyboard is pasted with the texture of this color block , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Finally, flatten the keyboard UVW Modifier collapse , The final texture of the keyboard is shown in the following figure , thus , By splitting UV1 The process of applying multi texture maps to the keyboard is over .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Let's take a look at the second material in this case , As shown in the figure below , Obviously , This material is used for hanging pictures , The map contains all the texture of the picture and the texture color block of the frame . This material is the same as the first one , It's all about 3dmax The standard material of , Also is pastes a multi texture map on the solid color channel .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The material and texture scheme in this scene , Ingeniously reduces the texture size 、 The number of textures and textures , Greatly reduce 3d The memory consumption burden of the scene , At the same time, it can accelerate Unity3d Real time running of the work . This material and texture strategy , It was carefully planned before modeling , It's not just about it . You can think about it , If the color blocks and textures in the two material maps are made into separate materials , Compared with this material scheme , It is self-evident which is better or worse , Therefore, this material and texture strategy is worth learning from . But to apply this texture scheme , You have to plan carefully in advance , And you have to master how to split UV Technology .

   The reason why the little sister inserted the split here UV1 Knowledge points of , The main purpose is to let you understand the material in this case and how a multi texture map is pasted onto the model , I hope you understand . Split UV1、UV2 It's called splitting UV, Actually there are UV3…,UV8, in total 8 Channels ,UV1 It controls texture mapping ,UV2 It's the one that controls the shadow map , You can also have a control altitude map 、 Color map 、 Highlights 、 The channel of the normal graph , Split normal map , It's the legend of high mode to low mode , All in all , Split UV It's a very complicated knowledge point ,Maya、C4D、Modo etc. 3d Software has this concept . If you don't understand splitting UV1, There's no way to use multi texture maps to optimize materials , Don't know about splitting UV2, The baked image must be fuzzy and full of defects such as dirty spots .


⑸. Light based model preprocessing

   On the Internet, people often ask Unity3d After baking the light and shadow , corner 、 Inside corner 、 There is light leakage or shadow leakage at the skirting line , So how did this happen ? We still use the model of this scheme to explain it , In order to reduce the number of model faces , all VR And game engines strongly recommend using the optimized low facet reduction one-sided modeling method to build scenes , What's more, from the point of view of the display camera, which model faces need to be constructed , What can not be built , for example , The following scene is just a show room , There's no need to show outdoor , A lot of people use one-sided modeling to build this scene , Only build the model surface that can be seen by the indoor camera , Now the back of the roof 、 The back of the interior wall 、 The back of the floor
It's all hollow , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   If you only use a point light source 、 The surface light source is used for indoor lighting , Or use the surface light source to light the room from the window , There's no problem with it , Because the room is closed , But often in order to increase GI effect , Will turn on the sky , What is skylight ? Skylight is the light from all points on the surface of an infinite sphere to the center of the sphere along the radius of the sphere , Because the back of the roof 、 The back of the interior wall 、 The back of the floor is hollowed out , Can't block the sky , Make the sky shine through the wall , The indoor scene , After baking, there is a disordered leakage of light or shadow , And there's no level of light and shadow in the room , It's the same with directional light . So import the model into Unity3d Before , The back of the model with one side modeling hollowed out should be closed with a simple model surface , To prevent light from entering from the wrong hole , Light should be allowed to enter the room through windows and other light holes , And then after many rebounds , There are layers of light and shadow , This is the reason why many people bake scenes without layers . For the second level of this case , Build a simple exterior wall , Show the window , Block the back of the hollowed out interior wall , In case the light goes through the wall , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Build a simple 2 Outside the roof , It's like the lid of a shoe box , Cover the back of the hollowed out second floor roof , In case the sky light and the parallel light come from the roof , Remember to have a certain height , In case it coincides with the inner surface of the second floor roof , Spots appear after baking .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Empathy , Build a simple exterior wall for one floor , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Build the model surface as shown in the figure below , Used to block light leakage from the back of the second floor and the back of the first floor , Where it breaks is the glass curtain wall , This should be the right light in .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Empathy , by -1 Layers build simple exterior walls , There are no windows on this floor , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Build the model surface as shown in the figure below , To block out - Floor back and -1 The back of the story roof leaks light .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Finally, build the model surface as shown in the figure below , To block out -1 The light leak on the back of the floor .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   By constructing the above simple model surface , Block all the light from the outside , Only outdoor light is allowed ( daylight 、 Directional light and other lights placed outdoors ) From the normal opening ( window 、 skylight 、 Doorway 、 Curtain wall, etc ) Get into , To produce a layered lighting effect , The simpler these models are, the better , It can be anything , As long as you can block the light , You don't have to set special materials and textures for it , When baking, the resolution can be set very low , Even if there are baking stains 、 Black spot 、 Even black doesn't matter , Because you can't see it from inside , If it's baking in still light , You can even delete it after baking , It's only there to block out the light that doesn't come in normally when it's baking . in addition , You can see from the above diagram , There seems to be no glass in doors, windows and glass curtain walls , It's not , The front of the glass is facing in , Or say the line is inward , It's glass from the inside , The inward facing glass can block the light from the interior to the outside , Can't block the light from outside , This is exactly what we want , Please don't exaggerate , Add another glass facing out , If you add glass facing out , Completely seal off the outdoor light , Sunlight and skylight cannot be incident , If you really want to add glass facing out , Hide it when baking , It's shown after baking . Some children's shoes will say , Why don't you use the glass material to let the glass out of the window light , That's ok , But the problem is complicated , So it's right to do what the little sister said .

   in addition , The grille light in the room , stay Unity You can directly set it as a luminescent material , To simulate the lighting of a real grille lamp , If the door glass 、 Window glass 、 The curtain wall glass is set as a luminous surface light source to simulate the light reflected from particles in the atmosphere to the room , The glass is baked and then changed to glass , Poor light and texture , So we don't have to make these glasses luminescent , But on the back of these glasses, we build some face objects as big as glass , And step back a little bit , Then set it to luminous material , Project light from a surface light source to illuminate the room , Never put these surfaces in front of the glass , Otherwise, it will block the light from the glass , As shown in the figure below , Pink objects don't need to be baked , And can be deleted after baking .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The above model is based on light preprocessing , These jobs have to be imported unity3d Completed before .



⑹. Optimized preprocessing of colliding objects

   Whether you use Unity3d Development VR, Or the game , You'll use a walkthrough camera , Because the roaming camera has gravity , In order to prevent the camera from falling freely or through the wall 、 Wear something and pass by , Objects in the scene ( Especially the ground ) Collision objects must be set up ( Also known as obstacles ), The specific settings are shown in the figure below , But for larger scenarios , Every object has an obstacle property set , The real-time runtime is bound to increase the burden of rendering operations , It's likely to cause a jam . A lot of children's shoes reflect , My camera works fast and slow when it runs , Especially in dense places , The camera is stuck , The resistance is very high , Where objects are loose , Suddenly the camera is running fast again , This phenomenon is caused by the real-time calculation of obstacles .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   How to solve the above problems ? According to my little sister's experience , But in the familiar 3d In modeling software , Rebuild a simple model with low facet number that completely coincides with the original scene ( Or a simplified version of the scene ), As shown in the figure below , This model doesn't need to be textured or textured , Import Unity3d As a stand in for the scene , To accept the obstacle recognition operation , such , Because this double has no material or texture ,, And the number of faces is very low , Without baking and real-time rendering at the same time , So it can skillfully solve the jam caused by the huge and complex collision operation of the original scene , In short , It is to use a simple geometry with no material, no map and no rendering to replace many objects with complex materials and maps that need to be rendered in real time to detect obstacles , Real time runs much smoother immediately , The specific structure is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Model import Unity3d after , Don't check the figure above for complex scene objects “ Create obstacles ” Options ( If the scene is complex , After checking this box , It takes time 10 A little bit ), It's about simple " double " Check the object “ Create obstacles ” Options , Because there is no material, no texture , And the model is simple , It's over in a few seconds .

   A new question comes again , We said that just now , Set up “ Create obstacles ” You have to choose assets In the panel FBX file , As shown in the figure below , And when we choose FBX The first mock exam is any model , nothing “ Create obstacles ” The option to , As shown in the second picture below , It can be seen that the obstacle is aimed at FBX Of documents , If you export the avatar with the scene model from the modeling software , Import Unity3d after , Can't set stand alone “ Create obstacles ”, Therefore, the avatar should be separated from other models of the scene , Export it to FBX file , If the modeling software you're used to has “ Export selected " function , Choose the avatar directly , Use this function to export FBX file , And then the reverse election , Export the remaining scene objects to another FBX file , such , Import Unity3d after , Stand in objects can be set individually “ Create obstacles ” 了 , If you model software objects “ Export selected ” function , Just copy a model file , Get two scenes , A preserved scene model , A stand in object , In this way, we can export FBX The file .


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   As mentioned earlier, avatars don't need to be rendered , Smart kids' shoes will think that the stand in object coincides with the scene model , It's bound to flash , you 're right , It's bound to flash , That's why I mentioned the settings without rendering , There is no need to render , It just doesn't show the object in real time , In the figure below, the stand in object and scene object completely coincide , The mouse moves to flash face , To show you the double , Close the scene object according to the second picture below , The scene shows the covered surrogate .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, select the avatar , Then click the prompt below to cancel “mesh Renderer”( Real time rendering ), It's forbidden to render avatars in real time , That is not shown in the scene , But accounting is an obstacle , And then show the objects in the scene , In this way, there will be no flash because the avatar and the scene object coincide .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Finally, don't forget to set the stand in object as the obstacle according to the following figure , It also needs to be explained that , Because the Avatar has canceled real-time rendering , No material, no texture , It doesn't produce shadows and receive light , And it won't be baked , So there's no need to split it in modeling software UV1,UV2.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Because this case is an indoor scene , There is no need for outdoor display , That is to say, the camera will be trapped indoors , So the avatar just needs to build a wall 、 roof 、 The floor 、 door 、 Stairs and indoor objects can be , It's important to note that , The wall 、 roof 、 The normal of the floor must face inward , But if it's an outdoor scene or both , It also needs to construct the outdoor part , Understand the structure of the avatar above , I believe that we will also be able to construct outdoor double , Doubles can be combined into one object , It can also be multiple objects , All doubles should be streamlined .

   Come here , I need to emphasize a little bit to Xiaobai , The modeling software exports more than one in batches in the same scene FBX file , To take them from assets The panel is loaded into Unity3d Scene , They should be moved from assets The panels are dragged into the hierarchy one by one or together (Hierarchy) panel , As shown in the first picture below , Such FBX All models in the file will be aligned according to the position in the modeling software , In other words, the relative position in the modeling software should be kept , This operation ,Unity3d Will FBX The coordinate origin of the file and Unity The coordinates of the origin coincide and align , Because the modeling software exports the same scene in batches FBX file , Having the same coordinate origin , So drag it into the hierarchy panel , all FBX The model of the file will be automatically placed according to the relative position in the modeling software . But if it's directly going to FBX Drag files into Unity3d Scene view of , As shown in the second picture below ,Unity3d It ignores the coordinate factor , Where is the mouse , will FBX Where is the model , So it's hard to press the model 3d Position alignment in software , This method is suitable for importing one and other from the outside FBX Irrelevant model placement , Adjust the position mainly by visual inspection . These are two different ways to load the model , I hope you can think about the difference between the two .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




⑺. Split UV2

   because Unity3d Split UV2 There are fatal defects in the function of , So it is strongly recommended that you use what you are familiar with 3d Modeling software split ( Flattening ) The mapping coordinates of the light and shadow map , That is to split UV2, This work should be done in the model import Unity3d Completed before , Split up UV1、UV2 Will be saved in various modeling software export FBX In the model , Import Unity3d It will be recognized automatically after .VR And baking game engines , Its essence is to render the light and shadow accepted by all faces to their corresponding flattening UV On the block , Multiple UV The areas are arranged in one light UV, Light according to light UV After rendering , Generate a lightmap , Finally, the light map is mapped according to the light UV Paste the relationship of the model to the corresponding model surface . It's called baking , It's because the light on the object is like the trail of fire baked on the bread when baking , It grows on an object and gets its name , If you don't understand , We can imagine wearing vests and sandals in summer , The sun's light is preserved on the skin like . Split UV2 It is to put all or part of the model face in the scene , Spread all ( It's flattening ), Similar to the previous split UV1, It's just a split UV2, Flattening is to render light , Not like it UV1 The flattening is for the texture . Split UV2 Before , All the pretreatment work must be finished , Because once you change the model , Split the good UV2 Is failure , It has to be broken down again , So split it up UV2 front , You have to do all the preprocessing , Because split UV2, It can't be done with one click , It's going to take some time , One UV2 It's also possible to split up for a few hours , Some people even have poor machine configuration , It's also possible to split up for a few days , Follow the method in the little sister video tutorial , You can finish one in a few minutes UV2 The split .

   Because split UV2 It's the last process in the modeling software , At this point, we need to sort out the whole scene , One is to import Unity3d After easy to manage model , On the other hand, it's for the convenience of splitting UV2, because UV2 It can be split by group , If an object, an object, is split , It's not just fragmentary , And it's too much work , So it's better to split it up after playing groups .

   Let's show the whole scene first ( As shown in the figure below ), If your machine is too low, As long as the relationship is clear , You can't show it all , It's part by part, part by part .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   First of all, we choose 4 Orange objects and three layers of exterior wall skin were selected and grouped into a group , And named it in pinyin “zheng_guang_ban”, It's the sunshade , We said earlier , These objects are mainly in Unity3d Used to block the light when baking , Although the final work can not see these aspects , But to make these objects opaque , It has to be baked , You have to have light to bake UV, That is, it has to be split UV2, Because they don't matter , So it can be baked very small , The resolution is set to 512 or 256, Even set it to 128, It's just to block the light , It doesn't matter whether the baking quality is good or not , Finally, the resolution value is added after the group name , In order to be in Unity To identify , Here the little sister sets the resolution of this group to 256x256. It needs to be explained , The orange light shield is three separate objects (poly), The exterior walls of the three floors are in a group , Group nesting is allowed when grouping , It doesn't affect the split UV2, Grouping is for easy selection and management , When splitting, the existence of groups will be ignored , Split individual objects one by one . The group is finished , Hide this group .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, select the green object in the scene , As shown in the figure below , This object coincides with the interior of the three story building and all the interior objects , It's for Unity3d As a stand in for the scene , No material, no texture , No need to bake , So there's no need to split , Although it's a separate object , You can also be multiple objects , Let's play a group, too , The group is named “ti_shen”, Here's to say , The name of the little sister is separated by an underline , It's for everybody to spell , Some people don't know English is bad , Or English is not good , When you see the letters, you'll get confused , So it's suggested to name it this way , So that the following artists or programs can identify . This group doesn't have to be split and baked , So there is no resolution value after the group name , After grouping, hide this group .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, choose 1,2 Inside the window 、 Inside the door 、 The red side behind the glass in the curtain wall , As shown in the figure below , At that time, we constructed these surfaces , I want to import Unity3d Then set the luminous material for it , It is used to simulate the light reflected by atmospheric particles from these holes into the room , Some children's shoes say ,Unity3d There's a light source , Why should we do more than that ? This is because it is easy to locate objects in modeling software , If you use unity3d To simulate , You need to place a surface light source for each opening , One by one , Too many quantities , add unity3d The surface of the model is treated as a triangular surface , There are too many lines , Serious visual interference , It is inconvenient to locate the surface light source , So the little sister constructs these surfaces directly in the modeling software to replace Unity3d The surface light source of .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   We group the faces , And name “win_light”, Because these surfaces are ultimately invisible , Just for lighting , It's like Unity3d It's the same with other light sources , No need to bake , So there's no need to split UV2, So we don't need to identify the resolution in the group name , After baking, you can delete the noodles . We add... After the group name UV The resolution of the , One is to identify which groups need to be split UV2, On the other hand, determine how much resolution the group will be split , Of course, the more important thing is to enter Unity3d after , Set the resolution of the lighting map when baking according to this logo , That is to say, the function of making remarks , The size of the resolution , This has to be summed up through repeated practice , It's like how much each seasoning should be added when cooking , It takes hands-on practice to accurately grasp .

   Some children's shoes here will ask , Why don't you add in the grille lights on the roof , Isn't it supposed to glow , Yes , But the light-emitting surface of the grille lamp should be luminous , And you have to see , Miss, I want to directly use the face of the grille lamp to light up , So we need to split UV2 And baking , The little sister didn't add them to this group , I want to go through the channel of one of the two materials in this scene Unity3d Play the starting light body in the material of , We'll take a close look at it later .

   Next we select all the objects in the stairwell , As shown in the figure below , The formation is “lou_ti_jian_2014”, Set split UV2 The resolution is 1024, The reason why my little sister is named after pinyin or English , It's to prevent garbled code , although Unity Now support Chinese , But some places are not thorough , Therefore, it is suggested to use pinyin to name in English , Separate it with an underline , It's for the sake of subsequent art and program identification . After grouping, hide this group .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's select all the objects on the second floor and form a large group , As shown in the figure below , The formation is “2_ceng”, Don't set the resolution , The purpose of this group is to make all the objects on the second floor Unity3d Good management , Pack everything together .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, open the newly made “2_ceng” Group , Select all interior walls in it 、 door 、 window 、 partition 、 Socket , The formation is "2_ceng_nei_qiang_2048", These objects have the largest surface area , So set the resolution to 2048.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Then select “2_ceng” All the furniture in the group , The formation is "2_ceng_jia_ju_2048", As shown in the figure below , The surface area of these objects is also very large , So set the resolution to 2048. The resolution here is just a representation of , Split UV2 It will be used .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, choose “2_ceng” All the curtains in the group , The formation is "2_ceng_chuang_lian_1024", As shown in the figure below , The surface area of these objects is not very large , So set the resolution to 1024.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Then select “2_ceng” All the murals in the group , The formation is "2_ceng_bi_hua_512", As shown in the figure below , These objects have a smaller surface area , So set the resolution to 512.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Continue to select “2_ceng” All the floors in the group , The formation is "2_ceng_di_ban_1024", As shown in the figure below , These objects have a slightly larger surface area , So set the resolution to 1024. Some children's shoes ask , Why do you have to put the floor together , Why not make a face , Repeat the post with the same texture , you 're right , You can do this , But this case is to show you how to optimize the scene with the least amount of materials and textures , The floor texture and other textures share the same texture , There's no way to repeat , You can only repeat the model , And the number of repetitions on the floor is limited , So it doesn't put too much pressure on the scene , By flattening UV1, Put all the floor's UV1 Overlap , Fit in the texture of the texture of the floor , This is another way of mapping .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Choose again “2_ceng” All ceiling and grille light frames in the group , The formation is "2_ceng_diao_ding_1024", As shown in the figure below , These objects are similar to the floor , So set the resolution to 1024.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Finally, choose “2_ceng” The light piece of the suspended grille lamp in the group , The formation is "2_ceng_ge_shan_deng_1024", As shown in the figure below , These objects have smaller surface areas , So set the resolution to 512.

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Come here “2_ceng” All the objects in the group are organized , Then close it “2_ceng” marshalling , As shown in the figure below . The reason why groups are nested , To shorten Unity3d Tree management structure of middle level panel , Otherwise import Unity3d after , There are a lot of objects , The hierarchy panel is pulled up and down , I can't find the object in half , That's why it's managed according to the hierarchy of relationships .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Empathy , take 1 Layer and the -1 All objects in the layer are grouped into large groups “1_Ceng” and “-1_ceng”, And then, the objects in these two large groups and 2 Layer by layer .

   All the reorganization work is over , We can split up UV2 了 , The reason why my little sister separated grouping and splitting , It's for people to see the relationship clearly .

   Let's split the grouping of sunshades , Choose “zhe_guang_ban_256” marshalling , And then isolate ( Of course, there can be no segregation ), Set the target channel to 2, Because of the passage 2 It's the lightmap channel , Set the resolution to 256x256, The result of the split is shown in the second figure below , Because the objects in this group are just for blocking the light , It doesn't matter if the resolution is lower , I said before , These are the last views that are not seen in the camera , Poor quality doesn't matter .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Choose “lou_ti_jian_1024” marshalling , Set the resolution to 1024x1024, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, open the group “2_ceng”, Choose one of them “2_ceng_nei_qiang_2048” marshalling , Set the resolution to 2048x2048, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Select group “2_ceng” Medium “2_ceng_nei_qiang_2048” marshalling , Set the resolution to 2048x2048, There are many faces in this group of objects , Split UV2 It takes a long time , Time consuming 4 minute , Of course, some people's machines are too poor or the splitting method is improper , It's likely to split for dozens of minutes or hours , It can even take a few days , The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Next, select the group “2_ceng” Medium “2_ceng_chuang_lian_1024” marshalling , Set the resolution to 024x1024, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Then select the group “2_ceng” Medium “2_ceng_bi_hua_512” marshalling , Set the resolution to 512x512, The result of the split is shown in the following figure .

 Insert picture description here Insert picture description here


   Next, select the group “2_ceng” Medium “2_ceng_di_ban_1024” marshalling , Set the resolution to 1024x1024, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Then select the group “2_ceng” Medium “2_ceng_diao_ding_1024” marshalling , Set the resolution to 1024x1024, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Finally, select the group “2_ceng” Medium “2_ceng_ge_shan_deng_512” marshalling , Set the resolution to 512x512, The result of the split is shown in the following figure .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   So far the group “2_ceng” The object in the is split up , Then turn off the grouping “2_ceng”. And so on , Split the group in turn “1_ceng” and “-1_ceng” The objects in the secondary group .

   Split up from my little sister UV2 so , Every light UV Medium UV The blocks are evenly arranged , And make full use of all UV Space , and Unity3d Of UV2 Splitting often takes all UV The blocks are concentrated in UV A corner of space , As shown in the figure below , The small window in the lower right corner is 2048x2048 The range of lightmaps , and Unity3d Split up UV2 All in the red line in the lower left corner of the small window , Make a lot of UV Space is wasted , That leads to the actual illumination UV Very small , After baking, the illumination map is very empty 、 Very dirty , And there's light 、 Leukoplakia 、 Black spot 、 Hard edge 、 Tear apart 、 Defects such as broken surface . Let the light shine UV Full of UV Space is hard to grasp , So we strongly recommend that you give up Unity3d Of UV2 Split function , Use your own familiar modeling software to split UV2 Is the right choice .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   All the objects that have been split up , The preprocessing of the whole model phase is over , Then export the scene from the modeling software , Remember to export the avatar separately from the rest of the scene , Because it has been said that , To be in Unity Set the double object separately in “ Creating obstacles ”, You have to export it separately FBX. Create a folder before exporting , take FBX The files are saved in this folder , Then copy the folder of all maps referenced in the scene to this folder , Finally copy this folder to the artist ( In case the texture is lost , When importing Unity3d when , If you can't find the texture , Will be in FBX Search in the folder near the file ) Scene baking and post-processing . It should be noted that , The above preprocessing, little sister, is separated from each other , It's just a way of interpreting knowledge , Learn about these preprocessing , Some can be done easily during the modeling process , You don't have to wait until the model is built . As a modeler , Although not involved in art , But understand the work flow of follow-up artists , For building compliance VR And the actual project requirements of the game and zero rework scenarios are very important .


3. Unity3d Scene construction

   Export the modeling software FBX Scene and avatar file import Unity3d Of Assets panel , As shown in the figure below , Then load the materials and maps from the modeling software , In the end, there will be two FBX Drag the file into the hierarchy panel .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   You can see from the red line below , The grouping in the modeling software is passed on correctly , Expand each group , The resolution values of secondary groups and markers are also preserved , So for the convenience of Management , We should form the habit of reorganizing the model in the modeling software .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Select the double in the hierarchy panel (tishen) object , As shown in the figure below, disable the real-time rendering of avatar objects , Solve the overlapping flash surface between the avatar object and the scene object .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Next, choose Assets Of the avatar in the panel FBX file , Click the following figure to check “generate colliders”, Make a stand in object an obstacle , You can also leave it off for the time being , Wait until the roaming camera is set up and check .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




3. Unity3d Lighting layout


  Unity3d Lighting and other 3d Rendering is the same , It needs to be determined according to the time of the scene , Like dawn 、 Morning 、 noon 、 In the afternoon 、 In the evening 、 wedding night , This case is an indoor scene , The following is to discuss the layout of lighting in these hours .


⑴. The dawn

   The dawn is just when it's just dawning , The lights in the room have not been turned on , A faint sky light could be seen in the window , There are only vague outlines of indoor objects , Therefore, we only need ambient light or arrange surface light source in the window to light indoor , Of course, you can also use ambient light and surface light to simulate skylight at the same time .

   The sky box and weak light intensity can be set for the ambient light as shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Using the surface light source to simulate the skylight can be as shown in the following figure in all openings ( window 、 Doorway 、 Curtain wall ) Lay out the surface light source , Or use the modeling software to build geometric surfaces in all openings to replace the surface light source , And then in unity Set the luminescent material for these geometric surfaces , See baking section for details .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




⑵. Morning

   In the morning , The sun is warm , The light slanted into the room near the window , The edges and corners of indoor objects are clear , And there are obvious shadows , in addition , I haven't been to work at this time , The lights in the room haven't been turned on yet , So we can use parallel light as the main light source to simulate the sun , The ambient light and the surface light source of the window are used as auxiliary light to illuminate the dark places in the room , See the scene baking section for details .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing




⑶. noon

   At noon , Sunny , The light hits the room at a large angle , As shown in the figure below , At this time, the indoor light has been turned on , So we use parallel light as the main light source to simulate the sun , The light intensity is high , The ambient light and the surface light source of the window and the surface light source of the indoor grille lamp are used as auxiliary light to illuminate the dark places in the room , Because the effect of the area light source is only visible after baking , So see the baking section below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

⑷. In the afternoon

   In the afternoon , The sun is getting weaker , The projection angle is getting smaller , Still using the parallel light as the main light source , The light intensity is reduced , The ambient light and the surface light source of the window and the surface light source of the indoor grille lamp are used as auxiliary light to illuminate the dark places in the room , The lighting is shown in the figure below , See baking section below for effect .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

⑸. In the evening

   In the evening , The sun is about to set , The sun is weak , The projection angle is very small , The surface light source of indoor grille lamp is used as the main light source to illuminate the room , Parallel light simulates sunlight 、 The ambient light and the surface light source of the window are used as auxiliary light to cast weak light into the room , See baking section below

⑹. wedding night

   On the first night , The lights are just beginning to shine , The dim moonlight and lights outside the window throw into the window room , At this time, the office is working overtime , So use the area light source of the grid lamp as the main light source to illuminate the room , Moonlight simulated with directional light 、 The ambient light and the surface light source of the window simulate the outdoor light as auxiliary light to cast weak light into the room , See the scene baking section below .


3. Scene baking

   The next little sister according to the above and everybody discussed lighting method , In this case, the baking time is six hours , In order not to let the settings of each time division overlap each other , We can save each period as a scene , Before saving , We have to do some public settings first , That is, the common settings for each scene , So you don't have to repeat the settings for each scene , If necessary, just modify the parameters .

   First, let's set the ambient light , Ambient light is atmospheric particles 、 Architecture 、 tree 、 The diffuse reflection of natural objects such as stones after receiving sunlight . For a particular illuminated object , Besides receiving direct sunlight , It's also exposed to diffuse light from surrounding objects , But sometimes it's only exposed to ambient light , For example, objects on cloudy days are not directly exposed to sunlight .Unity In order to simulate the real light in nature , The introduction of ambient light , Ambient light is integrated into Unity3d In the light panel of , Shown below , The setting of ambient light includes the source of ambient light 、 The intensity of the ambient light and the mode of the ambient light .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Ambient light source refers to how to simulate ambient light , There are three ways ( As shown in the figure below ): Sky box 、 gradient 、 Fixed color , Gradients and fixed colors are rarely used , Generally, only sky box is used to simulate ambient light , So here's just about the sky box , The so-called sky box is a special way to construct the sky and environment .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   When you choose the sky box (skybox) When the way , Ambient light uses the sky box linked to the sky box material to generate ambient light , As shown in the figure below , In other words, sky box is actually a special material , This material has a sky box texture on it , So where did the sky box come from ? It's just a material , It's just normal Unity3d The material is different , Now let's define this material .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Custom sky box material , Just in assets Right click on the panel , In the pop-up menu, create a material as shown in the following figure , Then name the new material , Whatever you want , Such as “aaa” or “abc”, As long as it's easy to identify , It's called “skybox_mtl”, Then select this material , Follow the prompts shown in the figure below to select skybox Under the cubemap, This material is no longer a normal material , It's a sky box material .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   choice skybox Under the cubemap after , A link is also needed for this material Cubemap Texture can be a real sky box , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Find a suitable one to make Cubemap A panoramic image of , Import Unity3d, And then select this image , As shown in the figure below, expand the drop-down box of the texture shape of this image , Change the texture shape from the default 2D Change it to Cube, Then click the Apply button in the lower right corner “apply”,Unity This image will be converted to Cubemap 了 , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   Then choose the sky box material again , Then as shown in the figure below , Will just convert Cubemap Drag the texture onto the sky box material Cubemap In the texture , So a complete sky box links to ambient light , That is to say, the sky box can simulate the illumination of real environment .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   Let's see what the sky looks like now , After hiding the scene model, you can see , As shown in the figure below .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The next two pictures are screenshots of the sky box when the camera is rotated to the other two angles .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   This sky box is more than Unity3d The default blue sky sky sky box is vivid 、 More natural , The skybox's role is not just to produce ambient light 、 It is also used to construct outdoor and reflective environments , Children's shoes are bound to question , It's just how a picture can produce ambient light ? good , Little sister, let's show you whether sky box can really produce ambient light . In order to let you see clearly the lighting effect of sky box , We create a simple cube , Then rotate the sky box left and right , Look at the light changes on the surface of the cube , The picture below is 0 It's the light at degrees .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The picture below shows the sky box in 24 The illumination at degrees .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing

   The picture below shows the sky box in 66 The illumination at degrees .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   The picture below shows the sky box in 312 The illumination at degrees . Let's compare the four pictures , See if the sky box produces light , Miss, I just let you observe the light changes of objects by rotating the sky box , In fact, we can think about it in reverse , Is it possible to think that , Model faces at different angles of the scene , The light is different ? That's true , So the sky box is a lot 3d Software references to simulate ambient lighting .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   After recognizing the fact that the sky box can generate light , You can adjust the parameters in the figure below to change the sky box , Let's try to adjust ourselves .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   if necessary , You can create more sky box materials , Each material links a different sky box map , Of course, you can just create a sky box material , Link different sky box maps for it , To meet the different requirements of the scene environment lighting .

   The following image shows a car effect rendered with sky box as ambient light , As shown in the figure below , The details of the car body under the illumination of ambient light supplement the deficiency of the main light source , It's very important to show some small and complicated structures , in addition , Skybox also simulates the real environment , It provides a reflection source for the specular reflection of the car body , Make the reflection more realistic , Excellent texture , At the same time, skybox avoids unnecessary environment modeling . These are the three functions of the sky box mentioned by Miss Jie : Environment light 、 Reflection source 、 Create an environment . This sky box effect , yes Unity3d The default sky box can't be better than .Unity3d asset store In the sky box is also basically some sky , It's very stiff , Some children's shoes make sky boxes out of panorama , It's not a seam , It's going to squeeze and deform , Little sister will support 《Unity3d Lighting, scene baking and post-processing 》 Video tutorial children's shoes free to provide their own elaborate 8k High precision super beautiful sky box resources , Import to use . For this case , The sky box, on the one hand, acts as ambient light to simulate real ambient light , On the other hand, as an outdoor environment to set off the scene , Stand at the window and watch , It looks natural , And can blend into the scene . For the role of the sky box as a reflection source , Because this case is an indoor scene , So it doesn't make sense , We'll use a reflection detector to provide a source of reflection for indoor objects . If there is no such sky box , It's going to make you feel lonely , It's like being built in the wild , So it's very important to match the right sky box for different scenes .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   This kind of sky box can be made with ordinary panorama , But the little sister strongly suggests that you should use HDRI Format ( High dynamic range image ) A panorama of the sky box , Images in this format , Better lighting , It's also a popular lighting image format .

   Sky box in addition to the front image mode , also unity3d The default blue sky mode , Many children's shoes sometimes want to modify the default sky box , But there's always no place to change , This mode is called program mode , When you select skybox Under the procedural( Program mode ) when , We found that the sky box became the default .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   When the skybox material's atmospheric thickness is in slide program mode , You'll see that the sky box has changed , Anyway, I don't like this model of skybox , And it's not very useful , If you want to use this sky box , You can study it yourself .

Unity3d Office scene lighting layout and lighting baking and post-processing Unity3d Office scene lighting layout and lighting baking and post-processing


   In order to let you understand the ambient light and the sky box that produces the ambient light , Little sister used a lot of space , After a circle , Let's go back to the public setting of ambient light in this case , The specific settings are shown in the figure below .

 Insert picture description here Insert picture description here

 Insert picture description here Insert picture description here


   Next, let's set the illumination of each window's surface light source , The little sister said ,Unity3d It's not convenient to locate the object , It takes too much time to lay out the surface light source in each window , And too many area lights bake rendering is very time-consuming , So the little sister in front of me constructed a geometric plane for each window in the modeling software , And then in Unity In order to replace the illumination of the surface light source, the luminous material is set for these geometric surfaces , The baking of illumination of objects with luminous materials is much faster than that of surface light sources .

   Create a material , This material will be used for each window to replace the geometry of the face light source , Name it win_light, Check the self luminous material as shown in the figure below , And set the luminous intensity to 2.

 Insert picture description here Insert picture description here


   Choose 1、2 The geometric surface to be illuminated by a layer window , Link the created luminous material to the material component of the geometric surface to be illuminated as shown in the following figure , That's to say, you assign luminous materials to these geometric surfaces , And then these geometric surfaces become luminaries , When baking, it will produce light like a surface light source , It should be noted that , The illuminant is the same as the surface light source , The light produced is not effective in real time , Only visible light after baking .

 Insert picture description here Insert picture description here

   Create another material , Name it loutijian_light, This material will be used for the geometry of the stairwell to glow , Set the luminous intensity as shown in the figure below 0.5, Because the lighting geometric plane of the staircase is composed of multiple model faces , If you set the luminous intensity to 2, Baking is equivalent to having multiple luminous surfaces , The light in the stairwell will be brighter than the window , This is not in line with the actual situation , So we're going to lower the intensity of the light , The overall lighting effect will be equivalent to the window .

 Insert picture description here Insert picture description here


   Select the geometric surface of the curtain wall to be illuminated , Assign the light-emitting material you just created to the light-emitting surface of the curtain wall as shown in the following figure , In this way, these geometric surfaces will produce light when baking .

 Insert picture description here Insert picture description here


   The reason for creating luminous materials independently for windows and curtain walls , It's to set different luminous intensities for the two .

   Next, we set the luminous material for the geometric surface of the grid lamp on each floor , And named it geshandeng_light, Then set the luminous intensity to 1, As shown in the figure below .

 Insert picture description here Insert picture description here


   Next, select all the grid light geometry of the three layers , Assign the material you just created to these geometric faces , As shown in the figure below .

 Insert picture description here Insert picture description here


   Next, create a directional light to simulate sunlight or moonlight , because Unity By default, a directional light has been created , So we can use it directly .

   Because there are lamps on some desks in the office , These lamp objects don't glow , So you have to create some point lights for these lamps , Of course, you don't have to create a point light for every table lamp , Because the rendering and baking of point lights is very time-consuming , So it's OK to decorate properly .

   As shown in the figure below , Create a point light source , Adjust its position close to the bottom of the lamp cap , Remember not to be sealed in the lamp , Otherwise, you can't see the light effect of the point light source . A point light source has a few balls that adjust the attenuation range , There are some handles on it , Drag to adjust the attenuation range of a point light source , The light range of desk lamp is limited , This attenuation range controls the range of illumination , That is to say, the point light source gradually decays from the center along the radius outward to 0, Beyond the attenuation range , It doesn't light up objects , If you turn on shadows , There is no shadow outside the attenuation range .

 Insert picture description here Insert picture description here


   In the same way , Create a point light for a lamp object that needs to be illuminated , As shown in the figure below .

 Insert picture description here Insert picture description here

   Finally, create a reflection detector for each room , It is used to collect the reflection environment of each room when baking light and shadow , If you have children's shoes, you will think , Why not just create a reflection detector for each layer , And to create a reflection detector for each room , We can think of it this way , If you create a reflection detector for each layer , Then the reflection objects in a small room will be mapped to objects in a room far away from the room , This is not in line with the actual reflection , Therefore, the reflection detector should be limited to each room .

   If you don't create a good reflection detector in the public settings section , After copying six scenes , It's going to be a lot of work to create a reflection detector .

   Next, we'll create a reflection detector as shown in the figure below (Reflection Probe).

 Insert picture description here Insert picture description here


   The default space form of the reflection detector is a cube wireframe ( As shown in the figure below ), The center of the cube has a detector Center ( As shown in the second picture below ).

 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


   The reflection detector is in Unity We all know how to adjust the position in the scene , Not here , Its size can be adjusted as shown in the figure below .

 Insert picture description here Insert picture description here


   The center position of the reflection detector can be adjusted as shown in the figure below . Mobile reflection detection center and mobile reflection detector are not the same thing , The center of each reflection detector should be placed at the center of the body of the reflection detector as much as possible , When adjusting the size of the reflection detector , The center will shift , So it needs to be adjusted .

 Insert picture description here Insert picture description here


   With the foreshadowing of the above knowledge , We can create reflection detectors for each room . First of all, let's make a room first , As shown in the figure below , Move the previously created reflection detector to the approximate location of a room on the second floor , Then use the reflection detector's edit tool to set the reflection detector's 6 The faces are adjusted to completely envelop all the objects in this room .

 Insert picture description here Insert picture description here


   Then adjust the detection center to the center of the reflection detector body , As shown in the figure below , So the reflection detector of this house is done .

 Insert picture description here Insert picture description here


   And so on , Use the above method to create a reflection tester for all rooms , As shown in the figure below . It should be noted that , If there is no reflective material in a room , You don't have to create a reflection detector .

 Insert picture description here Insert picture description here


   Next, we show the value with resolution grouped in the modeling software as shown in the figure below, and split it in the modeling software according to this value UV2 Set parameters for the object group of , As shown in the figure below , The naming of object groups in the hierarchical panel is exactly the same as in modeling software , The reason is that when you type a group in the modeling software, you need to split UV2 The resolution is marked after the name of the object group , This is to prompt you when setting up here , Otherwise, I will forget the resolution value when splitting in the modeling software .

 Insert picture description here Insert picture description here


   Follow the steps above to make the same , Set the parameters one by one for all the objects marked with resolution value in the hierarchy panel , So when baking , All groups of objects will be split according to the high quality of the modeling software UV2 Baked with high quality . If the machine configuration is too low, Or the scene is too large , Just bake in batches , Select which object groups , You're going to bake only groups of objects . Of course , If you want to quickly test the lighting effect of the scene , Just bake in batches , That is, select only one or several objects that need to be tested for light and shadow effects to bake , Otherwise, it will take a long time for all the objects to be baked to see the general effect .

   thus , All the public settings are done , Now let's change the scene name of the case to bgcj_lm(lm For dawn ), As shown in the figure below .

 Insert picture description here Insert picture description here


   After the scene at dawn is baked , We will again bgcj_lm Save as bgcj_zc( Morning ), As shown in the figure below , In this way, we can do it in chronological order , Let the scene setting of the next time division be modified on the basis of the previous time division , Avoid some repetitive settings .

 Insert picture description here Insert picture description here


   And so on , The baking is finished in one hour , Save the scene as bgcj_zw( noon )、bgcj_wh( In the afternoon )、bgcj_bw( In the evening )、bgcj_cy( wedding night ), So we can go one by one , Finally, we get the corresponding 6 It's about a minute 6 A scenario , As shown in the figure below , On the one hand, the purpose of this is to make the scene of the later time division be modified on the basis of the previous time division scene , On the other hand, it can make the settings of each time division independent of each other , Avoid covering each other , The scene file after baking is shown in the following figure .

 Insert picture description here Insert picture description here


⑴. Light and shadow baking at dawn

   Open the front and save as bgcj_lm Scene , Because there is no sunshine at dawn , So you can turn off the directional light , As shown in the figure below .

 Insert picture description here Insert picture description here


   It's impossible to turn on the desk lamp at dawn , So turn off all the point lights , As shown in the figure below .

 Insert picture description here Insert picture description here


   It's impossible to turn on all the grille lights at dawn , So turn off all the light from the light emitting surface of the grille lamp , As shown in the figure below .

 Insert picture description here Insert picture description here

   In the front of the lighting layout, the little sister mentioned , Light can be generated at dawn with ambient light or light-emitting surfaces constructed in windows , So let's use ambient light to illuminate the scene , Temporarily turn off the light side of the window , As shown in the figure below .

 Insert picture description here Insert picture description here


   The ambient light discussed by my little sister in front of us usually uses the sky box to generate light , For dawn , The light intensity of the sky is lower , So we should reduce the intensity of ambient light to 0.5, As shown in the figure below . When we drag the slider of ambient light intensity , The brightness of the ambient light in the scene will change .

 Insert picture description here Insert picture description here


   Ambient light, in addition to light intensity , And then there's the light color factor , The color of the ambient light is determined by the sky box , So choose the sky box material , Turn the sky box tone to dark blue ( As shown in the figure below ). When the dawn was just dawning , The color of sky light is dark blue , In the light of the sky , The outdoor environment is also dark blue .( Some children's shoes may ask why the sky always has something to do with blue , For example, at dawn, the sky is dark blue , On a clear day, the sky is light blue , Why are the mountains in the distance pale blue 、 The sea water is also blue , This is because in Physics , Blue light has the longest wavelength , The farthest , So the farthest thing , Only blue light can be perceived by the naked eye , So it's going to be blue ).

 Insert picture description here Insert picture description here


   After adjusting the tone of the sky box , We found that the sky box was still too bright , You can reduce the exposure of skybox , It's actually the brightness of the sky box , Reduce the exposure to 0.4, As shown in the figure below , The color of the sky box is basically in line with dawn , But we found that , Although the exposure is reduced , But the sky box has an obvious sun on the texture , Too bright , If you look out of the window , It's not in the mood of dawn , So the sky box has to be replaced with a texture that doesn't have a lot of light .

 Insert picture description here Insert picture description here


   Change the sky box to the map shown below , It eliminates the sun that is too bright in the sky box above , And it looks more in line with the outdoor environment of dawn and the atmosphere of the sky , So we use this sky box to light up the dawn scene . Here we need to explain the relationship between the exposure of sky box and the intensity of ambient light , The exposure controls the brightness of the sky box , You can adjust the slider to see the changes in the sky box , Exposure also controls the intensity of ambient light , When you slide the exposure slider, you can't see the change of ambient light in the scene , But it does affect the ambient light , It's only after baking that you can see the effect , You can try it on your own , Since both the exposure and the intensity of the ambient light affect the illumination of the ambient light , So what is the relationship between the two ? The ambient light comes from the sky box , Exposure can be understood as the total valve of sky box illumination , Ambient light intensity can be understood as the terminal valve of ambient light , That is to say, no matter how strong the light is , The exposure is low , The actual light will be very low , In turn, , No matter how much exposure , The light intensity is very low , The actual light is also very low , It's like the relationship between the valve in front of the water meter and the faucet at home , in other words , Given the exposure of skybox , The lower the ambient light intensity , The weaker the ambient light , conversely , Turn up the ambient light intensity , The stronger the ambient light . And for a given ambient light intensity , Turn down the exposure of skybox , The weaker the ambient light , conversely , If you increase the exposure of skybox , The stronger the ambient light . The exposure of ambient light is generally adjusted according to the weather or time period , Like at dawn , The exposure of skybox has to be very low , At noon, the exposure of sky box should be increased or kept at the default value , I hope you can understand .

 Insert picture description here Insert picture description here


   When the ambient light is set , Next, follow the diagram below ( The red line says ) Set lower baking parameters , Let's test the light and shadow of the scene at dawn . The purpose of using lower parameters is to bake the results in the shortest time , Take a quick look at the lighting conditions of the lights .

 Insert picture description here Insert picture description here

 Insert picture description here Insert picture description here


   Next, just select the hierarchy panel 2 All object groups of layers 、 Stairwell group 、 Sunshade group ( That is, the group with the suffix baking resolution value ), Then click on the bottom right corner of the lighting panel “Generate” Button ,Unity Start baking only selected objects , As shown in the figure below .

 Insert picture description here Insert picture description here


   Bake the selected object with the parameters set above , Time consuming 7 minute 33 second , The light is OK , It's just that the quality is too poor , As shown in the figure below .

 Insert picture description here Insert picture description here


   Now let's follow the figure below , Improve parameter settings , Bake again .

 Insert picture description here Insert picture description here


   Bake again according to the above parameters , Time consuming 11 branch 17 second , The baking results are shown in the following figures . The figure is visible , Only in ambient light (hdri Sky box ) Under the irradiation of , There's a beautiful light effect near the windows of the room , Although the light is dim , The objects in the room are fuzzy , But the hierarchy is clear , This is in line with dawn ( It's dark ) It's lighting up all the time .

 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


   Above we are the scene with ambient light alone , The little sister said , It can also be illuminated by the luminous geometry of the window ( Of course, you can also use unity To irradiate , But each window layout area light source workload is too much , And it's time-consuming to bake with too many surface light sources , So the little sister constructed a geometric surface for each window in the modeling software , To replace the surface light source , And then we set the luminescent material for these joints , The baking speed of luminous materials is much faster than that of surface light sources ), Let's turn off the ambient light , To irradiate alone with a luminous geometric surface .

   So how to turn off the ambient light ? Just set the ambient light intensity to 0, The ambient light doesn't work .

   Next we will 2 All the luminous geometric planes constructed in advance by the layer window are selected , As shown in the figure below , Check the... In the material Emission( Luminescence ), And set up HDR The luminous intensity is 0.5, Because we've almost turned off the ambient light , At this time, the scene is only illuminated by the geometric surface that can be illuminated , Click on “Generate” Bake again .

 Insert picture description here Insert picture description here


   Bake according to the above settings , Time consuming 12 branch 25 second ( As shown in the figure below ), As shown in the figure below , Irradiating with a luminescent geometric surface alone , The same can be achieved with the baking results of ambient light alone , And the results of baking can be irradiated by the luminous geometric surface alone , More layers .

 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


   The little sister said , The light at dawn can also be simulated by the interaction of ambient light and luminescent geometry , Now let's turn on both ambient light and luminescent geometry to illuminate the scene ( The specific parameters are described above ), And then bake again , The results are shown in the following figure .

 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


   As can be seen from the picture above , The results show that the baking results under the combined illumination of ambient light and luminescent geometric plane are better than that of the two alone , Although there is not enough light for indoor objects , But it's still visible , So if you show the light at dawn , It is recommended to use the ambient light and the surface light source of the window to irradiate the scene together , Ambient light can be understood as the main light source , The luminous geometry can be used as supplementary light to make up for the lack of ambient light .

   The reason why little sister uses ambient light and luminescent geometry alone , It's for you to experience the lighting effect of these two different lights , I hope you understand .

   thus , The light at dawn is baked , According to the previous plan , To bake the morning light , We just need to save the scene at dawn as bgcj_zc, This is the scene bgcj_zc It inherited the scene bcgj_lm All Settings , When modifying the scene bgcj_zc when , It doesn't cover the scene bcgj_lm Lighting and other related settings have been completed , Don't talk much , Directly put the scene bcgj_lm Save as bgcj_zc, Let's set up and bake the morning scene .


⑵. Light and shadow baking in the morning

   Here's the scene bcgj_lm Save as bgcj_zc, The scene is activated automatically in the morning ( Or the scene of the current edit ). We have already discussed , The sun is warm in the morning , The light slanted into the room near the window , The edges and corners of the objects near the window are clear , And there are obvious shadows , in addition , I haven't been to work at this time , The lights in the room haven't been turned on yet , So you can use a directional light as the main light source to simulate sunlight , The ambient light and the luminous geometric plane of the window are used as auxiliary light ( Or fill light ) To light up the dark places in the room , So turn on the front fold closed Unity Directional light created by default ( As shown in the figure below ).

 Insert picture description here Insert picture description here


   Bake with the above light , The results are shown in the following figure .

 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


 Insert picture description here Insert picture description here


   The picture below shows the baking effect of the room without sunlight on the back .

 Insert picture description here Insert picture description here


Because there is a word limit here , More can be found in CSDN read , If you have any questions V Inquiry (qtpl_wx) Cute girl , If you think what Miss Jie said is reasonable , Please give it to my little sister Live video tutorial Some support !


版权声明
本文为[osc_ th8jvcw7]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/202012081333115010.html