Method, device, storage medium and electronic device for generating vegetation model
By obtaining the center and surface positions of the vegetation model in the target engine, generating the target model and adjusting the vertex normal, the problem of low generation efficiency of vegetation model is solved, and efficient and accurate normal adjustment is achieved.
Patent Information
- Application Number
- CN202111212034.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-10-18
AI Technical Summary
In the prior art, the vegetation model generation efficiency is low, and the vertex normal is not perpendicular to the polygon plane, resulting in the loss of normal information and it needs to be modified iteratively in the DCC software, resulting in high time cost and inaccurate normal information under low number of areas.
Get the center and surface positions of the vegetation model in the target engine, determine the target vector, generate the target model, and adjust the vertex normal of the original vegetation model based on the vertex normal of the target model to avoid direct modification in the DCC software.
It improves the efficiency of vegetation model generation, ensures that normal information is accurately applied to pixels rather than vertices, avoids iterative modifications, and improves generation efficiency and accuracy.
Smart Images

Figure CN113947663B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, device, storage medium and electronic device for generating a vegetation model. Background Art
[0002] Currently, when implementing vegetation normal wrapping, the vertex normals of the vegetation model are usually rewritten by the vertex normals of the target model in Digital Content Creation (DCC) software.
[0003] However, the above method causes the vertex normals of the vegetation model to be not perpendicular to the surface, that is, the vertex normals of the baked vegetation model are forced to rotate to a state closest to the target model. At this time, the vertex normals of the vegetation model will not be perpendicular to the planes of the polygons adjacent to the vertices, which is equivalent to losing the correct normal information of the vegetation model; in addition, the producer can only modify and bake the vegetation model again in the DCC software, which causes a large iteration time cost; further, if the normal information is stored on the vertex, if the number of faces of the vegetation model is very low, the normal information will be very inaccurate and the effect will be unsatisfactory, which leads to the technical problem of low efficiency in vegetation model generation.
[0004] Currently, no effective solution has been proposed to the above-mentioned technical problem of low efficiency in vegetation model generation. Summary of the Invention
[0005] At least some embodiments of the present invention provide a method, device, storage medium, and electronic device for generating a vegetation model, so as to at least solve the technical problem of low efficiency in generating a vegetation model.
[0006] According to one embodiment of the present invention, a method for generating a vegetation model is provided. The method is applied to a target engine and includes: obtaining a first position and multiple second positions of an original vegetation model, wherein the first position is the position of the center of the original vegetation model and the second position is a position on the surface of the original vegetation model; determining a target vector based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model; generating a target model based on the multiple target vectors; and adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain a target vegetation model.
[0007] Optionally, generating a target model based on multiple target vectors includes: normalizing the multiple target vectors to obtain a first target model, wherein the first target model is a spherical normal model; and determining a target model based on the first target model.
[0008] Optionally, determining the target model based on the first target model includes: determining the first target model as the target model; or stretching the first target model to obtain a second target model, wherein the second target model is an ellipsoidal normal model; and determining the target model based on the second target model.
[0009] Optionally, determining the target model based on the second target model includes: determining the second target model as the target model; or superimposing the second target model, the parallel light normal and / or noise information to obtain the target model, wherein the parallel light normal is used to represent the vector of the parallel light in the scene where the original vegetation model is located, and the noise information is used to represent the noise of the original vegetation model.
[0010] Optionally, the method further includes: acquiring noise information based on multiple second positions.
[0011] Optionally, obtaining noise information based on the multiple second positions includes: performing a stretching operation on the multiple second positions, and obtaining noise information based on the multiple stretched second positions.
[0012] Optionally, obtaining noise information based on multiple second positions includes: rotating the multiple second positions to obtain multiple third positions; stretching the multiple third positions, and obtaining noise information based on the multiple stretched third positions and noise intensity.
[0013] Optionally, the method also includes: obtaining a position offset parameter; offsetting the first position based on the position offset parameter; determining a target vector based on the first position and each second position to obtain multiple target vectors, including: determining a target vector based on the offset first position and each second position to obtain multiple target vectors.
[0014] Optionally, the vertex normals of the original vegetation model are adjusted based on the vertex normals of the target model to obtain the target vegetation model, including: outputting the target model to the target interface of the original vegetation model, and adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0015] Optionally, the method also includes: obtaining at least one of the following target information of the original vegetation model: top and back light information, vertex color and hidden information, wherein the top and back light information includes the light information of the top contour and the light information of the back contour of the original vegetation model, the vertex color is used to distinguish the branches and leaves of the original vegetation model, and the hidden information is used to eliminate the sharp edges of the original vegetation model; adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model, including: adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model, and generating the target vegetation model based on the adjusted vertex normals and the target information.
[0016] According to one embodiment of the present invention, a device for generating a vegetation model is also provided. The device is applied to a target engine and includes: an acquisition unit for acquiring a first position and multiple second positions of an original vegetation model, wherein the first position is the position of the center of the original vegetation model and the second position is the position on the surface of the original vegetation model; a determination unit for determining a target vector based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to the position on the surface of the original vegetation model; a generation unit for generating a target model based on the multiple target vectors; and an adjustment unit for adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0017] According to one embodiment of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, wherein when the computer program is executed by a processor, the device containing the storage medium is controlled to execute the vegetation model generation method of the embodiment of the present invention.
[0018] According to one embodiment of the present invention, an electronic device is also provided, including a memory and a processor, characterized in that a computer program is stored in the memory, and the processor is configured to run the computer program to execute the vegetation model generation method of an embodiment of the present invention.
[0019] In at least some embodiments of the present invention, a first position and multiple second positions of the original vegetation model are obtained, wherein the first position is the position of the center of the original vegetation model and the second position is the position on the surface of the original vegetation model; a target vector is determined based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to the position on the surface of the original vegetation model; a target model is generated based on the multiple target vectors; and the vertex normals of the original vegetation model are adjusted based on the vertex normals of the target model to obtain a target vegetation model. In other words, the present application does not use DCC software, but instead uses the absolute world position of the pixels of the vegetation model and the object position to determine the target model in the target engine, and then uses the target model to rewrite the vertex normals of the original vegetation model to obtain the target vegetation model. In this way, the vegetation model can have a normal wrapping effect without going through the DCC software, without losing the vertex normal information of the vegetation model, and the normal effect acts on the pixels rather than the vertices, making the normal effect more accurate, thereby solving the technical problem of low efficiency in vegetation model generation, and thus achieving the technical effect of improving the efficiency of vegetation model generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0021] Figure 1 is a hardware structure block diagram of a mobile terminal according to a method for generating a vegetation model according to one embodiment of the present invention;
[0022] Figure 2 is a flow chart of a method for generating a vegetation model according to one embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram of the visual effect of a patch with gradually reduced facets according to a related art;
[0024] Figure 4A A schematic diagram of a vegetation model that cannot be wrapped linearly according to the related art;
[0025] Figure 4B This is a schematic diagram of a normal wrapping method based on a single face in the related art;
[0026] Figure 4C It is a schematic diagram of normal wrapping based on pixels to the origin in the related art;
[0027] Figure 5A It is a schematic diagram of a hemisphere according to the related art;
[0028] Figure 5B is a schematic diagram of a sphere (ellipsoid) according to the related art;
[0029] Figure 6A It is a schematic diagram of a normal wrapping method based on a face group in the related art;
[0030] Figure 6B It is a schematic diagram of a normal wrapping based on a custom polygon according to the related art;
[0031] Figure 7A This is a schematic diagram of a cartoon-style vegetation model in a game scene according to the related art;
[0032] Figure 7B This is a schematic diagram of a realistic vegetation model in a game scene according to the related art;
[0033] Figure 8 It is a schematic diagram of transferring the attributes of the vertex normal of the target model according to one of the related technologies;
[0034] Figure 9AIt is a schematic diagram of baking a normal into a specific model according to a related technology;
[0035] Figure 9B It is a schematic diagram of baking another normal into a specific model according to related technology;
[0036] Figure 9C It is a schematic diagram of baking another normal into a specific model according to related technology;
[0037] Figure 10 This is a schematic diagram of baking the normals of a target model into a vegetation model in 3ds Max software according to a related art;
[0038] Figure 11 is a schematic diagram of changing the tangent space to the world space according to one embodiment of the present invention;
[0039] Figure 12 is a schematic diagram of an ellipsoidal normal model according to one embodiment of the present invention;
[0040] Figure 13 is a schematic diagram of a normalization process according to one embodiment of the present invention;
[0041] Figure 14 is a schematic diagram of rewriting vertex normals of a vegetation model according to one embodiment of the present invention;
[0042] Figure 15 is a schematic diagram of an ellipsoidal normal model according to one embodiment of the present invention;
[0043] Figure 16 is a schematic diagram of noise information generation according to one embodiment of the present invention;
[0044] Figure 17 is a schematic diagram of another noise information generation according to an embodiment of the present invention;
[0045] Figure 18 is a schematic diagram of adjusting relevant parameters in an instance material according to one embodiment of the present invention;
[0046] Figure 19 is a schematic diagram of generating top and back contour light information according to one embodiment of the present invention;
[0047] Figure 20 is a schematic diagram of data processing for vegetation normal wrapping according to one embodiment of the present invention;
[0048] Figure 21 is a comparative schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention;
[0049] Figure 22 is a schematic diagram of an expansion effect based on material normal wrapping according to one embodiment of the present invention;
[0050] Figure 23 is a schematic diagram of a top lighting effect of a vegetation model according to one embodiment of the present invention;
[0051] Figure 24 is a schematic diagram of a backlight effect of a vegetation model according to one embodiment of the present invention;
[0052] Figure 25 is a schematic diagram of a rendering effect of a vegetation model without projection according to one embodiment of the present invention;
[0053] Figure 26 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the center of gravity of light and shadow gradually shifts downward;
[0054] Figure 27 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the noise level changes from strong to weak;
[0055] Figure 28 is a schematic diagram of rendering effects of a vegetation model according to one embodiment of the present invention when the noise level increases from small to large;
[0056] Figure 29 is a schematic diagram of an effect of eliminating sharp edges based on model normals according to one embodiment of the present invention;
[0057] Figure 30 is a schematic diagram of rendering effects of vegetation models using different ellipsoidal models according to an embodiment of the present invention;
[0058] Figure 31 is a schematic diagram of a rendering effect of a vertically elongated ellipsoidal vegetation model according to one embodiment of the present invention;
[0059] Figure 32 is a schematic diagram of a sharp edge elimination method according to one embodiment of the present invention;
[0060] Figure 33 It is a structural block diagram of a vegetation model generation device according to one embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0062] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0063] According to one embodiment of the present invention, an embodiment of a method for generating a vegetation model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0064] The method embodiment can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smartphone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, a game console, or other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal according to a method for generating a vegetation model according to one embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1Only one is shown in the figure) processor 102 (the processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field-programmable logic device (FPGA), a neural network processor (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may further include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0065] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for generating a vegetation model in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, realizes the above-mentioned method for generating a vegetation model. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0066] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the mobile terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0067] Inputs to the input / output devices 108 can come from a variety of human interface devices (HIDs). Examples include keyboards and mice, game controllers, and other specialized game controllers (e.g., steering wheels, fishing rods, dance mats, remote controls, etc.). Some HIDs provide not only input but also output, such as force feedback and vibration on game controllers and audio output on controllers.
[0068] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display"). The LCD may enable a user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal may have a graphical user interface (GUI), and the user may interact with the GUI by finger contacts and / or gestures on the touch-sensitive surface. The human-computer interaction functions herein may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.
[0069] An embodiment of the present invention provides a method for generating a vegetation model, which can be applied to a target engine.
[0070] Figure 2 FIG. 1 is a flow chart of a method for generating a vegetation model according to one embodiment of the present invention. Figure 2 As shown, the method may include the following steps:
[0071] Step S202 : obtaining a first position and a plurality of second positions of the original vegetation model, wherein the first position is the position of the center of the original vegetation model, and the second position is the position on the surface of the original vegetation model.
[0072] In the technical solution provided in the above step S202 of the present invention, the original vegetation model may be a vegetation model before the vertex normal is adjusted. The vegetation model may also be called a plant model, such as a tree model in a game scene, and no specific limitation is made here.
[0073] In this embodiment, the first position of the vegetation model can be obtained in the target engine. The first position can be the position of the center of the original vegetation model and can be determined by the object position (Objects position) of the original vegetation model, wherein the object position can be three-dimensional information and can be regarded as a vector. In this embodiment, the original vegetation model can be an entire batch of vegetation in the game scene. The vegetation system or instance system of the target engine can treat the entire batch of vegetation as an object. Therefore, the object position of the entire batch of vegetation can be only one, which can be represented by object coordinates (vectors), which can be the position of the center of the entire batch of vegetation, and then determined as the first position of the entire batch of vegetation.
[0074] Optionally, this embodiment may obtain the first position of the vegetation model in the material blueprint editor of the target engine, for example, using the "Object Position" node in the material blueprint editor to obtain the first position of the vegetation model.
[0075] In this embodiment, multiple second positions of the vegetation model are obtained. For each second position, the second position is the position on the surface of the original vegetation model, which can be a pixel absolute world position (Absolutely worldposition), which can also be called pixel world position coordinates, the absolute position on the object pixel (pixel position).
[0076] Optionally, this embodiment may change the normal space of the material of the original vegetation model from the tangent space to the world space, and then obtain the above-mentioned first position and multiple second positions of the original vegetation model in the world space.
[0077] Step S204 : determining a target vector based on the first position and each second position to obtain a plurality of target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model.
[0078] In the technical solution provided in step S204 of the present invention, after obtaining the first position and multiple second positions of the original vegetation model, a target vector can be determined based on the first position and each second position. The target vector can be obtained by subtracting the first position from each second position. That is, one second position can correspond to one target vector, and multiple second positions can correspond to multiple target vectors. The target vector of this embodiment is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model. For example, it is a vector emitted from the center of the object to a pixel of the original vegetation model, thereby achieving the purpose of emitting multiple target vectors from the center of an object to the surface.
[0079] Step S206: Generate a target model based on the multiple target vectors.
[0080] In the technical solution provided in the above step S206 of the present invention, after determining a target vector based on the first position and each second position and obtaining multiple target vectors, a target model can be generated based on the multiple target vectors, and the multiple target vectors can be used as normals of the target model, so that the target model can be called a normal model, which can be a smooth normal model.
[0081] Step S208 : adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0082] In the technical solution provided in the above step S208 of the present invention, after the target model is generated based on the multiple target vectors, the vertex normals of the original vegetation model can be adjusted based on the vertex normals of the target model to obtain the target vegetation model.
[0083] In this embodiment, the target model can be used to implement the normal wrapping technology for the original vegetation model. The vertex normals of the original vegetation model can be adjusted based on the vertex normals of the target model. The properties of the vertex normals of the target model can be transferred to the vertex normals corresponding to the original vegetation model. For example, the vertex normals of the target model are baked to the vertex normals corresponding to the original vegetation model to achieve the purpose of rewriting the normal effect of the vegetation model. Optionally, in the target engine of this embodiment, the material is ultimately presented as pixel normals. Therefore, this embodiment is ultimately rendered in pixels in the preferred scene, so the vertex normals of the original vegetation model can also be called pixel normals. This method avoids storing the vertex normal information on the vertex. When the number of faces of the vegetation model is very low, the vertex normal information is very inaccurate. It also avoids having to rewrite the vertex normals of the vegetation model in the DCC software, which easily causes the vertex normals of the vegetation model to be not perpendicular to the planes of the polygons adjacent to the vertices, thereby losing the correct normal information of the vegetation model.
[0084] It should be noted that the above method of this embodiment can be executed in a target engine, which may be Unreal Engine (UE), for example, UE4. The inclusion body can be flexibly adjusted and expanded in the target engine, thereby avoiding the situation where the producer cannot modify the vertex normal inclusion of the vegetation model in the target engine and can only return to the DCC software to modify and bake it again, which makes the flexibility of vegetation model generation low.
[0085] The above method of this embodiment achieves the purpose of adjusting the vertex normals of the original vegetation model to obtain the target vegetation model. In order to achieve the display effect of the vegetation image corresponding to the target vegetation model on the graphical user interface, this embodiment can also further render the target vegetation model so that the vegetation image corresponding to the target vegetation model conforms to the performance effect of the three-dimensional scene.
[0086] Optionally, this embodiment uses a rendering program to render the target vegetation model, wherein the rendering program can obtain the range of the target vegetation model that needs to be rendered through the camera, and calculate the impact of each light source added to the scene on the target vegetation model. Unlike light sources in the real world, the above-mentioned rendering program also needs to calculate a large number of auxiliary light sources. In this embodiment, it is also possible to determine whether to use depth map shadows or ray tracing shadows for the target vegetation model based on the shadows cast by the light sources. In addition, after using area light sources, if the light sources in the scene use light source special effects, the rendering program will also calculate the results of the special effects, especially volumetric light (light fog), thereby realizing the rendering of the target vegetation model.
[0087] In this embodiment, after the target vegetation model is rendered by the rendering program, the following image can be obtained: Figure 21 The vegetation image shown can be rendered from left to right as the initial unwrapped vegetation image, the spherical wrapped vegetation image, the vegetation image with polarized shadow noise on the bright part, and the vegetation image with sharp edge removal. Figure 21 1 is a comparative schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention.
[0088] Optionally, in this embodiment, the rendering program can also calculate the color of the target vegetation model surface according to the material of the target vegetation model, wherein different types, properties and textures of the materials will produce different effects. Moreover, this result does not exist independently, but can be combined with the above-mentioned light source. Figure 22 As shown, the material normal wrapping is used, and from left to right, the display effects are messy light and shadow with sharp edges, too smooth light and shadow, some surface feeling, and accurate normal. Figure 22 4 is a schematic diagram of an expansion effect based on material normal wrapping according to one embodiment of the present invention.
[0089] Optionally, when the above rendering program is used to render the target vegetation model, toplight rendering and backlight rendering may also be considered, such as Figure 23 and Figure 24As shown in the figure, the effects of the target vegetation model under top light rendering and back light rendering are shown respectively. The effects of the target vegetation model under top light rendering and back light rendering in different positions are also different. Figure 23 is a schematic diagram of a top light effect of a vegetation model according to one embodiment of the present invention. Figure 24 FIG. 4 is a schematic diagram of a backlight effect of a vegetation model according to one embodiment of the present invention.
[0090] Optionally, in this embodiment, if the target vegetation model is in a long distance range or the projection accuracy is relatively low, the target vegetation model may also have no projection after rendering, such as Figure 25 25 is a schematic diagram of the rendering effect of a vegetation model without projection according to one embodiment of the present invention.
[0091] Optionally, in this embodiment, when rendering the target vegetation model, the center of gravity of the light source may gradually shift downward. At this time, the target vegetation model is rendered according to the light source whose center of gravity gradually shifts downward. Figure 26 As shown. Among them, Figure 26 FIG. 1 is a schematic diagram illustrating the rendering effect of a vegetation model according to one embodiment of the present invention when the center of gravity of light and shadow gradually shifts downward.
[0092] Optionally, in this embodiment, the intensity of the sampled noise is related to the effects of light and shadow development and wind synchronization. This embodiment renders the target vegetation model based on the noise from strong to weak, such as Figure 27 As shown. Among them, Figure 27 FIG. 1 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the noise level changes from strong to weak. Figure 27 As shown, the vegetation model shows the effect of noise from strong to weak.
[0093] Optionally, this embodiment can also render the target vegetation model based on the noise from small to large, such as Figure 28 As shown. Among them, Figure 28 1 is a schematic diagram of rendering effects of a vegetation model according to one embodiment of the present invention when the noise level increases from small to large.
[0094] Optionally, the rendering of the target vegetation model in this embodiment is also related to the elimination of sharp edges of the normal line of the target vegetation model. Different target vegetation models have different degrees of elimination of sharp edges of the normal line, and the rendering effect of the target vegetation model will also be different. Figure 29 As shown. Among them, Figure 29 FIG. 4 is a schematic diagram of an effect of eliminating sharp edges based on model normals according to one embodiment of the present invention.
[0095] Optionally, the embodiment renders the target vegetation model, which is also related to the ellipsoid model. By using different ellipsoid models to rewrite the vertex normals of the original vegetation model, the target vegetation model obtained is different and the rendering effect is also different, such as Figure 30 As shown. Among them, Figure 30 4 is a schematic diagram of rendering effects of vegetation models using different ellipsoidal models according to an embodiment of the present invention.
[0096] Optionally, in this embodiment, when the target vegetation model is an elongated vegetation model, an ellipsoidal model elongated in the numerical direction may be used, and the rendering effect may be as follows: Figure 31 As shown in the figure, it reflects the slender characteristics of the vegetation model. Figure 31 The figure is a schematic diagram of the rendering effect of a vertically elongated ellipsoid vegetation model according to one embodiment of the present invention.
[0097] Through the above steps S202 to S208 of the present application, a first position and multiple second positions of the original vegetation model are obtained, wherein the first position is the position of the center of the original vegetation model and the second position is the position on the surface of the original vegetation model; a target vector is determined based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to the position on the surface of the original vegetation model; a target model is generated based on the multiple target vectors; the vertex normals of the original vegetation model are adjusted based on the vertex normals of the target model to obtain the target vegetation model. In other words, the present application does not use DCC software, but determines the target model in the target engine using the absolute world position of the pixels of the vegetation model and the object position, and then uses the target model to rewrite the vertex normals of the original vegetation model to obtain the target vegetation model, so that the vegetation model can have a normal wrapping effect without going through the DCC software, without losing the vertex normal information of the vegetation model, and the normal effect acts on the pixels rather than the vertices, making the normal effect more accurate, thereby solving the technical problem of low efficiency in vegetation model generation, and thus achieving the technical effect of improving the efficiency of vegetation model generation.
[0098] The above method of this embodiment is further described below.
[0099] As an optional implementation, step S206, generating a target model based on multiple target vectors, includes: normalizing the multiple target vectors to obtain a first target model, wherein the first target model is a spherical normal model; and determining a target model based on the first target model.
[0100] In this embodiment, after determining a target vector based on the first position and each second position to obtain multiple target vectors, the multiple target vectors can be normalized to obtain a first target model. Optionally, some of the multiple target vectors in this embodiment are too long, and some are too short. This embodiment normalizes the multiple target vectors. For example, a "Normalize" node can be added after a target vector to normalize the target vectors so that the lengths of the multiple target vectors after processing are the same, for example, the lengths of the multiple target vectors after processing are all 1. Thus, the first target model of this embodiment can be a standard spherical normal model, that is, multiple target vectors form a spherical vector. After normalizing the multiple target vectors to obtain the first target model, the target model can be further determined based on the first target model.
[0101] As an optional implementation, determining the target model based on the first target model includes: determining the first target model as the target model; or stretching the first target model to obtain a second target model, wherein the second target model is an ellipsoidal normal model; and determining the target model based on the second target model.
[0102] In this embodiment, when determining the target model based on the first target model, the first target model can be directly determined as the target model, and the vertex normals of the original vegetation model can be adjusted based on its vertex normals to obtain the target vegetation model. Optionally, when the original vegetation model is a vertical vegetation model, the first target model can be stretched, for example, the vertical axis of the first target model can be stretched in the vertical direction, and a second target model can be obtained by performing a division operation on the first target model. The second target model can be an ellipsoidal normal model to achieve the purpose of performing a three-dimensional transformation on the spherical normal model to obtain an ellipsoidal effect, and then the target model is determined based on it.
[0103] As an optional implementation, determining the target model based on the second target model includes: determining the second target model as the target model; or superimposing the second target model, the parallel light normal and / or noise information to obtain the target model, wherein the parallel light normal is used to represent the vector of the parallel light in the scene where the original vegetation model is located, and the noise information is used to represent the noise of the original vegetation model.
[0104] In this embodiment, when the second target model is determined as the target model, the second target model can be directly determined as the target model, that is, the target model of this embodiment can be an ellipsoidal normal model. Optionally, the parallel light normal can be a vector of the parallel light in the game scene where the original vegetation model is located. In a game made using a target engine, there can only be one parallel light, which can be used to make sunlight. This embodiment can obtain the parallel light normal, which can be a parallel light vector, and superimpose the parallel light normal on the second target model. For example, the parallel light normal and the second target model are added (Add), thereby achieving the purpose of adding the direction of sunlight to the constructed normal, which can increase the bright area and reduce the dark area, that is, strengthening or weakening the area. It can also be understood as rewriting how much a pixel faces the sun. The higher the degree, the more it is illuminated, so that the vegetation model has more vectors facing the sun, that is, more bright sides. Optionally, in the material editor, the method of obtaining the parallel light normal can be implemented using the "Atmospheric Light Vector" node.
[0105] Optionally, this embodiment can also obtain noise information, which can include noise intensity information, used to represent the noise of the original vegetation model, such as clumping noise, which can be superimposed on the second target model to obtain the target model. The noise information can be a noise vector,
[0106] Optionally, this embodiment may first superimpose the second target model and the noise information, and then superimpose the parallel light normal onto the model including the noise information, thereby obtaining the target model.
[0107] As an optional implementation, the method further includes: acquiring noise information based on multiple second positions.
[0108] In this embodiment, time information and a time multiplication parameter can be obtained, and the time information and the time multiplication parameter can be multiplied (Multiply) to obtain a product result. Then, each second position (for example, the absolute world position of the pixel) and the product result are added to obtain a continuously linearly changing world position, and then the above-mentioned noise information can be obtained based on the continuously linearly changing world position.
[0109] As an optional implementation, noise information is obtained based on multiple second positions, including: rotating the multiple second positions to obtain multiple third positions; stretching the multiple third positions, and obtaining noise information based on the stretched multiple third positions and noise intensity.
[0110] In this embodiment, when obtaining noise information based on multiple second positions, the multiple second positions may be rotated to obtain multiple third positions. For example, when rotating a continuously linearly changing world position, a rotation vector (Rotate_Vector) may be obtained and used to rotate the continuously linearly changing world position. In other words, noise rotation may be performed. The X, Y, and Z positions of the continuously linearly changing world position may be rotated using the rotation vector to avoid the noise information having an overly mechanical noise pattern. This embodiment may stretch the multiple third positions and obtain noise information based on the stretched multiple third positions and the noise intensity (Noise_Intensity). Optionally, this embodiment can be to divide the continuously linearly changing world position after rotation by the noise parameter (Noise_Scale), thereby enlarging the scale of the continuously changing world position, and then convert it through the sine function (Sine) to obtain black and white stripes for each channel of X, Y, and Z. The black and white stripes for each channel of X, Y, and Z can be multiplied by the noise intensity to obtain noise information. The noise information can be black and white stripes in the three directions of X, Y, and Z, which can be understood as a mixture of three layers of waves in different directions in the three directions of X, Y, and Z, which can form a uniformly distributed and more detailed point-like black and white (cluster-like change).
[0111] As an optional implementation, obtaining noise information based on multiple second positions includes: performing a stretching operation on the multiple second positions, and obtaining noise information based on the multiple stretched second positions.
[0112] In this embodiment, when obtaining noise information based on multiple second positions, a stretching operation can be performed on the multiple second positions. For example, the pixel absolute world position is divided by Noise_Scale to achieve the purpose of stretching the pixel absolute world position. The stretched pixel absolute world position is then converted using a sine function and desaturated to obtain noise information. This method does not rotate X, Y, or Z, and the resulting noise information can be used for wind scenes or lighting effects.
[0113] As an optional embodiment, the method also includes: obtaining a position offset parameter; offsetting the first position based on the position offset parameter; determining a target vector based on the first position and each second position to obtain multiple target vectors, including: determining a target vector based on the offset first position and each second position to obtain multiple target vectors.
[0114] In this embodiment, a position offset parameter (Center_Offset) is obtained, which can be a user-defined vector, based on which the first position can be offset. For example, the pixel absolute world position and the position offset parameter are added to obtain the re-offset first position. In this way, when determining a target vector based on the first position and each second position to obtain multiple target vectors, a target vector can be determined based on the offset first position and each second position. For example, each second position is subtracted from the offset first position to obtain a target vector emitted from the center of the object to each pixel.
[0115] As an optional implementation, step S208, adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model, includes: outputting the target model to the target interface of the original vegetation model, adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0116] In this embodiment, when adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model, the target model can be output to the target interface of the original vegetation model, which can be the normal interface (Normal interface) of the main material node of the material blueprint, and then adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model in the target interface to obtain the target vegetation model.
[0117] As an optional embodiment, the method also includes: obtaining at least one of the following target information of the original vegetation model: top and back light information, vertex color and hidden information, wherein the top and back light information includes the light information of the top contour and the light information of the back contour of the original vegetation model, the vertex color is used to distinguish the branches and leaves of the original vegetation model, and the hidden information is used to eliminate the sharp edges of the original vegetation model; adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model, including: adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model, and generating the target vegetation model based on the adjusted vertex normals and the target information.
[0118] In this embodiment, target information can be obtained, and the target information can include the top and back light information of the original vegetation model, which can be obtained by performing a dot product on the vector facing the sky from behind the original vegetation model and the spherical normal model to obtain the above-mentioned top and back light information, which can achieve a top and back contour light effect, such as a top and back lighting effect. The target information of this embodiment can also include the vertex color of the original vegetation model, which can be used to distinguish the trunk and leaf information of the original vegetation model. The target information of this embodiment can also include fading information, which can be information based on the model normal information, used to eliminate the sharp edges of the original vegetation model. When this embodiment adjusts the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model, the vertex normals of the original vegetation model can be adjusted based on the vertex normals of the target model, and the target vegetation model can be generated based on the adjusted vertex normals, and at least one of the top and back light information, vertex color and fading information. Optionally, this embodiment can generate wind field deformation of the vegetation model based on noise information. The target vegetation model of this embodiment may not be affected by the ellipsoid normal, the wind field, or the contour light.
[0119] This embodiment can achieve the normal wrapping effect in the target engine through the above method without using DCC software, retaining the vertex normal information, and can flexibly adjust and expand the wrapping body in the target engine. The generation and flexible modification of the ellipsoid normal model can be achieved without DCC software. For example, the ellipsoid scale, light and shadow centroid, lighting offset, noise intensity without new sampling (and thus developing the effect of synchronization of light and shadow with wind), sharp edge removal, etc. can be adjusted, and the development of extensible material effects is reduced, which facilitates rapid iteration, the wrapping effect responds directly, and the normal effect acts on pixels rather than vertices, which is more accurate, thereby solving the technical problem of low efficiency in vegetation model generation and achieving the technical effect of improving the efficiency of vegetation model generation.
[0120] The technical solutions of the embodiments of the present invention are further illustrated below with reference to preferred embodiments.
[0121] Vegetation normal wrapping technology is closely related to the production process of vegetation models in game scenes. It is a method based on vertex normal editing. This method is to solve the problem of severe patchiness of plant models in game scenes, such as Figure 3 As shown in the figure, plants in reality have rich spatial structures, but in game scenes, vegetation models are often constructed using facets due to face number limitations. Figure 3 This is a schematic diagram of the visual effect of a patch with a gradually reduced number of faces based on related technology. Therefore, normal wrapping technology is used to solve the problem of light and shadow continuity.
[0122] Normal wrapping technology usually transfers the vertex normals of a smooth model to the vertex normals of a vegetation model. Figure 4A A schematic diagram of a vegetation model that cannot be wrapped by lines in the related art. Figure 4A As shown in the figure, the vegetation model has a serious patchy feeling. Figure 4B This is a schematic diagram of a normal wrapping method based on a single face in the related art. Figure 4C This is a schematic diagram of a normal wrapping based on pixels to the origin in related technology, such as Figure 4B and 4C As shown in the figure, the patchiness of the vegetation model has been slightly improved, but the visual effect is still not good.
[0123] Figure 5A This is a schematic diagram of a hemisphere according to the related art. Figure 5A As shown, the smooth model can be a hemisphere, and its vertex normals can be transferred to the vertex normals of the vegetation model. Figure 5B It is a schematic diagram of a sphere (ellipsoid) according to the related art. Figure 5B As shown, the smooth model can be a sphere (ellipsoid), and its vertex normals can be transferred to the vertex normals of the vegetation model.
[0124] Figure 6A This is a schematic diagram of a normal wrapping method based on a face group in the related art. Figure 6A As shown, the face group can be a cross face, and normal wrapping of the vegetation model is achieved based on the cross face. Figure 6B This is a schematic diagram of a normal wrapping based on a custom polygon in the related art. Figure 6B As shown, the vegetation model can be normal wrapped based on user-defined polygons.
[0125] Figure 7A This is a schematic diagram of a cartoon-style vegetation model in a game scene according to related art. Figure 7B This is a schematic diagram of a realistic vegetation model in a game scene according to the related art. Figure 7A and 7B As shown, this can be achieved through the normal wrapping technology in the above-mentioned related technology.
[0126] The principles of the currently common normal wrapping methods in the above-mentioned related technologies are basically the same, that is, vertex normal search and mapping are performed in DCC software.
[0127] In Maya software, you can use the "Transfer Attributes" function to directly transfer the vertex normal attributes of the target model (such as a hemisphere) to the vegetation model, which is very fast. Figure 8As shown, select the "On" function control and click the "Apply" function control to transfer the vertex normal attributes to the vegetation model. Figure 8 This is a schematic diagram of transferring the attributes of the vertex normals of a target model according to a related technology.
[0128] In Modo, you can use the pipelineIO plugin to bake normals directly into a specific model.
[0129] Figure 9A This is a schematic diagram of baking a normal into a specific model based on related technologies. Figure 9A As shown, the default normals can be baked into a specific vegetation model. Figure 9B This is a schematic diagram of baking another normal into a specific model according to the related technology. Figure 9B As shown, a specific vegetation model can be baked in with normals emanating from the center. Figure 9C This is a schematic diagram of baking another normal into a specific model according to the related technology. Figure 9C As shown, a specific vegetation model can be baked in by emitting normals from a source point.
[0130] In 3ds Max software, you can use the NormalThief.ms script, such as Figure 10 As shown, the target model normals can be baked onto the vegetation model, but this process is time-consuming and may take from 1 minute to 30 minutes. Figure 10 This is a schematic diagram of baking target model normals into vegetation models in 3ds Max software according to related technologies.
[0131] The above methods all rewrite the vertex normals of the vegetation model in the DCC software, which results in the vertex normals of the vegetation model not being perpendicular to the surface, that is, the vertex normals of the baked vegetation model are forced to rotate to the state closest to the target model. At this time, the vertex normals will not be perpendicular to the plane of the polygons adjacent to the vertex, which is equivalent to losing the correct normal information of the vegetation model. The development of engine effects based on the model normal information is very difficult. In addition, the flexibility of the above methods is not high enough. The producer cannot modify the normal package in the engine and can only return to the DCC software to modify the baking again. For example, baking in the Max environment requires waiting for 1-30 minutes, which results in a large iteration time cost, which is very uneconomical. Furthermore, the related technology is to store the normal information on the vertex. If the number of faces of the vegetation model is very low, the normal information is very inaccurate and the effect is unsatisfactory.
[0132] The embodiments of the present invention can achieve a normal wrapping effect on vegetation models without losing the correct vertex normal information of the model; can achieve the normal wrapping effect without using DCC software; can flexibly adjust and expand the inclusion volume within the engine; and the normal effect is applied to pixels rather than vertices, resulting in greater accuracy. The method of the embodiments of the present invention is further described below.
[0133] The core content of this embodiment is to achieve the ellipsoidal normal wrapping effect in Unreal Engine 4 without using DCC software, which can retain vertex normal information and reduce the development of extensible material effects. The parameters are open, which facilitates rapid iteration and the wrapping effect can be directly responded.
[0134] The following describes the technical solution of the embodiment of the present invention based on the Unreal Engine 4 blueprint.
[0135] This embodiment can change the normal space of the material from tangent space to world space in the material system. Figure 11 As shown in the figure, in the material system, by operating the controls corresponding to the target normal space, the purpose of changing from tangent space to world space can be achieved. Figure 11 FIG. 4 is a schematic diagram of changing the tangent space to the world space according to one embodiment of the present invention.
[0136] Figure 12 FIG. 1 is a schematic diagram of an ellipsoidal normal model according to one embodiment of the present invention. Figure 12 As shown, the absolute world position of pixels on the vegetation model can be obtained. To obtain the object position, the "ObjectPosition" node can be used in the Unreal Engine material blueprint editor to obtain the object position, which can be viewed as a vector. In this embodiment, the Absolute world position-Objects position can be used to obtain a vector radiating from the center of the object to the surface, and then the vector can be normalized. This can be done by adding a "Normalize" node after the vector to normalize the vector, thereby obtaining a standard spherical normal model.
[0137] Optionally, this embodiment obtains an offset (Center_Offset), which can be a user-defined vector, and adds Object Position and Center_Offset to obtain the re-offset object coordinates, and then performs vertex interpolation on them to obtain the center position of the object. Among them, the vegetation system of Unreal Engine or the entire batch of vegetation in the instance system can be regarded as one object, so there is only one Object Position. Then, the Absolutely worldposition is subtracted from the center position of the object to obtain a vector emitted from the center of the object to the pixel on the vegetation model. However, some vectors are too long and some vectors are too short. They can be standardized to obtain a spherical normal model, and a stretching operation can be performed on them, which can be the spherical normal model divided by the stretching parameter (Normal_Strecth), so as to achieve the purpose of stretching the spherical normal model in different axes and obtain an ellipsoidal normal model. That is, this embodiment can perform a three-dimensional transformation on the spherical normal model to obtain an ellipsoidal effect.
[0138] Figure 13 FIG. 1 is a schematic diagram of a standardization process according to one embodiment of the present invention. Figure 13 As shown, the length of all vectors emitted from the center of an object to the surface can be set to 1 and used as normal vectors, thereby achieving the purpose of standardizing the vectors.
[0139] Figure 14 FIG. 1 is a schematic diagram of rewriting the vertex normals of a vegetation model according to one embodiment of the present invention. Figure 14 As shown, the normals in the ellipsoidal normal model are vectors. Outputting them to the Normal interface of the main material node in the material blueprint rewrites the pixel normals of the vegetation model. It should be noted that Unreal Engine materials ultimately render as pixel normals. Therefore, in the game scene, all rendering is done in pixels, so the vertex normals can be called pixel normals.
[0140] Figure 15 FIG. 4 is a schematic diagram of an ellipsoidal normal model according to one embodiment of the present invention. Figure 15As shown, this embodiment can also superimpose noise information (noise vector) on the spherical normal model, that is, the spherical normal model is interfered by noise to obtain more detailed cluster changes. In this embodiment, the parallel light normal can also be strengthened or weakened, and the offset of the light and dark areas can be adjusted. The parallel light normal is a vector for obtaining parallel light in the game scene. In game applications produced using Unreal Engine 4, there can only be one parallel light, which can generally be used as sunlight. This embodiment can add the direction of sunlight to the constructed ellipsoidal normal model, and its effect is to increase the bright area and reduce the dark area. It can also be understood as rewriting the degree to which a pixel faces the sun. The higher the degree, the more illuminated it is, so that the object faces the sun more, that is, the brighter the surface. In the material editor, the method of obtaining the parallel light vector can be implemented using the "Atmospheric Light Vector" node.
[0141] Figure 16 FIG. 1 is a schematic diagram of noise information generation according to one embodiment of the present invention. Figure 16 As shown, time information (Time) and a time multiplication parameter (Wind_Speed) can be obtained, multiplied together, and the resulting product added to the pixel's absolute world position to obtain a continuously linearly varying world position. The continuously linearly varying world position is then rotated using a rotation vector (Rotate_Vector), where the continuously linearly varying world position is rotated in X, Y, and Z to avoid overly mechanical noise information. This embodiment can also divide the rotated continuously varying world position by a noise parameter (Noise_Scale), and then transform it using a sine function (Sine) to obtain black and white stripes for each X, Y, and Z channel. This is then multiplied by the noise intensity (Noise_Intensity) to obtain noise information. The noise intensity is used to adjust the intensity of the black and white stripes. In this embodiment, the black and white stripes in the X, Y, and Z directions can be understood as waves advancing in the three directions. By mixing the waves in the three directions, a very simple noise information can be formed.
[0142] Figure 17 FIG. 1 is a schematic diagram of another noise information generation according to an embodiment of the present invention. Figure 17 As shown, the absolute world position of the pixel is divided by the noise parameter, and the result is converted by a sine function and desaturated to obtain noise information, which can be used for wind or lighting effects. However, this method does not rotate the X, Y, and Z axes of the continuously linearly changing world position.
[0143] Figure 18FIG. 1 is a schematic diagram of adjusting relevant parameters in an instance material according to one embodiment of the present invention. Figure 18 As shown, you can adjust parameters such as the maximum culling value, minimum culling value, ellipsoid center displacement, ellipsoid stretching parameters, top light intensity, noise intensity, noise size, wind intensity, wind speed, etc. in the instance material.
[0144] Figure 19 FIG. 1 is a schematic diagram of generating top and back contour light information according to one embodiment of the present invention. Figure 19 As shown, the dot product of the skyward vector behind the object and the spherical normal model is performed to obtain the top and back contour light information to achieve the top and back contour light effect.
[0145] Figure 20 FIG. 1 is a schematic diagram of data processing of vegetation normal wrapping according to one embodiment of the present invention. Figure 20 As shown, lighting effects are produced by using back top light information, vertex colors are used to distinguish between trunk and leaf information, model normal information is used to eliminate sharp edges of the vegetation model, wind field deformation is generated based on noise information, and other data processing is used to adjust color. The method of this embodiment can prevent the trunk of the vegetation model from being affected by the ellipsoidal normal, the wind field, and the contour light.
[0146] This embodiment, through the above method, can solve the problem of expansion and development difficulties caused by the vertex normals not being perpendicular to the surface after normal wrapping of the vegetation model, thereby reducing the development difficulty. This embodiment can achieve the generation and flexible modification of the ellipsoid normal model without DCC software. For example, it can adjust the ellipsoid scale, light and shadow centroid, lighting offset, noise intensity without additional sampling (thus developing the effect of light and shadow synchronization with wind movement), and sharp edge removal.
[0147] Figure 21 FIG. 1 is a comparative diagram of the rendering effect of a vegetation model according to one embodiment of the present invention. Figure 21 As shown, from left to right are the initial no wrapping, spherical wrapping, bright part polarized shadow noise, and sharp edge blanking effects.
[0148] Figure 22 FIG. 1 is a schematic diagram of an expansion effect based on material normal wrapping according to one embodiment of the present invention. Figure 22 As shown, from left to right, the display effects are messy light and shadow with sharp edges, too smooth light and shadow, some surface feeling, and precise normals.
[0149] Figure 23 FIG. 4 is a schematic diagram of a toplighting effect of a vegetation model according to one embodiment of the present invention. Figure 24 FIG. 1 is a schematic diagram of a backlight effect of a vegetation model according to one embodiment of the present invention. Figure 23 and Figure 24 As shown, the top light effect and back light effect of the vegetation model are respectively shown.
[0150] Figure 25 FIG. 1 is a schematic diagram of the rendering effect of a vegetation model without projection according to one embodiment of the present invention. Figure 25 As shown, there may be no projection at a long distance, or the projection accuracy may be relatively low.
[0151] Figure 26 FIG. 1 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the center of gravity of light and shadow gradually shifts downward. Figure 26 As shown in the figure, the vegetation models all show the effect of the light and shadow center of gravity gradually shifting downward.
[0152] Figure 27 FIG. 1 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the noise level changes from strong to weak. Figure 27 As shown, the vegetation model shows the effect of noise from strong to weak.
[0153] Figure 28 FIG. 1 is a schematic diagram of the rendering effect of a vegetation model according to one embodiment of the present invention when the noise level increases from small to large. Figure 28 As shown, the vegetation model shows the effect of increasing noise from small to large.
[0154] Figure 29 FIG. 1 is a schematic diagram of an effect of eliminating sharp edges based on model normals according to one embodiment of the present invention. Figure 29 As shown, the vegetation model demonstrates the effect of removing sharp edges based on the model normals.
[0155] Figure 30 FIG is a schematic diagram of the rendering effect of a vegetation model using different ellipsoidal models according to an embodiment of the present invention. Figure 30 As shown in FIG, the effect of the vegetation model generated based on the ellipsoidal model with different deformations is demonstrated.
[0156] Figure 31 FIG. 1 is a schematic diagram of a rendering effect of a vertically elongated ellipsoid vegetation model according to one embodiment of the present invention. Figure 31 As shown, the vertically elongated ellipsoid is suitable for the slender vegetation model.
[0157] In this embodiment, sharp edge culling can be achieved even when vertex normals are lost. Figure 32 FIG. 1 is a schematic diagram of a sharp edge elimination method according to one embodiment of the present invention. Figure 32As shown, DDX and DDY can be used to calculate and select areas with large change rates for culling, but multi-PASS calculations are required and aliasing is easily formed. In addition, it is based on pixel-by-pixel rendering, which consumes more than vertex-by-vertex rendering, and the culling parameters are not easy to control.
[0158] This embodiment can achieve the normal wrapping effect in the target engine through the above method without using DCC software, retaining the vertex normal information, and flexibly adjusting and expanding the wrapping body in the target engine. The generation and flexible modification of the ellipsoid normal model can be achieved without DCC software. For example, the ellipsoid scale, light and shadow centroid, lighting offset, noise intensity without new sampling, sharp edge blanking, etc. can be adjusted, and the development of extensible material effects is reduced, which facilitates rapid iteration. The wrapping effect responds directly, and the normal effect acts on pixels rather than vertices, which is more accurate, thereby solving the technical problem of low efficiency in vegetation model generation, and achieving the technical effect of improving the efficiency of vegetation model generation.
[0159] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0160] This embodiment also provides a device for generating a vegetation model, which is applied to a target engine and is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "unit" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0161] Figure 33 FIG. 1 is a structural block diagram of a device for generating a vegetation model according to one embodiment of the present invention. Figure 33 As shown, the vegetation model generation device 330 includes: an acquisition unit 331, a determination unit 332, a generation unit 333 and an adjustment unit 334.
[0162] The acquiring unit 331 is configured to acquire a first position and multiple second positions of the original vegetation model, wherein the first position is the center position of the original vegetation model, and the second position is a position on the surface of the original vegetation model.
[0163] The determining unit 332 is configured to determine a target vector based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model.
[0164] The generating unit 333 is configured to generate a target model based on the multiple target vectors.
[0165] The adjustment unit 334 is configured to adjust the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0166] It should be noted that the above-mentioned units can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above-mentioned units are all located in the same processor; or the above-mentioned units are located in different processors in any combination.
[0167] In the vegetation model generation device of this embodiment, DCC software is not used. Instead, in the target engine, the target model is determined using the absolute world position of the pixels of the vegetation model and the object position, and then the vertex normals of the original vegetation model are rewritten using the target model to obtain the target vegetation model. In this way, the vegetation model can have a normal wrapping effect without going through the DCC software without losing the vertex normal information of the vegetation model. Moreover, the normal effect acts on pixels rather than vertices, making the normal effect more accurate, thereby solving the technical problem of low efficiency in vegetation model generation and achieving the technical effect of improving the efficiency of vegetation model generation.
[0168] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the steps of any of the above method embodiments.
[0169] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0170] S1, obtaining a first position and multiple second positions of an original vegetation model, wherein the first position is a position of a center of the original vegetation model, and the second position is a position on a surface of the original vegetation model;
[0171] S2, determining a target vector based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model;
[0172] S3, generates a target model based on multiple target vectors;
[0173] S4, adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0174] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0175] An embodiment of the present invention further provides a processor, which is used to run a program, wherein the program is configured to execute the steps of any of the above method embodiments when run by the processor.
[0176] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
[0177] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0178] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0179] S1, obtaining a first position and multiple second positions of an original vegetation model, wherein the first position is a position of a center of the original vegetation model, and the second position is a position on a surface of the original vegetation model;
[0180] S2, determining a target vector based on the first position and each second position to obtain multiple target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model;
[0181] S3, generates a target model based on multiple target vectors;
[0182] S4, adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
[0183] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0184] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0185] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0186] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0187] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0188] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0190] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for generating a vegetation model, characterized in that: The method is applied to a target engine and includes: Acquire a first position and a plurality of second positions of an original vegetation model, wherein the first position is a position of a center of the original vegetation model, and the second positions are positions on a surface of the original vegetation model; Determine a target vector based on the first position and each of the second positions to obtain a plurality of target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model; generating a target model based on the plurality of target vectors; Adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain a target vegetation model; Generating a target model based on the multiple target vectors includes: generating a first target model based on the multiple target vectors; stretching the first target model to obtain a second target model; and superimposing the second target model, parallel light normals and / or noise information to obtain the target model, wherein the parallel light normals are used to represent the vectors of parallel light in the scene where the original vegetation model is located, and the noise information is used to represent the noise of the original vegetation model.
2. The method according to claim 1, characterized in that Generating a first target model based on the plurality of target vectors includes: Normalization is performed on the multiple target vectors to obtain the first target model, wherein the first target model is a spherical normal model.
3. The method according to claim 1, characterized in that The second target model is an ellipsoidal normal model.
4. The method according to claim 1, wherein The method further comprises: The noise information is obtained based on the multiple second positions.
5. The method according to claim 4, characterized in that Acquiring the noise information based on the multiple second positions includes: A stretching operation is performed on the plurality of second positions, and the noise information is acquired based on the plurality of second positions after stretching.
6. The method according to claim 4, characterized in that Acquiring the noise information based on the multiple second positions includes: performing a rotation operation on the plurality of second positions to obtain a plurality of third positions; A stretching operation is performed on the plurality of third positions, and the noise information is acquired based on the plurality of third positions after stretching and the noise intensity.
7. The method according to claim 1, characterized in that The method further includes: acquiring a position offset parameter; and offsetting the first position based on the position offset parameter; Determining a target vector based on the first position and each of the second positions to obtain multiple target vectors includes: determining a target vector based on the offset first position and each of the second positions to obtain the multiple target vectors.
8. The method according to claim 1, characterized in that Adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model includes: The target model is output to the target interface of the original vegetation model, so as to adjust the vertex normals of the original vegetation model based on the vertex normals of the target model to obtain the target vegetation model.
9. The method according to any one of claims 1 to 8, characterized in that The method further includes: acquiring at least one of the following target information of the original vegetation model: top and back light information, vertex color, and fading information, wherein the top and back light information includes light information of a top contour and light information of a back contour of the original vegetation model, the vertex color is used to distinguish branches and leaves of the original vegetation model, and the fading information is used to eliminate sharp edges of the original vegetation model; The vertex normals of the original vegetation model are adjusted based on the vertex normals of the target model to obtain the target vegetation model, including: adjusting the vertex normals of the original vegetation model based on the vertex normals of the target model, and generating the target vegetation model based on the adjusted vertex normals and the target information.
10. A vegetation model generating device, characterized in that: The device is applied to a target engine and includes: an acquiring unit, configured to acquire a first position and a plurality of second positions of an original vegetation model, wherein the first position is a position of a center of the original vegetation model, and the second positions are positions on a surface of the original vegetation model; a determining unit, configured to determine a target vector based on the first position and each of the second positions, to obtain a plurality of target vectors, wherein the target vector is a vector from the center of the original vegetation model to a position on the surface of the original vegetation model; a generating unit, configured to generate a target model based on the plurality of target vectors; an adjusting unit, configured to adjust the vertex normal vectors of the original vegetation model based on the target model to obtain a target vegetation model; The generation unit is used to generate a target model based on the multiple target vectors through the following steps: generating a first target model based on the multiple target vectors; stretching the first target model to obtain a second target model; superimposing the second target model, parallel light normal and / or noise information to obtain the target model, wherein the parallel light normal is used to represent the vector of the parallel light in the scene where the original vegetation model is located, and the noise information is used to represent the noise of the original vegetation model.
11. A computer-readable storage medium, characterized in that The storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 9.
12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the computer program to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Vegetation model rendering method and device, equipment and storage medium
CN112206528A