WO2021047429A1 - 一种图像渲染方法、装置、设备及存储介质 - Google Patents

一种图像渲染方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2021047429A1
WO2021047429A1 PCT/CN2020/112926 CN2020112926W WO2021047429A1 WO 2021047429 A1 WO2021047429 A1 WO 2021047429A1 CN 2020112926 W CN2020112926 W CN 2020112926W WO 2021047429 A1 WO2021047429 A1 WO 2021047429A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
basic
value
map
rendering
Prior art date
Application number
PCT/CN2020/112926
Other languages
English (en)
French (fr)
Inventor
王治良
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to JP2021555825A priority Critical patent/JP7270760B2/ja
Priority to EP20862745.5A priority patent/EP3916680A4/en
Priority to US17/161,993 priority patent/US11833424B2/en
Publication of WO2021047429A1 publication Critical patent/WO2021047429A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/35Details of game servers
    • A63F13/355Performing operations on behalf of clients with restricted processing capabilities, e.g. servers transform changing game scene into an encoded video stream for transmitting to a mobile phone or a thin client
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/503Blending, e.g. for anti-aliasing
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • A63F2300/6692Methods for processing data by generating or executing the game program for rendering three dimensional images using special effects, generally involving post-processing, e.g. blooming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/61Scene description

Definitions

  • This application relates to the field of image processing, in particular to image rendering technology.
  • a basic image is specified for the scene to be drawn, and this basic image is divided into N basic image blocks, and the corresponding target basic image blocks are drawn according to the viewport size.
  • An image with other screen effects that is, an effect map
  • N corresponding effect map blocks is also segmented to obtain N corresponding effect map blocks, and the corresponding effect map blocks are superimposed and drawn on the target basic image according to the viewport size to achieve the final effect.
  • this image rendering method needs to draw separately for the basic image and each effect image.
  • the number of drawing times increases linearly with the increase of the number of effect maps and the number of blocks, and the more the number of drawing times, the more the processor is The longer the resource occupancy time will be, which will affect the processing performance of the processor.
  • the most obvious is that it will directly reduce the efficiency of image rendering, and the response rate of applications based on image interaction will be correspondingly reduced.
  • the embodiments of the present application provide an image rendering method, device, device, and storage medium, which can effectively reduce the number of drawing times in the image rendering process and improve the image rendering efficiency.
  • the first aspect of the present application provides an image rendering method, including:
  • the picture effect indication array including picture effect indication values corresponding to pixel positions of the basic image
  • a second aspect of the present application provides an image rendering device, including:
  • the first obtaining module is used to obtain the specified basic image in the picture to be rendered
  • the second acquisition module is configured to acquire a picture effect indication array corresponding to the basic image, and the picture effect indication array includes picture effect indication values corresponding to pixel positions of the basic image;
  • the first rendering module is configured to render the basic image to a rendered texture object matching the screen size of the device to obtain a basic texture map
  • the second rendering module is configured to perform color rendering on the basic texture map according to the picture effect indication array.
  • the third aspect of the present application provides a terminal device, including:
  • Central processing unit graphics processing unit, memory and display
  • the memory is used to store a computer program
  • the central processing unit is configured to execute the computer program, and control the graphics processor to execute the computer program when image rendering is required to implement the image rendering method described in the first aspect;
  • the display is used for displaying image frames under the control of the graphics processor.
  • a fourth aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium is used to store program code, and the program code is used to execute the image rendering method described in the first aspect.
  • the fifth aspect of the present application provides a computer program product including instructions, which when run on a computer, causes the computer to execute the image rendering method described in the first aspect.
  • the embodiment of the application provides an image rendering method, which comprehensively considers the effects of shadows, highlights, occlusions, etc. in the image, and correspondingly determines the screen effect indicator value that can represent the final color display effect for each pixel position in the image.
  • the screen effect indication value corresponding to each pixel position is used to form the screen effect indication array; when the image is rendered, the basic image specified in the picture to be rendered and the screen effect indication array corresponding to the basic image are obtained, and the basic image is rendered to After the basic texture map is obtained from the rendered texture object matching the screen size of the device, the obtained picture effect indication array is used to adjust the pixel values in the basic texture map, and then the image rendering is completed based on the adjusted pixel values.
  • the image rendering method provided in the embodiment of the present application uses the screen effect indicator array to adjust the pixel value in the basic texture map to realize the screen display
  • the addition of effects omits the process of rendering various renderings, and correspondingly saves computing resources required in the image rendering process, and effectively improves the efficiency of image rendering.
  • FIG. 1 is a schematic diagram of an application scenario of an image rendering method provided by an embodiment of the application
  • FIG. 2 is a schematic flowchart of an image rendering method provided by an embodiment of the application
  • FIG. 3 is a schematic diagram of the principle of an image rendering method provided by an embodiment of the application.
  • FIG. 4 is a game screen rendered by using the image rendering method provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an image rendering device provided by an embodiment of the application.
  • FIG. 6 is a schematic structural diagram of another image rendering apparatus provided by an embodiment of the application.
  • FIG. 7 is a schematic structural diagram of another image rendering device provided by an embodiment of the application.
  • FIG. 8 is a schematic structural diagram of a terminal device provided by an embodiment of the application.
  • the embodiments of the present application provide an image rendering method, which combines the effects of shadows, highlights, occlusions, etc. in the image, and uses a set of data (ie, the image effect indicator array) to represent each pixel in the image
  • the final color effect value of the position when performing image rendering for the picture to be rendered, use the picture effect indicator array to adjust the pixel value in the basic texture map, which is to render the specified basic image in the picture to be rendered to and It is obtained from the rendered texture object matching the screen size of the device, and then based on the adjusted pixel value, the image rendering of the picture to be rendered is completed.
  • image rendering method provided by the embodiments of the present application can be applied to terminal devices with image processing functions, such as smart phones, computers, personal digital assistants (Personal Digital Assitant, PDA), tablet computers, etc.
  • terminal devices with image processing functions such as smart phones, computers, personal digital assistants (Personal Digital Assitant, PDA), tablet computers, etc.
  • the application scenario includes a terminal device 110 and a server 120.
  • the terminal device 110 communicates with the server 120 via a network; the server 120 is used to provide the terminal device 110 with a basic image specified in the screen to be rendered and the corresponding basic image.
  • the terminal device 110 is used to execute the image rendering method provided by the embodiment of the present application, and based on the basic image provided by the server 110 and the corresponding screen effect indicator array, render and display the to-be-rendered image on its screen.
  • the terminal device 110 may send an image acquisition request to the server 120 when detecting that the user triggers a related operation.
  • the server 120 determines the to-be-rendered screen currently to be rendered by the terminal device 110 based on the image-acquisition request, and determines the basic image specified in the to-be-rendered screen and the screen effect indication array corresponding to the basic image.
  • the picture effect indication array includes picture effect indication values corresponding to the pixel positions of the basic image, and further, the determined basic image and the picture effect indication array corresponding to the basic image are sent to the terminal device 110.
  • the terminal device 110 After receiving the basic image and its corresponding screen effect instruction array sent by the server 120, the terminal device 110 renders the basic image to a rendered texture object matching its screen size to obtain a basic texture map; further, use the received screen
  • the picture effect indication value in the effect indication array is adjusted accordingly to the pixel value in the basic texture map to obtain the pixel value corresponding to the final color display effect of the picture to be rendered; finally, the image is completed based on the adjusted pixel value Rendering to obtain an image superimposed and displayed with display effects such as shadows, highlights, and occlusions.
  • the terminal device itself can store the basic image specified in the picture to be rendered and its corresponding screen effect indication array, and directly based on the basic image and The corresponding screen effect instructs the array to complete the image rendering without communicating with the server.
  • This does not set any limitation on the application scenarios to which the image rendering method provided in the embodiments of the present application is applicable.
  • FIG. 2 is a schematic flowchart of an image rendering method provided by an embodiment of the application. As shown in Figure 2, the image rendering method includes the following steps:
  • Step 201 Obtain a specified basic image in the picture to be rendered.
  • the terminal device After detecting that the user triggers a designated operation for controlling rendering and displaying the to-be-rendered picture, the terminal device will correspondingly acquire the designated basic image in the to-be-rendered picture.
  • the above-mentioned basic image refers to a fixed screen background image in the display screen to be rendered.
  • different types of background images can be used as the basic image accordingly.
  • the scene map specified in the game screen to be rendered can be used as the basic image; this application is here There is no restriction on the type of basic image.
  • the terminal device may communicate with the server to obtain the basic image specified in the picture to be rendered from the server. Specifically, after the terminal device detects that the user triggers a specified operation, it can send an image acquisition request to the server accordingly; after receiving the subsequent request for the image, the server determines the to-be-rendered image currently to be rendered by the terminal device based on the image acquisition request, and The basic image specified in the picture to be rendered is returned to the terminal device.
  • the terminal device when the terminal device detects that the user triggers the game interface jump operation, it sends an image acquisition request to the server accordingly; after the server receives the image acquisition request, it is based on the The image acquisition request determines the game interface to be rendered currently to be rendered (that is, the game interface that should be displayed after the game interface jump operation is triggered), and acquires the scene map specified in the game interface as the basic image, and then returns the basic image to the terminal device .
  • the terminal device may retrieve the specified basic image in the current picture to be rendered from the data stored in the terminal device.
  • the terminal device can use its own memory to store the basic images corresponding to several screens.
  • the terminal device detects that the user triggers the display of a certain screen, the terminal device correspondingly retrieves the specified basic image in the screen from its own memory. image.
  • the terminal device detects that the user triggers the display of the game interface During operation, you can directly retrieve the basic image specified in the game interface from its own cache.
  • the terminal device may also use other methods to acquire the basic image, and the method of acquiring the basic image by the terminal device is not limited herein.
  • Step 202 Obtain a picture effect indication array corresponding to the basic image, where the picture effect indication array includes picture effect indication values corresponding to pixel positions of the basic image.
  • the terminal device After the terminal device detects that the user triggers the specified operation for controlling the rendering and display of the to-be-rendered picture, it needs to obtain the screen effect indication array corresponding to the basic image in addition to the specified basic image in the to-be-rendered picture.
  • the picture effect indication array includes picture effect indication values corresponding to the pixel positions of the basic image.
  • the picture effect indication values in the picture effect indication array are determined by comprehensively considering the display effects such as shadows, highlights, and occlusions in the picture to be rendered. Take the picture effect indicator value including the red (red, R) channel value indicating the transparency, the green (green, G) channel value indicating the highlight brightness, and the blue (blue, B) channel value indicating the degree of shading as an example. For the area that needs to be occluded in the screen, you can set the R channel value in the screen effect indicator value of the corresponding position to a value greater than 0.
  • the B channel value in the indicator value is set to a value greater than 0, the darker the shadow, the larger the B channel value.
  • the terminal device may communicate with the server to obtain the screen effect indication array corresponding to the basic image from the server. Specifically, after detecting that the user triggers the specified operation, the terminal device may send an image acquisition request to the server to request the server to provide it with the specified basic image in the picture to be rendered and the screen effect indication array corresponding to the basic image; and further, receive The basic image returned by the server in response to the image acquisition request and the screen effect indication array corresponding to the basic image.
  • the terminal device may also first obtain a basic image from the server, and then send a screen effect indication array acquisition request to the server based on the basic image to request the server to provide it with the screen effect indication array corresponding to the basic image; Furthermore, the receiving server responds to the screen effect indication array to obtain the screen effect indication array returned by the request.
  • the terminal device may retrieve the screen effect indication array corresponding to the basic image from the data stored in the terminal device.
  • the terminal device can use its own memory to store multiple basic images and their corresponding screen effect indication arrays.
  • the terminal device detects that the user triggers a specified operation, the terminal device can simultaneously retrieve the basic images and their corresponding images from its own memory. The corresponding screen effect indicator array.
  • the terminal device can also first retrieve the basic image specified in the picture to be rendered from the memory, and then retrieve the basic image from its memory based on the correspondence between the basic image and the screen effect indicator array The corresponding screen effect indicator array.
  • the terminal device may also use other methods to obtain the screen effect indicator array.
  • the method of obtaining the screen effect indicator array by the terminal device is not performed here. Any restrictions.
  • the terminal device may obtain an array of picture effect indications in the form of an image, so that the graphics processing unit (GPU) can simultaneously perform processing on the basic image and the picture effect indication array in the form of an image. deal with.
  • the terminal device obtains a picture effect indication image, the picture effect indication image carries a picture effect indication array; further, the pixel value of each pixel position is read from the picture effect indication image, and the picture is generated according to the pixel value of each pixel position
  • the screen effect indicator array corresponding to the effect indicator image That is, the picture effect indication array corresponding to the picture effect indication image includes the pixel value of each pixel position read from the picture effect indication image.
  • the screen effect indication image can be generated through art production in advance, and the size of the screen effect indication image can be set to be the same as the size of the base image.
  • the size of the screen effect indication image can be set Is the size of the game scene map. Then, set the pixel value in the picture effect indication image according to the method of setting the picture effect indication value described above, that is, for the area that needs to be blocked, set the corresponding pixel value in the R channel value to be greater than 0, and for the highlight display Set the corresponding pixel value in the area to have the G channel value greater than 0, and set the corresponding pixel value in the B channel value greater than 0 for the area that will be covered by the shadow. Furthermore, the screen effect indicator diagram is reduced to a suitable size, such as 1024*1024.
  • the read pixel value corresponding to each pixel position from the picture effect indication image, that is, read the R channel value, G channel value and B channel value in the pixel value at each pixel position, and then, according to the distribution of each pixel position
  • the read pixel values are used to form the screen effect indication array corresponding to the screen effect indication image.
  • Step 203 Render the basic image to a rendered texture object matching the screen size of the device to obtain a basic texture map.
  • the terminal device After obtaining the basic image, the terminal device does not directly render the basic image to the frame buffer (FrameBuffer), but renders the basic image to a rendering texture object that matches its screen size, such as Rendertexture, which belongs to the frame buffer object (Frame Buffer Object, FBO), from which a basic texture map is obtained by rendering, that is, a basic texture map displaying a basic image is obtained; in a game scene, the basic texture map is a texture displaying a game scene map.
  • a rendering texture object that matches its screen size, such as Rendertexture, which belongs to the frame buffer object (Frame Buffer Object, FBO), from which a basic texture map is obtained by rendering, that is, a basic texture map displaying a basic image is obtained; in a game scene, the basic texture map is a texture displaying a game scene map.
  • the aforementioned object image may specifically be a game character controlled by the player in the game screen, or may be a game character assigned and set by the system in the game screen.
  • the object corresponding to the object image is not specifically limited here.
  • the specific method for the terminal device to obtain the object image is similar to the method of obtaining the basic image and obtaining the screen effect indication array above. It can obtain the object image by communicating with the server, or it can also obtain the object image from the data cached by itself. , And there is no restriction on the way to obtain the image of the object.
  • the object image acquired by the terminal device may be one or multiple, and the number of object images acquired by the terminal device is not limited here.
  • the terminal device After the terminal device obtains the object image, it can use the screen post-processing method to render the obtained object image. After completing the rendering of all the object images in the to-be-rendered screen, an object map containing all objects that matches the screen size of the device is obtained. .
  • the terminal device also needs to color blend the basic texture map obtained by rendering the basic image with the object map obtained by rendering the object image to obtain a scene object fusion map.
  • the terminal device may use the alpha channel of the object map as a weight, and use the weight to perform weighted average processing on the object map and the basic texture map to obtain a scene object fusion map.
  • Drgb Brgb*(1-C ⁇ )+Crgb*C ⁇ (1)
  • Brgb is the pixel value in texture B
  • Crgb is the pixel value in texture C
  • Drgb is the pixel value in texture D
  • C ⁇ is the alpha channel value of texture C.
  • the basic image specified in the to-be-rendered screen can be divided into N (N is an integer greater than or equal to 1) basis Image block; further, when the basic texture map is obtained by rendering the basic image, you can select the target basic image block belonging to the current viewport from the N basic image blocks, and render the selected target basic image block To the rendered texture object that matches the screen size of the device, the basic texture map is obtained.
  • the terminal device may divide the basic image into N basic image blocks according to a preset image division rule.
  • the terminal device can first determine its current viewport range, and then select the basic image block within the viewport range from the divided N basic image blocks as the target basic image block , And then render the selected target basic image in blocks to a rendering texture object matching the screen size of the device to obtain a basic texture map.
  • the size of the N basic image blocks obtained by dividing the basic image by the terminal device may be the same or different, and the image division rule adopted by the terminal device is not limited here.
  • Step 204 Perform color mixing rendering on the basic texture map according to the picture effect indication array.
  • the terminal device After the terminal device renders the basic texture map, it can use the picture effect indication value in the picture effect indication array obtained in step 202 to adjust each pixel value in the basic texture map accordingly, and then complete the adjustment based on the adjusted pixel value.
  • the rendering of the picture to be rendered so as to display the picture carrying the display effects such as shadows, highlights, and occlusions on the device screen.
  • the terminal device may specifically implement the rendering of the picture to be rendered in the following ways:
  • the picture effect indication value in the picture effect indication array is A
  • the basic texture map is texture B.
  • the method of determining the value of each pixel to be rendered in the picture to be rendered is introduced: use the value of the B channel in A as the color strength Weight Ab, weighting the pixel value Brgb at the corresponding position in the texture B to obtain the weighted pixel value Ab*Brgb; use the G channel value in A as the highlight increment value Ag, and perform the corresponding position in the texture B on the pixel value Brgb Incremental processing, the incremental pixel value Brgb+Ag is obtained; further, the R channel value in A is used as the transparency weight Ar, and the corresponding weighted pixel value and incremental pixel value are weighted and averaged based on formula (2) to obtain the Rendered pixel value:
  • the terminal device may also determine the pixel value to be rendered in other ways. This application does not determine the value of the pixel to be rendered. There are no restrictions on how the pixel value is implemented.
  • step 203 when the image rendering method provided by the embodiment of the application is applied to a scene that renders a game screen, in addition to rendering the basic image to obtain the basic texture map, it is also necessary to render the image of each object in the screen to be rendered to obtain the object It also needs to color blend the basic texture map obtained by rendering with the object map to obtain the scene object fusion map.
  • the terminal device may specifically implement image rendering of the picture to be rendered in the following manner:
  • the B channel value in the screen effect indicator value is used as the color strength weight, and the pixel values in the scene object fusion map are weighted to obtain the corresponding weighted pixel value; the G channel value in the screen effect indicator value is used as the highlight increment value , Perform incremental processing on each pixel value in the basic texture map to obtain the corresponding incremental pixel value; use the R channel value in the screen effect indicator value as the transparency weight, and fuse each incremental pixel value in the basic texture map with the scene object Each weighted pixel value in the texture is subjected to weighted average processing to obtain the pixel value to be rendered; finally, the picture is rendered based on the pixel value to be rendered.
  • the picture effect indication value in the picture effect indication array is A
  • the basic texture map is texture B
  • the scene object fusion texture is texture D.
  • the method for determining the value of each pixel to be rendered in the picture to be rendered is described in detail:
  • Use The value of the B channel in A is used as the color strength weight Ab of the scene object layer (texture D), and the pixel value Drgb at the corresponding position in the texture D is weighted to obtain the weighted pixel value Ab*Drgb; use the G channel value in A as The highlight increment value Ag of the scene occlusion layer (texture B), the pixel value Brgb at the corresponding position in the texture B is incrementally processed to obtain the incremental pixel value Brgb+Ag; further, the R channel value in A is used as the scene occlusion layer
  • the transparency weight Ar is based on the formula (3), and the corresponding weighted pixel value and incremental pixel value are weighted and averaged to obtain the pixel value to be rendered:
  • Drgb Brgb*(1-C ⁇ )+Crgb*C ⁇ , which is brought into equation (3) to obtain the final expression of the pixel value to be rendered as shown in equation (4) Show:
  • the terminal device may also determine the pixel value to be rendered in other ways. This application does not determine the value of the pixel to be rendered. There are no restrictions on how the pixel value is implemented.
  • the above image rendering method combines the effects of shadows, highlights, and occlusions in the image, and uses a set of data (ie, the image effect indicator array) to represent the final color effect value of each pixel position in the image; when performing image rendering for the image to be rendered , Use the screen effect indicator array to adjust the pixel values in the basic texture map.
  • the basic texture map is obtained by rendering the specified basic image in the to-be-rendered screen to a rendered texture object that matches the screen size of the device, and then based on the adjustment The subsequent pixel values complete the image rendering of the picture to be rendered.
  • the following takes the image rendering method applied to a scene in which a game screen is rendered as an example to give an overall introduction to the image rendering method.
  • the server can generate a screen effect indication image A through art production in advance.
  • the screen effect indication image A carries a screen effect display array corresponding to the game scene map.
  • the screen effect indication image A can be set to match the game
  • the size of the scene map is the same.
  • determine the area that needs to be occluded in the scene map and set the R channel value in the screen effect indicator value of the corresponding position to a value greater than 0.
  • the G channel value determines the area in the scene map that will be covered by shadows, and set the screen effect of the corresponding position
  • the value of the B channel is set to a value greater than 0, and the darker the shadow, the greater the value of the B channel; then, the image carrying the screen effect display array is reduced to a suitable size, so that the screen effect indicates image A.
  • the terminal device After the terminal device detects that the user triggers a specified operation during the use of the game application, it sends an image acquisition request to the server; based on the image acquisition request, the server correspondingly determines the game screen to be rendered by the terminal device, and acquires the scene in the game screen
  • the map, the object image, and the screen effect indication image A corresponding to the scene map are returned to the terminal device.
  • the terminal device After the terminal device receives the scene map, the object image, and the screen effect indication image A corresponding to the scene map, it renders the scene map to the Rendertexture of the same size as its own screen to obtain the basic texture map B; The object image is rendered. After the rendering of all the object images is completed, an object texture C with the same size as the device screen is obtained.
  • the terminal device When the final image is rendered, the terminal device first mixes the basic texture map B and the object map C in the fragment shader (Fragment Shader) to obtain the scene physical fusion map D; that is, the alpha channel Ca of the object map C is used as the weight.
  • the basic texture map B and the object map C are weighted and averaged, and the scene physical fusion map D is obtained as Brgb*(1-Ca)+Crgb*Ca.
  • the value of the B channel in the picture effect indication image A is used as the color strength weight Ab of the scene object layer, and perform weighting processing on each pixel value in the scene physical fusion map D to obtain the corresponding weighted pixel value Ab*Drgb; use the picture
  • the effect indicates that the G channel value in image A is used as the highlight increment value Ag of the scene occlusion layer, and each pixel value in the basic texture map B is incrementally processed to obtain the corresponding incremental pixel value Brgb+Ag; further, use the screen effect indicator
  • the R channel value in image A is used as the transparency weight Ar of the scene occlusion layer, and the incremental pixel value Brgb+Ag and the weighted pixel value Ab*Drgb are weighted and averaged to obtain the pixel value to be rendered Ar*(Brgb+Ag)+( 1-Ar)*Ab*Drgb.
  • the pixel values to be rendered are used to render to the FrameBuffer to complete the rendering of the game screen, as shown in FIG
  • image rendering method provided by the embodiments of this application can be used to render game screens, can also be used to render animation screens, and can also be used for other image rendering scenes that require additional display effects, and will not be implemented for this application here.
  • the application scenarios of the image rendering methods provided in the examples are subject to any restrictions.
  • the object in the game screen needs to be drawn once, which is divided into
  • the scene map of N blocks needs to be drawn N times
  • the occlusion layer divided into N blocks needs to be drawn N times
  • the highlight layer divided into N blocks needs to be drawn N times
  • the shadow layer divided into N blocks needs to be drawn N times. It needs to be drawn N times. In this way, 4N+1 times of drawing need to be completed when rendering the game screen, a total of about 4 full-screen size pixels are output, and 4 full-screen size images are loaded.
  • an object in the game screen needs to be drawn once, and the occlusion layer, shadow layer, and highlight layer do not need to be drawn separately, and only one screen is used.
  • the effect indication image combines the above display effect with the object and scene map through one drawing to get the final display effect.
  • the entire image rendering process only needs N+2 draws, outputting about 1 full-screen size pixel, and loading 1 full-screen size image , 1 screen effect indicator image and 1 object image, the image rendering efficiency is significantly improved.
  • the present application also provides a corresponding image rendering device, so that the foregoing image rendering method can be applied and realized in practice.
  • FIG. 5 is a schematic structural diagram of an image rendering device 500 corresponding to the image rendering method shown in FIG. 2 above, and the image rendering device 500 includes:
  • the first obtaining module 501 is configured to obtain a specified basic image in the picture to be rendered
  • the second obtaining module 502 is configured to obtain a picture effect indication array corresponding to the basic image, and the picture effect indication array includes picture effect indication values corresponding to pixel positions of the basic image;
  • the first rendering module 503 is configured to render the basic image onto a rendered texture object matching the screen size of the device to obtain a basic texture map;
  • the second rendering module 504 is configured to perform color rendering on the basic texture map according to the picture effect indication array.
  • the first obtaining module 501 is specifically configured to:
  • the pixel value of each pixel position is read from the picture effect indication image, and the picture effect indication array corresponding to the picture effect indication image is generated according to the pixel value of each pixel position.
  • the picture effect indication value includes: a red channel value indicating transparency, a green channel value indicating highlight brightness, and a blue channel value indicating shade;
  • the second rendering module 504 is specifically configured to:
  • weighted average processing is performed on each incremental pixel value in the basic texture map and each weighted pixel value in the basic texture map to obtain the pixel to be rendered value;
  • the first obtaining module 501 is specifically configured to: obtain a scene map specified in the to-be-rendered screen of the game application as a basic image; see FIG. 6, FIG. 6
  • the third acquisition module 601 is configured to acquire an object image, and use a screen post-processing method to render the object image to obtain an object map;
  • the image blending module 602 is used for color blending the basic texture map and the object map to obtain a scene object fusion map;
  • the second rendering module 504 is specifically configured to perform color fusion on the scene object fusion map and the basic texture map according to the screen effect indication array.
  • the picture effect indication value includes a red channel value indicating transparency, a green channel value indicating highlight brightness, and a blue channel value indicating shade;
  • the image blending module 602 is specifically configured to use the alpha channel of the object map as a weight to perform weighted average processing on the object map and the basic texture map to obtain a scene object fusion map;
  • the second rendering module 504 is specifically configured to:
  • weighted average processing is performed on each incremental pixel value in the basic texture map and each weighted pixel value in the scene object fusion map to obtain the to-be-rendered Pixel values;
  • FIG. 7 is a schematic structural diagram of another image rendering device provided by an embodiment of the application; as shown in FIG. 7, the device It also includes: the device also includes:
  • An image division module 701, configured to divide the basic image into N basic image blocks
  • the first rendering module 503 is specifically configured to:
  • the target basic image is rendered in blocks to a rendered texture object matching the screen size of the device to obtain a basic texture map.
  • the above-mentioned image rendering device integrates the effects of shadows, highlights, and occlusions in the image, and uses a set of data (ie, the image effect indicator array) to represent the final color effect value of each pixel position in the image; when performing image rendering for the image to be rendered , Use the screen effect indicator array to adjust the pixel values in the basic texture map.
  • the basic texture map is obtained by rendering the specified basic image in the to-be-rendered screen to a rendered texture object that matches the screen size of the device, and then based on the adjustment The subsequent pixel values complete the image rendering of the picture to be rendered.
  • the embodiment of the present application also provides a terminal device for image rendering.
  • the terminal device for image rendering provided by the embodiment of the present application will be introduced from the perspective of hardware materialization.
  • FIG. 8 is a schematic structural diagram of a terminal device according to an embodiment of the application.
  • the terminal can be any terminal device including a computer, a tablet computer, a personal digital assistant (English full name: Personal Digital Assistant, English abbreviation: PDA), etc. Take the terminal as a mobile phone as an example:
  • FIG. 8 shows a block diagram of a part of the structure of a mobile phone related to a terminal provided in an embodiment of the present application.
  • the mobile phone includes: radio frequency (English full name: Radio Frequency, English abbreviation: RF) circuit 810, memory 820, input unit 830 (including touch panel 831 and other input devices 832), display 840 (including display panel 841), sensor 850, audio circuit 860 (including speaker 861 and microphone 862), wireless fidelity (full English name: wireless fidelity, English abbreviation: WiFi) module 870, central processing unit 880, graphics processor 890, and power supply 8100, etc. part.
  • RF Radio Frequency
  • memory 820 includes: input unit 830 (including touch panel 831 and other input devices 832), display 840 (including display panel 841), sensor 850, audio circuit 860 (including speaker 861 and microphone 862), wireless fidelity (full English name: wireless fidelity, English abbreviation: WiFi) module 870, central processing unit 880, graphics processor
  • the memory 820 may be used to store software programs and modules.
  • the central processing unit 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820.
  • the memory 820 may mainly include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of the computer (such as audio data, phone book, etc.), etc.
  • the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the central processing unit 880 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and/or modules stored in the memory 820, and calling data stored in the memory 820, Perform various functions of the computer and process data to monitor the mobile phone as a whole.
  • the central processing unit 880 may include one or more processing units; preferably, the central processing unit 880 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, user interfaces, and applications.
  • the modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 880.
  • the central processing unit 880 when image rendering is required, the central processing unit 880 will control the graphics processor 890 to perform the following operations:
  • the picture effect indication array including picture effect indication values corresponding to pixel positions of the basic image
  • the graphics processor 890 is further configured to execute steps of any implementation manner of the image rendering method provided in the embodiments of the present application. Furthermore, under the control of the graphics processor 890, an image screen is displayed on the display 840.
  • the embodiments of the present application also provide a computer-readable storage medium for storing a computer program, and the computer program is used to execute any one of the implementation manners of an image rendering method described in each of the foregoing embodiments.
  • the embodiments of the present application also provide a computer program product including instructions, which when run on a computer, cause the computer to execute any one of the implementation modes of the image rendering method described in the foregoing embodiments.
  • the aforementioned terminal or server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be communicated by the multiple nodes through a network Distributed system formed by form connection.
  • nodes can form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing equipment, such as servers, terminals, and other electronic devices, can become a node in the blockchain system by joining the peer-to-peer network.
  • P2P peer-to-peer
  • Peer To Peer Peer To Peer
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • 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.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (English full name: Read-Only Memory, English abbreviation: ROM), random access memory (English full name: Random Access Memory, English abbreviation: RAM), magnetic Various media that can store program codes, such as discs or optical discs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本申请实施例公开了一种图像渲染方法、装置及相关设备,其中,该方法包括:获取待渲染画面中指定的基础图像;获取与该基础图像对应的画面效果指示数组,该画面效果指示数组中包括基础图像的像素位置对应的画面效果指示值;将基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上得到基础纹理贴图;根据画面效果指示数组对基础纹理贴图进行颜色混合渲染。该方法能够有效地减少图像渲染过程中的绘制次数,提高图像渲染效率。

Description

一种图像渲染方法、装置、设备及存储介质
本申请要求于2019年09月11日提交中国专利局、申请号为201910859321.X、申请名称为“一种图像渲染方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理领域,尤其涉及图像渲染技术。
背景技术
目前很多应用都会以图像形式为用户提供相应的交互服务,而在以图像形式为用户提供交互服务时,为了吸引用户关注画面、提高用户沉浸感,往往通过叠加多种实现不同画面效果的贴图的方式进行图像渲染。
一般情况下,针对待绘制的场景会指定一张基础图像,将这张基础图像进行切分得到N个基础图像分块,根据视口大小绘制对应的目标基础图像分块,同样的,对每种具有其他画面效果的图像即效果贴图也分别进行切分得到N个对应的效果贴图分块,根据视口大小将对应的效果贴图分块分别叠加绘制在目标基础图像上以实现最终的效果。
目前这种图像渲染方法针对基础图像和每种效果图像都需要单独分块绘制,绘制次数随着效果贴图的个数以及分块个数的增加成线性增长,而绘制次数越多对处理器的资源占用时间就会越长,从而会影响处理器的处理性能,最为明显的是会直接导致图像渲染效率降低,以图像交互为基础的应用的响应速率就会相应地降低。
发明内容
本申请实施例提供了一种图像渲染方法、装置、设备及存储介质,能够有效地减少图像渲染过程中的绘制次数,提高图像渲染效率。
有鉴于此,本申请第一方面提供了一种图像渲染方法,包括:
获取待渲染画面中指定的基础图像;
获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
本申请第二方面提供一种图像渲染装置,包括:
第一获取模块,用于获取待渲染画面中指定的基础图像;
第二获取模块,用于获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
第一渲染模块,用于将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
第二渲染模块,用于根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
本申请第三方面提供一种终端设备,包括:
中央处理器、图形处理器、存储器以及显示器;
其中,所述存储器用于存储计算机程序;
所述中央处理器用于执行所述计算机程序,并在需要画面渲染时控制所述图形处理器执行计算机程序以实现第一方面所述的图像渲染方法;
所述显示器用于在所述图形处理器的控制下显示图像画面。
本申请第四方面提供一种计算机可读存储介质,所述计算机可读存储介质用于存储程序代码,所述程序代码用于执行上述第一方面所述的图像渲染方法。
本申请第五方面提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行上述第一方面所述的图像渲染方法。
从以上技术方案可以看出,本申请实施例具有以下优点:
本申请实施例提供了一种图像渲染方法,该方法综合考虑了图像中的阴影、高光、遮挡等效果,针对图像中各像素位置相应地确定能够表示其最终颜色显示效果的画面效果指示值,并利用各像素位置各自对应的画面效果指示值组成画面效果指示数组;在对图像进行渲染时,获取待渲染画面中指定的基础图像以及该基础图像对应的画面效果指示数组,将基础图像渲染至与设备屏幕尺寸匹配的渲染纹理对象上得到基础纹理贴图后,利用所获取的画面效果指示数组对该基础纹理贴图中的像素值进行调整,进而基于调整后的像素值完成图像渲染。相比相关技术中在基础纹理贴图的基础上叠加渲染各个效果图的图像渲染方法,本申请实施例提供的图像渲染方法利用画面效果指示数组对基础纹理贴图中的像素值进行调整,实现画面显示效果的添加,省略了对各个效果图进行渲染的过程,也相应地节省了图像渲染过程中所需耗费的计算资源,有效地提升了图像渲染效率。
附图说明
图1为本申请实施例提供的图像渲染方法的应用场景示意图;
图2为本申请实施例提供的图像渲染方法的流程示意图;
图3为本申请实施例提供的图像渲染方法的原理示意图;
图4为采用本申请实施例提供的图像渲染方法渲染得到的游戏画面;
图5为本申请实施例提供的一种图像渲染装置的结构示意图;
图6为本申请实施例提供的另一种图像渲染装置的结构示意图;
图7为本申请实施例提供的又一种图像渲染装置的结构示意图;
图8为本申请实施例提供的一种终端设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
采用相关技术中的图像渲染方法进行图像渲染时,通常需要在画面背景图的基础上叠加渲染阴影、高光、遮挡等效果贴图,如此多次叠加渲染各种效果贴图将耗费大量的计算资源,导致图像渲染效率降低,并且多次渲染得到的效果贴图还会在一定程度上造成存储空间的浪费。
针对上述技术问题,本申请实施例提供了一种图像渲染方法,该方法将图像中的阴影、高光、遮挡等效果综合起来,以一组数据(即画面效果指示数组)来表征图像中各像素位置最终的颜色效果值;针对待渲染画面进行图像渲染时,利用该画面效果指示数组对基础纹理贴图中的像素值进行调整,该基础纹理贴图是将待渲染画面中指定的基础图像渲染至与设备屏幕尺寸匹配的渲染纹理对象上得到的,进而基于调整后的像素值完成对于待渲染画面的图像渲染。如此,无需多次渲染多种效果贴图,节省了图像渲染过程所需耗费的计算资源,有效地提升了图像渲染效率;并且,由于省略了多次独立渲染各效果贴图的过程,终端设备也相应地无需存储每次渲染得到的效果贴图,一定程度上节省了存储空间。
应理解,本申请实施例提供的图像渲染方法可以应用于具备图像处理功能的终端设备,如智能手机、计算机、个人数字助理(Personal Digital Assitant,PDA)、平板电脑等。
为了便于理解本申请实施例提供的技术方案,下面对本申请实施例提供的图像渲染方法适用的应用场景进行介绍。
参见图1,图1为本申请实施例提供的图像渲染方法的应用场景示意图。如图1所示,该应用场景包括终端设备110和服务器120,终端设备110与服务器120通过网络进行通信;服务器120用于为终端设备110提供待渲染画面中指定的基础图像以及该基础图像对应的画面效果指示数组;终端设备 110用于执行本申请实施例提供的图像渲染方法,基于服务器110提供的基础图像及其对应的画面效果指示数组,在其屏幕上渲染显示待渲染画面。
具体的,终端设备110可以在检测到用户触发相关操作的情况下,向服务器120发送图像获取请求。服务器120接收到该图像获取请求后,基于该图像获取请求确定终端设备110当前所要渲染的待渲染画面,并确定该待渲染画面中指定的基础图像以及该基础图像对应的画面效果指示数组,该画面效果指示数组中包括有基础图像的像素位置对应的画面效果指示值,进而,将所确定的基础图像以及该基础图像对应的画面效果指示数组发送至终端设备110。
终端设备110接收到服务器120发送基础图像及其对应的画面效果指示数组后,将该基础图像渲染至与自身屏幕尺寸相匹配的渲染纹理对象上,得到基础纹理贴图;进而,利用所接收的画面效果指示数组中的画面效果指示值,对基础纹理贴图中的像素值进行相应地调整,以得到与待渲染画面最终的颜色显示效果相对应的像素值;最终,基于调整后的像素值完成图像渲染,获得叠加显示有阴影、高光、遮挡等显示效果的图像。
如此,省略了对于各效果贴图的渲染过程,节省了图像渲染过程中所需耗费的计算资源,大大提升了图像渲染效率。
应理解,图1所示的应用场景仅为示例,在实际应用中,终端设备自身可以存储待渲染画面中指定的基础图像及其对应的画面效果指示数组,并直接基于自身存储的基础图像及其对应的画面效果指示数组完成图像渲染,无需与服务器进行通信。在此不对本申请实施例提供的图像渲染方法所适用的应用场景做任何限定。
下面通过实施例对本申请提供的图像渲染方法进行介绍。
参见图2,图2为本申请实施例提供的图像渲染方法的流程示意图。如图2所示,该图像渲染方法包括以下步骤:
步骤201:获取待渲染画面中指定的基础图像。
在实际应用中,终端设备检测到用户触发用于控制渲染显示待渲染画面的指定操作后,将相应地获取待渲染画面中指定的基础图像。
需要说明的是,上述基础图像是指待渲染显示画面中固定的画面背景图像。在不同的应用场景下,可以相应地将不同类型的背景图像作为基础图像,例如,在渲染游戏画面的场景下,可以将待渲染的游戏画面中指定的场景地图作为基础图像;本申请在此不对基础图像的类型做任何限定。
在一种可能的实现方式中,终端设备可以与服务器进行通信,从服务器处获取待渲染画面中指定的基础图像。具体的,终端设备检测到用户触发指定操作后,可以相应地向服务器发送图像获取请求;服务器接收到该图像后续请求后,基于该图像获取请求确定终端设备当前所要渲染的待渲染画面, 并将该待渲染画面中指定的基础图像返回至终端设备。
以本申请实施例提供的图像渲染方法应用于游戏场景为例,终端设备检测到用户触发游戏界面跳转操作时,相应地向服务器发送图像获取请求;服务器接收到该图像获取请求后,基于该图像获取请求确定当前所要渲染的待渲染的游戏界面(即触发游戏界面跳转操作后应显示的游戏界面),获取该游戏界面中指定的场景地图作为基础图像,进而向终端设备返回该基础图像。
在另一种可能的实现方式中,终端设备可以从自身存储的数据中,调取当前待渲染画面中指定的基础图像。具体的,终端设备可以利用自身的内存存储若干幅画面对应的基础图像,当终端设备检测到用户触发显示某幅画面时,终端设备相应地从自身的内存中调取该幅画面中指定的基础图像。
仍以本申请实施例提供的图像渲染方法应用于游戏场景为例,在终端设备已缓存有当前待渲染显示的游戏界面对应的基础图像的情况下,终端设备检测到用户触发显示该游戏界面的操作时,可以直接从自身的缓存中调取该游戏界面中指定的基础图像。
应理解,上述获取基础图像的方式仅为示例,在实际应用中,终端设备还可以采用其他方式获取基础图像,在此不对终端设备获取基础图像的方式做任何限定。
步骤202:获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值。
终端设备检测到用户触发用于控制渲染显示该待渲染画面的指定操作后,除了需要获取该待渲染画面中指定的基础图像外,还需要获取与该基础图像对应的画面效果指示数组。该画面效果指示数组中包括有基础图像的像素位置对应的画面效果指示值。
需要说明的是,画面效果指示数组中的画面效果指示值是综合考虑待渲染画面中阴影、高光、遮挡等显示效果确定的。以画面效果指示值包括指示透明度的红色(red,R)通道数值、指示高光亮度的绿色(green,G)通道数值以及指示阴影度的蓝色(blue,B)通道数值为例,对于待渲染画面中需要遮挡的区域,可以将对应位置的画面效果指示值中的R通道数值设置为大于0的值,遮挡物透明度越低R通道数值越小;对于待渲染画面中需要高光显示的区域,可以将对应位置的画面效果指示值中的G通道数值设置为大于0的值,高光亮度越高G通道数值越大;对于待渲染画面中会被阴影覆盖的区域,可以将对应位置的画面效果指示值中的B通道数值设置为大于0的值,阴影越暗B通道数值越大。
在一种可能的实现方式中,终端设备可以与服务器进行通信,从服务器处获取基础图像对应的画面效果指示数组。具体的,终端设备检测到用户触发指定操作后,可以向服务器发送图像获取请求,以请求服务器同时为其提 供待渲染画面中指定的基础图像以及该基础图像对应的画面效果指示数组;进而,接收服务器响应于该图像获取请求返回的基础图像以及基础图像对应的画面效果指示数组。
当然,在实际应用中,终端设备也可以先从服务器处获取基础图像,再基于该基础图像向服务器发送画面效果指示数组获取请求,以请求服务器为其提供该基础图像对应的画面效果指示数组;进而,接收服务器响应于该画面效果指示数组获取请求返回的画面效果指示数组。
在另一种可能的实现方式中,终端设备可以从自身存储的数据中,调取基础图像对应的画面效果指示数组。具体的,终端设备可以利用自身的内存存储多幅基础图像及其对应的画面效果指示数组,当终端设备检测到用户触发指定操作后,终端设备可以从自身的内存中同时调取基础图像及其对应的画面效果指示数组。
当然,在实际应用中,终端设备也可以先从内存中调取待渲染画面中指定的基础图像,再基于基础图像与画面效果指示数组之间的对应关系,从其内存中调取该基础图像对应的画面效果指示数组。
应理解,上述获取基础图像对应的画面效果指示数组的方式仅为示例,在实际应用中,终端设备还可以采用其他方式获取画面效果指示数组,在此不对终端设备获取画面效果指示数组的方式做任何限定。
可选的,为了进一步提升图像渲染效率,终端设备可以获取图像形式的画面效果指示数组,以使图形处理器(Graphics Processing Unit,GPU)可以同时对基础图像以及该图像形式的画面效果指示数组进行处理。具体的,终端设备获取画面效果指示图像,该画面效果指示图像承载有画面效果指示数组;进而,从该画面效果指示图像中读取各像素位置的像素值,根据各像素位置的像素值生成画面效果指示图像对应的画面效果指示数组。即,所述画面效果指示图像对应的画面效果指示数组包括从画面效果指示图像中读取的各个像素位置的像素值。
具体实现时,可以预先通过美术制作生成画面效果指示图像,并且可以将该画面效果指示图像的大小设置为与基础图像的大小相同,例如,在游戏场景中,可以将画面效果指示图像的大小设置为游戏场景地图的大小。然后,按照上文介绍的设置画面效果指示值的方式,设置该画面效果指示图像中的像素值,即对于需要遮挡的区域设置其对应的像素值中R通道数值大于0,对于需要高光显示的区域设置其对应的像素值中G通道数值大于0,对于会被阴影覆盖的区域设置其对应的像素值中B通道数值大于0。进而,再将该画面效果指示图缩小至合适的大小,如1024*1024。
然后,从该画面效果指示图像中读取各个像素位置对应的像素值,即读取各个像素位置处像素值中的R通道数值、G通道数值和B通道数值,然后,根据各个像素位置的分布情况,利用所读取的各个像素值组成该画面效 果指示图像对应的画面效果指示数组。
步骤203:将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图。
终端设备获取到基础图像后,不直接将该基础图像渲染至帧缓存(FrameBuffer),而是将该基础图像渲染至与自身屏幕尺寸匹配的渲染纹理对象如Rendertexture,该渲染纹理对象属于帧缓存对象(Frame Buffer Object,FBO)中的一种,由此渲染得到基础纹理贴图,即得到显示有基础图像的基础纹理贴图;在游戏场景中,该基础纹理贴图即为显示有游戏场景地图的贴图。
需要说明的是,在渲染游戏画面的应用场景下,除了需要将场景地图渲染至与设备屏幕匹配的渲染纹理对象上得到基础纹理贴图外,通常还需要获取物体图像,并采用屏幕后处理方式对所获取的物体图像进行渲染得到物体贴图。
应理解,上述物体图像具体可以为游戏画面中由玩家操控的游戏角色,也可以为游戏画面中系统分配设置的游戏角色,在此不对该物体图像所对应的对象做具体限定。终端设备具体获取该物体图像的方式,与上文中获取基础图像以及获取画面效果指示数组的方式相类似,可以通过与服务器进行通信来获取物体图像,或者也可以从自身缓存的数据中获取物体图像,在此也不对获取该物体图像的方式做任何限定。此外,终端设备所获取的物体图像可以为一个,也可以为多个,在此也不对终端设备获取的物体图像的数量做任何限定。
终端设备获取到物体图像后,可以采用屏幕后处理方式对所获取的物体图像进行渲染,完成对于待渲染画面中全部物体图像的渲染后,得到与设备屏幕尺寸匹配的包含有全部物体的物体贴图。
更进一步地,终端设备还需要将渲染基础图像得到的基础纹理贴图,与渲染物体图像得到的物体贴图进行颜色混合,以得到场景物体融合贴图。具体的,终端设备可以将物体贴图的阿尔法通道(Alpha Channel)作为权值,利用该权值对物体贴图和基础纹理贴图进行加权平均处理,得到场景物体融合贴图。
假设基础纹理贴图为贴图B,物体贴图为贴图C,对二者进行颜色混合得到的场景物体融合贴图为贴图D;终端设备具体对贴图B和贴图C进行颜色融合时,可以采用式(1)计算得到贴图D中各像素值:
Drgb=Brgb*(1-C α)+Crgb*C α     (1)
其中,Brgb为贴图B中的像素值,Crgb为贴图C中的像素值,Drgb为贴图D中的像素值,C α为贴图C的阿尔法通道值。
需要说明的是,为了避免每次渲染的图像面积过大,减少每次渲染过程耗费的计算资源,可以将待渲染画面中指定的基础图像分成N(N为大于或 等于1的整数)个基础图像分块;进而,在渲染基础图像渲染得到基础纹理贴图时,可以从N个基础图像分块中选择属于当前视口范围内的目标基础图像分块,将所选择的目标基础图像分块渲染至与设备屏幕尺寸匹配的渲染纹理对象,得到基础纹理贴图。
具体的,终端设备可以在其获取到基础图像后,按照预设的图像划分规则将该基础图像划分为N个基础图像分块。渲染基础纹理贴图时,终端设备可以先确定自身当前的视口范围,进而从已划分出的N个基础图像分块中选择处于该视口范围内的基础图像分块,作为目标基础图像分块,进而将所选择的目标基础图像分块渲染至设备屏幕尺寸匹配的渲染纹理对象,得到基础纹理贴图。
应理解,终端设备划分基础图像得到的N个基础图像分块大小可以相同,也可以不同,在此不对终端设备所采取的图像划分规则做任何限定。
步骤204:根据所述画面效果指示数组对所述基础纹理贴图进行颜色混合渲染。
终端设备渲染得到基础纹理贴图后,可以利用其在步骤202中获取的画面效果指示数组中的画面效果指示值,对基础纹理贴图中各像素值相应地进行调整,进而基于调整后像素值完成对于待渲染画面的渲染,从而在设备屏幕上显示承载有阴影、高光、遮挡等显示效果的画面。
在画面效果指示值中包括有指示透明度的R通道数值、指示高光亮度的G通道数值以及指示阴影度的B通道数值的情况下,终端设备具体可以通过以下方式实现对于待渲染画面的渲染:
将画面效果指示值中的B通道数值作为作为颜色强弱权值,对基础纹理贴图中各像素值进行加权得到对应的加权像素值;将画面效果指示值中的G通道数值作为高光增量值,对基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;将画面效果指示值中的R通道数值作为透明度权值,对基础纹理贴图中各增量像素值和基础纹理贴图中各加权像素值进行加权平均得到待渲染的像素值;最终,基于待渲染的像素值进行画面渲染。
下面假设画面效果指示数组中的画面效果指示值为A,基础纹理贴图为贴图B,对确定待渲染画面中每个待渲染的像素值的方式进行介绍:使用A中B通道数值作为颜色强弱权值Ab,对贴图B中相应位置的像素值Brgb进行加权处理,得到加权像素值Ab*Brgb;使用A中G通道数值作为高光增量值Ag,对贴图B中相应位置的像素值Brgb进行增量处理,得到增量像素值Brgb+Ag;进而,利用A中R通道数值作为透明度权值Ar,基于式(2)对相应的加权像素值和增量像素值进行加权平均处理,得到待渲染的像素值:
(Brgb+Ag)*Ar+Brgb*Ab*(1-Ar)      (2)
应理解,在实际应用中,终端设备除了可以基于上述方式确定待渲染画 面中各待渲染的像素值外,还可以通过其他方式确定各待渲染的像素值,本申请在此不对确定待渲染的像素值的实现方式做任何限定。
正如步骤203所介绍的,当本申请实施例提供的图像渲染方法应用于渲染游戏画面的场景中时,除了需要渲染基础图像得到基础纹理贴图外,还需要渲染待渲染画面中各物体图像得到物体贴图,并且需要将渲染得到的基础纹理贴图与物体贴图进行颜色混合得到场景物体融合贴图。在该种情况下,对待渲染画面进行图像渲染时,需要根据画面效果指示数组对场景物体融合贴图和基础纹理贴图进行颜色融合,以便基于颜色融合后的像素值完成对于待渲染画面的图像渲染。
具体的,在画面效果指示值包括指示透明度的R通道数值、指示高光亮度的G通道数值以及指示阴影度的B通道数值的情况下,终端设备具体可以通过以下方式实现对待渲染画面的图像渲染:
将画面效果指示值中的B通道数值作为颜色强弱权值,对场景物体融合贴图中各像素值进行加权得到对应的加权像素值;将画面效果指示值中的G通道数值作为高光增量值,对基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;将画面效果指示值中的R通道数值作为透明度权值,对基础纹理贴图中各增量像素值和场景物体融合贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;最终,基于待渲染的像素值进行画面渲染。
下面假设画面效果指示数组中的画面效果指示值为A,基础纹理贴图为贴图B,场景物体融合贴图为贴图D,对确定待渲染画面中每个待渲染的像素值的方式进行详细介绍:使用A中B通道数值作为场景物体层(贴图D)的颜色强弱权值Ab,对贴图D中相应位置的像素值Drgb进行加权处理,得到加权像素值Ab*Drgb;使用A中G通道数值作为场景遮挡层(贴图B)的高光增量值Ag,对贴图B中相应位置的像素值Brgb进行增量处理,得到增量像素值Brgb+Ag;进而,利用A中R通道数值作为场景遮挡层的透明度权值Ar,基于式(3)对相应的加权像素值和增量像素值进行加权平均得到待渲染的像素值:
(Brgb+Ag)*Ar+Drgb*Ab*(1-Ar)       (3)
根据步骤203中的相关介绍内容可知Drgb=Brgb*(1-C α)+Crgb*C α,将其带入式(3)中得到待渲染的像素值的最终表现形式如式(4)所示:
(Brgb+Ag)*Ar+(Brgb*(1-C α)+Crgb*C α)*Ab*(1-Ar)  (4)
应理解,在实际应用中,终端设备除了可以基于上述方式确定待渲染画面中各待渲染的像素值外,还可以通过其他方式确定各待渲染的像素值,本申请在此不对确定待渲染的像素值的实现方式做任何限定。
上述图像渲染方法将图像中的阴影、高光、遮挡等效果综合起来,以一组数据(即画面效果指示数组)来表征图像中各像素位置最终的颜色效果值; 针对待渲染画面进行图像渲染时,利用该画面效果指示数组对基础纹理贴图中的像素值进行调整,该基础纹理贴图是将待渲染画面中指定的基础图像渲染至与设备屏幕尺寸匹配的渲染纹理对象上得到的,进而基于调整后的像素值完成对于待渲染画面的图像渲染。如此,无需多次渲染多种效果贴图,节省了图像渲染过程所需耗费的计算资源,有效地提升了图像渲染效率;并且,由于省略了多次独立渲染各效果贴图的过程,终端设备也相应地无需存储每次渲染得到的效果贴图,一定程度上节省了存储空间。
为了便于进一步理解本申请实施例提供的图像渲染方法,下面以该图像渲染方法应用于渲染游戏画面的场景为例,对该图像渲染方法进行整体性介绍。
参见图3,图3为本申请实施例提供的图像渲染方法的原理示意图。如图3所示,服务器可以预先通过美术制作生成画面效果指示图像A,该画面效果指示图像A中承载有游戏场景地图对应的画面效果显示数组,该画面效果指示图像A可以被设置为与游戏场景地图的大小相同。然后,确定该场景地图中需要遮挡的区域,将相应位置的画面效果指示值中R通道数值设置为大于0的值,遮挡物透明度越低R通道数值越小;确定该场景地图中需要高光显示的区域,将相应位置的画面效果指示值中G通道数值设置为大于0的值,高光亮度越高G通道数值越大;确定该场景地图中会被阴影覆盖的区域,将相应位置的画面效果指示值中B通道数值设置为大于0的值,阴影越暗B通道数值越大;接着,再将该承载有画面效果显示数组的图像缩小至合适大小,如此画面效果指示图像A。
终端设备检测到用户在使用游戏应用的过程中触发指定操作后,向服务器发送图像获取请求;服务器基于该图像获取请求,相应地确定终端设备所要渲染的游戏画面,并获取该游戏画面中的场景地图、物体图像以及该场景地图对应的画面效果指示图像A,返回至终端设备。
终端设备接收到场景地图、物体图像以及该场景地图对应的画面效果指示图像A后,将场景地图渲染至与自身屏幕大小相同的Rendertexture上得到基础纹理贴图B;采用屏幕后处理方式对所获取的物体图像进行渲染,待完成对所有物体图像的渲染后,得到与设备屏幕大小相同的物体贴图C。
最终进行图像渲染时,终端设备先在片段着色器(Fragment Shader)中对基础纹理贴图B和物体贴图C进行颜色混合,得到场景物理融合贴图D;即以物体贴图C的alpha通道Ca为权值对基础纹理贴图B和物体贴图C进行加权平均,得到场景物理融合贴图D为Brgb*(1-Ca)+Crgb*Ca。然后,使用画面效果指示图像A中B通道数值作为场景物体层的颜色强弱权值Ab,对场景物理融合贴图D中各像素值进行加权处理,得到对应的加权像素值Ab*Drgb;使用画面效果指示图像A中G通道数值作为场景遮挡层的高光 增量值Ag,对基础纹理贴图B中各像素值进行增量处理,得到对应的增量像素值Brgb+Ag;进而,利用画面效果指示图像A中R通道数值作为场景遮挡层的透明度权值Ar,对增量像素值Brgb+Ag和加权像素值Ab*Drgb进行加权平均,得到待渲染的像素值Ar*(Brgb+Ag)+(1-Ar)*Ab*Drgb。利用该待渲染的像素值渲染至FrameBuffer,如此完成对于游戏画面的渲染,如图4所示,为采用上述图像渲染方法渲染得到的游戏画面示意图。
应理解,本申请实施例提供的图像渲染方法除了可以用于渲染游戏画面外,也可以用于渲染动画画面,还可以用于其他需要额外增加显示效果的图像渲染场景,在此不对本申请实施例提供的图像渲染方法所适用的应用场景做任何限定。
假设将游戏场景地图划分为N块,且该游戏画面中仅有一个物体,采用相关技术中的图像渲染方法进行图像渲染时,针对该游戏画面中的物体需要进行1次绘制,针对被划分为N块的场景地图需要进行N次绘制,针对被划分为N块的遮挡层需要进行N次绘制,针对被划分为N块的高光层需要进行N次绘制,针对被划分为N块的阴影层需要进行N次绘制,如此,渲染该游戏画面时需要完成4N+1次绘制,共输出约4个全屏大小的像素,加载4个全屏大小图像。
而采用本申请实施例提供的图像渲染方法进行图像绘制时,针对游戏画面中的一个物体需要进行1次绘制,遮挡层、阴影层、高光层均不需要单独切图绘制,只利用一张画面效果指示图像将上述显示效果与物体、场景地图通过一次绘制合并即可得到最终显示效果,整个图像渲染过程仅需N+2次绘制,输出约1个全屏大小的像素,加载1个全屏大小图像、1个画面效果指示图像和1个物体图像,图像渲染效率明显提高。
针对上文描述的图像渲染方法,本申请还提供了对应的图像渲染装置,以使上述图像渲染方法在实际中的应用以及实现。
参见图5,图5为上文图2所示的图像渲染方法对应的一种图像渲染装置500的结构示意图,该图像渲染装置500包括:
第一获取模块501,用于获取待渲染画面中指定的基础图像;
第二获取模块502,用于获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
第一渲染模块503,用于将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
第二渲染模块504,用于根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
可选的,在图5所示的图像渲染装置的基础上,所述第一获取模块501,具体用于:
获取画面效果指示图像,所述画面效果指示图像承载有所述画面效果指示数组;
从所述画面效果指示图像中读取各像素位置的像素值,根据所述各像素位置的像素值生成所述画面效果指示图像对应的画面效果指示数组。
可选的,在图5所示的图像渲染装置的基础上,所述画面效果指示值包括:指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
所述第二渲染模块504,具体用于:
以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述基础纹理贴图中各像素值进行加权得到对应的加权像素值;
以所述画面效果指示值中的绿色通道数值作为高光增量值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述基础纹理贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
基于所述待渲染的像素值进行画面渲染。
可选的,在图5所示的图像渲染装置的基础上,所述第一获取模块501具体用于:获取游戏应用的待渲染画面中指定的场景地图作为基础图像;参见图6,图6为本申请实施例提供的另一种图像渲染装置的结构示意图;如图6所示,则所述装置还包括:
第三获取模块601,用于获取物体图像,采用屏幕后处理方式对所述物体图像进行渲染得到物体贴图;
图像混合模块602,用于将所述基础纹理贴图和所述物体贴图进行颜色混合,得到场景物体融合贴图;
则所述第二渲染模块504,具体用于根据所述画面效果指示数组,对所述场景物体融合贴图和所述基础纹理贴图进行颜色融合。
可选的,在图6所示的图像渲染装置的基础上,所述画面效果指示值包括指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
所述图像混合模块602,具体用于以所述物体贴图的阿尔法通道为权值对所述物体贴图和所述基础纹理贴图进行加权平均处理,得到场景物体融合贴图;
则所述第二渲染模块504,具体用于:
以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述场景物体融合贴图中各像素值进行加权得到对应的加权像素值;
以所述画面效果指示值中的绿色通道数值作为高光权值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述场景物体融合贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
基于所述待渲染的像素值进行画面渲染。
可选的,在图5所示的图像渲染装置的基础上,参见图7,图7为本申请实施例提供的另一种图像渲染装置的结构示意图;如图7所示,则所述装置还包括:所述装置还包括:
图像划分模块701,用于将所述基础图像切分成N个基础图像分块;
则所述第一渲染模块503具体用于:
从所述N个基础图像分块中选择属于所述当前视口范围的目标基础图像分块;
将所述目标基础图像分块渲染到与设备屏幕尺寸匹配的渲染纹理对象得到基础纹理贴图。
上述图像渲染装置将图像中的阴影、高光、遮挡等效果综合起来,以一组数据(即画面效果指示数组)来表征图像中各像素位置最终的颜色效果值;针对待渲染画面进行图像渲染时,利用该画面效果指示数组对基础纹理贴图中的像素值进行调整,该基础纹理贴图是将待渲染画面中指定的基础图像渲染至与设备屏幕尺寸匹配的渲染纹理对象上得到的,进而基于调整后的像素值完成对于待渲染画面的图像渲染。如此,无需多次渲染多种效果贴图,节省了图像渲染过程所需耗费的计算资源,有效地提升了图像渲染效率;并且,由于省略了多次独立渲染各效果贴图的过程,终端设备也相应地无需存储每次渲染得到的效果贴图,一定程度上节省了存储空间。
本申请实施例还提供了一种用于图像渲染的终端设备,下面将从硬件实体化的角度对本申请实施例提供的用于图像渲染的终端设备进行介绍。
参见图8,图8为本申请实施例提供的一种终端设备的结构示意图。为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该终端可以为包括计算机、平板电脑、个人数字助理(英文全称:Personal Digital Assistant,英文缩写:PDA)等任意终端设备,以终端为手机为例:
图8示出的是与本申请实施例提供的终端相关的手机的部分结构的框图。参考图8,手机包括:射频(英文全称:Radio Frequency,英文缩写:RF)电路810、存储器820、输入单元830(其中包括触控面板831和其他输入设备832)、显示器840(其中包括显示面板841)、传感器850、音频电路860(其中包括扬声器861和传声器862)、无线保真(英文全称:wireless  fidelity,英文缩写:WiFi)模块870、中央处理器880、图形处理器890以及电源8100等部件。本领域技术人员可以理解,图8中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
存储器820可用于存储软件程序以及模块,中央处理器880通过运行存储在存储器820的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器820可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器820可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
中央处理器880是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器820内的软件程序和/或模块,以及调用存储在存储器820内的数据,执行计算机的各种功能和处理数据,从而对手机进行整体监控。可选的,中央处理器880可包括一个或多个处理单元;优选的,中央处理器880可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器880中。
在本申请实施例中,在需要进行画面渲染时,中央处理器880将控制图形处理器890执行以下操作:
获取待渲染画面中指定的基础图像;
获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
可选的,所述图形处理器890还用于执行本申请实施例提供的图像渲染方法的任意一种实现方式的步骤。进而,在图形处理器890的控制下,通过显示器840显示图像画面。
本申请实施例还提供一种计算机可读存储介质,用于存储计算机程序,该计算机程序用于执行前述各个实施例所述的一种图像渲染方法中的任意一种实施方式。
本申请实施例还提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行前述各个实施例所述的一种图像渲染方法中的任意 一种实施方式。
在一些实施例中,上述终端或服务器可以是一个分布式系统中的一个节点,其中,该分布式系统可以为区块链系统,该区块链系统可以是由该多个节点通过网络通信的形式连接形成的分布式系统。其中,节点之间可以组成点对点(P2P,Peer To Peer)网络,任意形式的计算设备,比如服务器、终端等电子设备都可以通过加入该点对点网络而成为该区块链系统中的一个节点。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文全称:Read-Only Memory,英文缩写:ROM)、随机存取存储器(英文全称:Random Access Memory,英文缩写:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应 当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (15)

  1. 一种图像渲染方法,由终端设备执行,包括:
    获取待渲染画面中指定的基础图像;
    获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
    将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
    根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
  2. 根据权利要求1所述的图像渲染方法,所述获取与所述基础图像对应的画面效果指示数组,包括:
    获取画面效果指示图像,所述画面效果指示图像承载有所述画面效果指示数组;
    从所述画面效果指示图像中读取各像素位置的像素值,根据所述各像素位置的像素值生成所述画面效果指示图像对应的所述画面效果指示数组。
  3. 根据权利要求1或2所述的图像渲染方法,所述画面效果指示值包括:指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
    所述根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染,包括:
    以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述基础纹理贴图中各像素值进行加权得到对应的加权像素值;
    以所述画面效果指示值中的绿色通道数值作为高光增量值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
    以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述基础纹理贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
    基于所述待渲染的像素值进行画面渲染。
  4. 根据权利要求1或2所述的图像渲染方法,所述获取待渲染画面中指定的基础图像,包括:
    获取游戏应用的待渲染画面中指定的场景地图作为基础图像;
    则所述方法还包括:
    获取物体图像,采用屏幕后处理方式对所述物体图像进行渲染得到物体贴图;
    将所述基础纹理贴图和所述物体贴图进行颜色混合,得到场景物体融合贴图;
    则所述根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染,包括:
    根据所述画面效果指示数组,对所述场景物体融合贴图和所述基础纹理贴图进行颜色融合。
  5. 根据权利要求4所述的图像渲染方法,所述画面效果指示值包括指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
    所述将所述基础纹理贴图和所述物体贴图进行颜色混合,得到场景物体融合贴图,包括:
    以所述物体贴图的阿尔法通道为权值,对所述物体贴图和所述基础纹理贴图进行加权平均处理,得到所述场景物体融合贴图;
    则所述根据所述画面效果指示数组,对所述场景物体融合贴图和所述基础纹理贴图进行颜色融合,包括:
    以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述场景物体融合贴图中各像素值进行加权得到对应的加权像素值;
    以所述画面效果指示值中的绿色通道数值作为高光增量值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
    以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述场景物体融合贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
    基于所述待渲染的像素值进行画面渲染。
  6. 根据权利要求1所述的图像渲染方法,在所述获取待渲染画面中指定的基础图像之后,所述方法还包括:
    将所述基础图像切分成N个基础图像分块;
    则所述将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图,包括:
    从所述N个基础图像分块中选择属于所述当前视口范围的目标基础图像分块;
    将所述目标基础图像分块渲染到与设备屏幕尺寸匹配的渲染纹理对象得到基础纹理贴图。
  7. 一种图像渲染装置,包括:
    第一获取模块,用于获取待渲染画面中指定的基础图像;
    第二获取模块,用于获取与所述基础图像对应的画面效果指示数组,所述画面效果指示数组中包括所述基础图像的像素位置对应的画面效果指示值;
    第一渲染模块,用于将所述基础图像渲染到与设备屏幕尺寸匹配的渲染纹理对象上,得到基础纹理贴图;
    第二渲染模块,用于根据所述画面效果指示数组对所述基础纹理贴图进行颜色渲染。
  8. 根据权利要求7所述的图像渲染装置,所述第一获取模块,具体用于:
    获取画面效果指示图像,所述画面效果指示图像承载有所述画面效果指示数组;
    从所述画面效果指示图像中读取各像素位置的像素值,根据所述各像素位置的像素值生成所述画面效果指示图像对应的所述画面效果指示数组。
  9. 根据权利要求7或8所述的图像渲染装置,所述画面效果指示值包括:指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
    所述第二渲染模块,具体用于:
    以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述基础纹理贴图中各像素值进行加权得到对应的加权像素值;
    以所述画面效果指示值中的绿色通道数值作为高光增量值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
    以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述基础纹理贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
    基于所述待渲染的像素值进行画面渲染。
  10. 根据权利要求7或8所述的图像渲染装置,所述第一获取模块,具体用于:
    获取游戏应用的待渲染画面中指定的场景地图作为基础图像;
    则所述装置还包括:
    第三获取模块,用于获取物体图像,采用屏幕后处理方式对所述物体图像进行渲染得到物体贴图;
    图像混合模块,用于将所述基础纹理贴图和所述物体贴图进行颜色混合,得到场景物体融合贴图;
    则所述第二渲染模块,具体用于:
    根据所述画面效果指示数组,对所述场景物体融合贴图和所述基础纹理贴图进行颜色融合。
  11. 根据权利要求10所述的图像渲染装置,所述画面效果指示值包括指示透明度的红色通道数值、指示高光亮度的绿色通道数值以及指示阴影度的蓝色通道数值;
    所述图像混合模块,具体用于:
    以所述物体贴图的阿尔法通道为权值对所述物体贴图和所述基础纹理贴图进行加权平均处理,得到所述场景物体融合贴图;
    则所述第二渲染模块,具体用于:
    以所述画面效果指示值中的蓝色通道数值作为颜色强弱权值,对所述场 景物体融合贴图中各像素值进行加权得到对应的加权像素值;
    以所述画面效果指示值中的绿色通道数值作为高光权值,对所述基础纹理贴图中各像素值进行增量处理得到对应的增量像素值;
    以所述画面效果指示值中的红色通道数值作为透明度权值,对所述基础纹理贴图中各增量像素值和所述场景物体融合贴图中各加权像素值进行加权平均处理,得到待渲染的像素值;
    基于所述待渲染的像素值进行画面渲染。
  12. 根据权利要求7所述的图像渲染装置,所述装置还包括:
    图像划分模块,用于将所述基础图像切分成N个基础图像分块;
    则所述第一渲染模块具体用于:
    从所述N个基础图像分块中选择属于所述当前视口范围的目标基础图像分块;
    将所述目标基础图像分块渲染到与设备屏幕尺寸匹配的渲染纹理对象得到基础纹理贴图。
  13. 一种终端设备,包括:
    中央处理器、图形处理器、存储器以及显示器;
    其中,所述存储器用于存储计算机程序;
    所述中央处理器用于执行所述计算机程序,并在需要画面渲染时控制所述图形处理器执行计算机程序以实现所述权利要求1至6中任一项所述方法;
    所述显示器用于在所述图形处理器的控制下显示图像画面。
  14. 一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述计算机程序用于执行权利要求1至6任一项所述的方法。
  15. 一种计算机程序产品,包括指令,当其在计算机上运行时,使得计算机执行如权利要求1至6任一项所述的方法。
PCT/CN2020/112926 2019-09-11 2020-09-02 一种图像渲染方法、装置、设备及存储介质 WO2021047429A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2021555825A JP7270760B2 (ja) 2019-09-11 2020-09-02 画像レンダリング方法、装置、機器及びコンピュータプログラム
EP20862745.5A EP3916680A4 (en) 2019-09-11 2020-09-02 IMAGE RENDERING METHOD AND DEVICE, APPARATUS, AND STORAGE MEDIA
US17/161,993 US11833424B2 (en) 2019-09-11 2021-01-29 Image rendering method and apparatus, device and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910859321.XA CN110570505B (zh) 2019-09-11 2019-09-11 一种图像渲染方法、装置、设备及存储介质
CN201910859321.X 2019-09-11

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/161,993 Continuation US11833424B2 (en) 2019-09-11 2021-01-29 Image rendering method and apparatus, device and storage medium

Publications (1)

Publication Number Publication Date
WO2021047429A1 true WO2021047429A1 (zh) 2021-03-18

Family

ID=68779256

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/112926 WO2021047429A1 (zh) 2019-09-11 2020-09-02 一种图像渲染方法、装置、设备及存储介质

Country Status (5)

Country Link
US (1) US11833424B2 (zh)
EP (1) EP3916680A4 (zh)
JP (1) JP7270760B2 (zh)
CN (1) CN110570505B (zh)
WO (1) WO2021047429A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116206046A (zh) * 2022-12-13 2023-06-02 北京百度网讯科技有限公司 渲染处理方法、装置、电子设备及存储介质

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111435548B (zh) * 2019-01-13 2023-10-03 北京魔门塔科技有限公司 一种地图的渲染方法和装置
CN110570505B (zh) * 2019-09-11 2020-11-17 腾讯科技(深圳)有限公司 一种图像渲染方法、装置、设备及存储介质
CN111145287A (zh) * 2019-12-26 2020-05-12 珠海金山网络游戏科技有限公司 一种贴图处理方法及装置
CN111340684B (zh) * 2020-02-12 2024-03-01 网易(杭州)网络有限公司 一种游戏中图形处理的方法和装置
CN112181530A (zh) * 2020-03-10 2021-01-05 简吉波 基于云平台的虚拟现实场景加载方法及虚拟现实系统
CN111309430B (zh) * 2020-03-16 2021-12-10 广东趣炫网络股份有限公司 一种自动缓存用户交互界面节点的方法和相关装置
CN112215934B (zh) * 2020-10-23 2023-08-29 网易(杭州)网络有限公司 游戏模型的渲染方法、装置、存储介质及电子装置
CN112700507A (zh) * 2020-12-28 2021-04-23 统信软件技术有限公司 一种图片显示方法、计算设备和存储介质
CN112686939B (zh) * 2021-01-06 2024-02-02 腾讯科技(深圳)有限公司 景深图像的渲染方法、装置、设备及计算机可读存储介质
CN113012274B (zh) * 2021-03-24 2023-07-28 北京壳木软件有限责任公司 一种阴影渲染的方法、装置以及电子设备
CN113205570B (zh) * 2021-04-30 2024-04-19 阿波罗智联(北京)科技有限公司 基于电子地图的电子斑马线的生成方法及装置
CN113516748B (zh) * 2021-07-30 2024-05-28 中山大学 一种集成成像光场显示的实时渲染方法及装置
CN113949900B (zh) * 2021-10-08 2023-11-24 上海哔哩哔哩科技有限公司 直播贴图处理方法、系统、设备及存储介质
CN113947657A (zh) * 2021-10-18 2022-01-18 网易(杭州)网络有限公司 目标模型的渲染方法、装置、设备及存储介质
CN114049425B (zh) * 2021-10-29 2023-06-09 腾讯科技(深圳)有限公司 图像中的照明仿真方法、装置、设备及存储介质
CN114245177B (zh) * 2021-12-17 2024-01-23 智道网联科技(北京)有限公司 高精地图的平滑显示方法、装置、电子设备及存储介质
CN114745570B (zh) * 2022-06-09 2022-11-11 荣耀终端有限公司 图像的渲染方法、电子设备及存储介质
CN115641400B (zh) * 2022-11-04 2023-11-17 广州大事件网络科技有限公司 一种动态图片生成方法、系统、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7098925B1 (en) * 2000-03-10 2006-08-29 Intel Corporation Shading of images using texture
CN104103089A (zh) * 2014-07-29 2014-10-15 无锡梵天信息技术股份有限公司 一种基于图像屏幕空间的实时软阴影实现方法
CN106485776A (zh) * 2016-11-23 2017-03-08 北京三体高创科技有限公司 一种3d游戏实时渲染大规模场景的方法及系统
CN108295467A (zh) * 2018-02-06 2018-07-20 网易(杭州)网络有限公司 图像的呈现方法、装置及存储介质、处理器和终端
CN110115841A (zh) * 2019-05-10 2019-08-13 网易(杭州)网络有限公司 一种游戏场景中植被对象的渲染方法和装置
CN110570505A (zh) * 2019-09-11 2019-12-13 腾讯科技(深圳)有限公司 一种图像渲染方法、装置、设备及存储介质

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6791563B2 (en) * 2001-09-18 2004-09-14 Bentley Systems, Incorporated System, method and computer program product for global rendering
JP2004334661A (ja) 2003-05-09 2004-11-25 Namco Ltd 画像生成システム、プログラム及び情報記憶媒体
JP5613433B2 (ja) 2010-03-31 2014-10-22 株式会社カプコン 画像処理プログラム、記録媒体、及びコンピュータ装置
KR101874895B1 (ko) 2012-01-12 2018-07-06 삼성전자 주식회사 증강 현실 제공 방법 및 이를 지원하는 단말기
GB2514583B (en) * 2013-05-29 2015-03-04 Imagination Tech Ltd Relightable texture for use in rendering an image
CN103581571B (zh) * 2013-11-22 2017-02-22 北京中科大洋科技发展股份有限公司 一种基于色彩三要素的视频抠像方法
US9245358B2 (en) * 2014-05-30 2016-01-26 Apple Inc. Systems and methods for generating refined, high fidelity normal maps for 2D and 3D textures
US20150348315A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Dynamic Lighting Effects For Textures Without Normal Maps
CN104966312B (zh) * 2014-06-10 2017-07-21 腾讯科技(深圳)有限公司 一种3d模型的渲染方法、装置及终端设备
CN104268922B (zh) * 2014-09-03 2017-06-06 广州博冠信息科技有限公司 一种图像渲染方法及图像渲染装置
US9659381B2 (en) * 2015-01-26 2017-05-23 Daqri, Llc Real time texture mapping for augmented reality system
GB2541179B (en) * 2015-07-31 2019-10-30 Imagination Tech Ltd Denoising filter
US10074193B2 (en) * 2016-10-04 2018-09-11 Microsoft Technology Licensing, Llc Controlled dynamic detailing of images using limited storage
CN109147023A (zh) * 2018-07-27 2019-01-04 北京微播视界科技有限公司 基于人脸的三维特效生成方法、装置和电子设备
CN109461199B (zh) * 2018-11-15 2022-12-30 腾讯科技(深圳)有限公司 画面渲染方法和装置、存储介质及电子装置
US11395027B2 (en) * 2020-02-28 2022-07-19 Verizon Patent And Licensing Inc. Methods and systems for request-based graphics rendering at a multi-access server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7098925B1 (en) * 2000-03-10 2006-08-29 Intel Corporation Shading of images using texture
CN104103089A (zh) * 2014-07-29 2014-10-15 无锡梵天信息技术股份有限公司 一种基于图像屏幕空间的实时软阴影实现方法
CN106485776A (zh) * 2016-11-23 2017-03-08 北京三体高创科技有限公司 一种3d游戏实时渲染大规模场景的方法及系统
CN108295467A (zh) * 2018-02-06 2018-07-20 网易(杭州)网络有限公司 图像的呈现方法、装置及存储介质、处理器和终端
CN110115841A (zh) * 2019-05-10 2019-08-13 网易(杭州)网络有限公司 一种游戏场景中植被对象的渲染方法和装置
CN110570505A (zh) * 2019-09-11 2019-12-13 腾讯科技(深圳)有限公司 一种图像渲染方法、装置、设备及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3916680A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116206046A (zh) * 2022-12-13 2023-06-02 北京百度网讯科技有限公司 渲染处理方法、装置、电子设备及存储介质
CN116206046B (zh) * 2022-12-13 2024-01-23 北京百度网讯科技有限公司 渲染处理方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
EP3916680A1 (en) 2021-12-01
CN110570505B (zh) 2020-11-17
US20210146247A1 (en) 2021-05-20
CN110570505A (zh) 2019-12-13
EP3916680A4 (en) 2022-05-18
US11833424B2 (en) 2023-12-05
JP2022524889A (ja) 2022-05-10
JP7270760B2 (ja) 2023-05-10

Similar Documents

Publication Publication Date Title
WO2021047429A1 (zh) 一种图像渲染方法、装置、设备及存储介质
RU2677584C1 (ru) Использование межкадровой когерентности в архитектуре построения изображений с сортировкой примитивов на промежуточном этапе
CN109644294B (zh) 一种直播分享的方法、相关设备及系统
US11395027B2 (en) Methods and systems for request-based graphics rendering at a multi-access server
US9665247B2 (en) Method and device for applying a new skin to a display environment
TWI514314B (zh) 丟棄過濾器分接點之紋理位址模式
CN107948733B (zh) 视频图像处理方法及装置、电子设备
CN110569013B (zh) 基于展示屏幕的图像展示方法以及装置
TWI717317B (zh) 對顯示裝置的顯示圖像進行截屏的方法及裝置
CN110782387B (zh) 图像处理方法、装置、图像处理器及电子设备
CN104581345A (zh) 一种调整显示帧的方法及装置
CN112884665A (zh) 一种动画播放方法、装置、计算机设备及存储介质
CN110858388B (zh) 一种增强视频画质的方法和装置
CN115061617A (zh) 直播画面的处理方法、装置、计算机设备和存储介质
WO2022052742A1 (zh) 多终端屏幕组合方法、装置、设备和计算机存储介质
WO2024067461A1 (zh) 图像处理方法、装置、计算机设备和存储介质
CN111562869B (zh) 截图方法及装置、存储介质、电子装置
CN113559498A (zh) 三维模型展示方法、装置、存储介质及电子设备
CN113645476A (zh) 画面处理方法、装置、电子设备及存储介质
JP6309004B2 (ja) ビデオ会議環境のためのビデオ表示変更
CN110941413B (zh) 显示画面的生成方法及相关装置
CN114693894A (zh) 一种虚拟世界中图片转换为积木块的方法、系统及装置
CN110874816B (zh) 一种图像处理方法、装置、移动终端及存储介质
CN109302617B (zh) 一种指定多元素的视频连麦方法、装置、设备及存储介质
CN114092362A (zh) 一种全景图片加载方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20862745

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020862745

Country of ref document: EP

Effective date: 20210826

ENP Entry into the national phase

Ref document number: 2021555825

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE