CN112750191B - Method for manufacturing soft shadow in real-time rendering - Google Patents

Method for manufacturing soft shadow in real-time rendering Download PDF

Info

Publication number
CN112750191B
CN112750191B CN202110033977.3A CN202110033977A CN112750191B CN 112750191 B CN112750191 B CN 112750191B CN 202110033977 A CN202110033977 A CN 202110033977A CN 112750191 B CN112750191 B CN 112750191B
Authority
CN
China
Prior art keywords
shadow
frame buffer
rendering
gaussian blur
objects
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202110033977.3A
Other languages
Chinese (zh)
Other versions
CN112750191A (en
Inventor
郭辰
董理
杨萍
张晓朝
梁思超
卜照军
冯笑丹
王森
蒋贲
王志勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Langrun Zhitian Technology Co ltd
Huaneng Clean Energy Research Institute
Huaneng Group Technology Innovation Center Co Ltd
Huaneng Renewables Corp Ltd
Original Assignee
Beijing Langrun Zhitian Technology Co ltd
Huaneng Clean Energy Research Institute
Huaneng Group Technology Innovation Center Co Ltd
Huaneng Renewables Corp Ltd
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 Beijing Langrun Zhitian Technology Co ltd, Huaneng Clean Energy Research Institute, Huaneng Group Technology Innovation Center Co Ltd, Huaneng Renewables Corp Ltd filed Critical Beijing Langrun Zhitian Technology Co ltd
Priority to CN202110033977.3A priority Critical patent/CN112750191B/en
Publication of CN112750191A publication Critical patent/CN112750191A/en
Application granted granted Critical
Publication of CN112750191B publication Critical patent/CN112750191B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/60Shadow generation
    • 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
    • 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
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

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

Abstract

The invention relates to a method for making soft shadow in real-time rendering, which relates to the technical field of image processing and solves the problems that most of soft shadow generated by the prior method has poor quality or has high requirement on hardware and is difficult to be directly applied in games; giving an ID for each model, and rendering to a pickup frame buffer; rendering the original shadow to obtain an unoptimized shadow; and for the original shadow, carrying out horizontal Gaussian blur and vertical Gaussian blur according to the pickup frame buffer, synthesizing to obtain an optimized shadow, and on the basis of rendering the pickup frame buffer, softening the hard shadow by using the two-dimensional Gaussian blur step by step. With this method, high quality shadows can be generated in a shorter time.

Description

Method for manufacturing soft shadow in real-time rendering
Technical Field
The invention relates to the technical field of image processing, in particular to a method for manufacturing soft shadows in real-time rendering.
Background
The identification of different objects in a game is usually accomplished by means of a pick-up frame buffer. The soft Shadow effect is realized in a Shadow Mapping (Shadow Mapping) mode commonly used in games, and the method is generally adopted as follows: the method of performing high-precision supersampling at the shadow boundary is the reason that soft shadow consumes large system resources, so that the method has high requirement on hardware. And in the case of poor hardware conditions, the generation of high-efficiency soft shadows is difficult.
The soft shadows generated by the existing method are mostly poor in quality or high in hardware requirement, and are difficult to directly apply in games. OpenGL (Open Graphics Library, open graphics library or open graphics library) is used to render cross-language, cross-platform Application Programming Interfaces (APIs) for 2D, 3D vector graphics. This interface consists of nearly 350 different function calls, used to draw a scene from simple graphics bits to complex three dimensions. OpenGL is commonly used for CAD, virtual reality, scientific visualization programs, and electronic game development.
A Shader (loader) is used to implement image rendering, replacing the editable program of the fixed rendering pipeline. Wherein, the Vertex loader is mainly responsible for the calculation of the geometric relationship of the Vertex, and the Pixel loader is mainly responsible for the calculation of the patch source color, and the like.
The identification of different objects in a game is usually accomplished by means of a pick-up frame buffer. The overhead of rendering the pick-up frame buffer is not low, but single-purpose.
Disclosure of Invention
The invention provides a method for manufacturing soft shadows in real-time rendering, which aims to solve the problems that most soft shadows generated by the existing method are poor in quality or high in hardware requirement and difficult to directly apply in games.
A method for making soft shadow in real-time rendering is realized by the following steps:
initializing OpenGL equipment, and loading a 3D model needing shadow rendering;
setting a specific unique ID of each model, and rendering to a pickup frame buffer;
step three, directly rendering an original shadow to obtain an unoptimized shadow;
step four, performing two-step Gaussian blur on the non-optimized shadow according to the picked-up frame buffer, wherein the two-step Gaussian blur comprises horizontal Gaussian blur according to the picked-up frame buffer and vertical Gaussian blur according to the picked-up frame buffer;
and step five, synthesizing the results of the step two and the step four to obtain the optimized shadow.
The invention has the beneficial effects that:
1. the invention can realize the manufacture of soft shadows by utilizing the picked frame buffer, thereby improving the utilization rate of resources.
2. The invention uses stepwise two-dimensional Gaussian blur (Two Pass Gaussian Blur) on the basis of the rendered pick-up frame buffer (3D Picking Texture) to soften the hard shadow. With this method, high quality shadows can be generated in a shorter time.
Drawings
FIG. 1 is a flow chart of a method for producing soft shadows in real-time rendering according to the present invention;
FIG. 2 is a rendered pickup frame buffer effect diagram;
FIG. 3 is a rendered original shadow effect map;
fig. 4 is a graph of the optimized shadow effect.
Detailed Description
The present embodiment will be described with reference to fig. 1 to 4, which are a method for producing soft shadows in real-time rendering, comprising the steps of:
step S1, using OpenGL rendering, initializing OpenGL equipment and loading a model;
OpenGL is initialized, a model is loaded to a vertex group object (Vertex Array Object, VAO), a vertex buffer object (Vertex Buffer Object, VBO), an index buffer object (Indices Buffer Object, IBO), and a pick frame buffer is generated.
S2, setting a specific unique ID of each model, and rendering to a pickup frame buffer;
the rendered picked frame buffer the unique ID of each model is rendered into a frame buffer (Frame Buffer Object) as a three-dimensional vector.
S3, directly rendering the original shadow to obtain an unoptimized shadow;
s4, carrying out two-step Gaussian blur on the original shadow according to the picked frame buffer;
the two-dimensional Gaussian blur is split into two steps to be realized, and compared with the method of directly using a two-dimensional Gaussian convolution kernel (Gaussian Convolution Kernel), the method has higher efficiency.
S5, carrying out Gaussian blur in the horizontal direction according to the picked-up frame buffer;
s6, carrying out Gaussian blur in the vertical direction according to the picked frame buffer;
according to the pickup frame buffering of step S2, the blurring process performed by the distribution does not affect other objects, and the judgment is performed during rendering, and if other objects (with different ids) are rendered, the rendering is stopped, so that the blurred shadows are constrained on the same object.
The key of judging different ids is to judge different objects by comparing the distances of the two ids.
In the present embodiment, the graphics library used is OpenGL, but the implementation is not limited to OpenGL. The same rendering pipeline is used, and the method can be used for other graphic libraries such as Direct3D, metal and the like, and can also be used for the loader design of game engines such as Unity3D, unreal and the like by slightly improving the rendering pipeline. Can be conveniently transplanted to various platforms such as Windows, android, IOS and the like.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.

Claims (2)

1. A method for producing soft shadows in real-time rendering, comprising the steps of:
initializing OpenGL equipment, and loading a 3D model needing shadow rendering;
loading a 3D model to the vertex group object, the vertex buffer object, and the index buffer object to generate a pickup frame buffer;
setting a specific unique ID of each model, and rendering to a pickup frame buffer;
step three, directly rendering an original shadow to obtain an unoptimized shadow;
step four, performing two-step Gaussian blur on the non-optimized shadow according to the picked-up frame buffer, wherein the two-step Gaussian blur comprises horizontal Gaussian blur according to the picked-up frame buffer and vertical Gaussian blur according to the picked-up frame buffer;
in the process of carrying out Gaussian blur in the horizontal direction and Gaussian blur in the vertical direction, judging according to the pickup frame buffer in the second step during rendering, and stopping rendering when other objects are rendered, so that blurred shadows are constrained on the same object;
judging whether the two objects are the same object by comparing the distances of the IDs of the two objects, and judging the two objects as different objects when the Euclidean distance of the IDs of the two objects is greater than a certain threshold value;
and step five, synthesizing the results of the step two and the step four to obtain the optimized shadow.
2. The method for producing soft shadows in real-time rendering according to claim 1, wherein: in the second step, the unique ID of each model of the rendered pickup frame buffer is rendered into the frame buffer as a three-dimensional vector.
CN202110033977.3A 2021-01-12 2021-01-12 Method for manufacturing soft shadow in real-time rendering Active CN112750191B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110033977.3A CN112750191B (en) 2021-01-12 2021-01-12 Method for manufacturing soft shadow in real-time rendering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110033977.3A CN112750191B (en) 2021-01-12 2021-01-12 Method for manufacturing soft shadow in real-time rendering

Publications (2)

Publication Number Publication Date
CN112750191A CN112750191A (en) 2021-05-04
CN112750191B true CN112750191B (en) 2023-11-10

Family

ID=75650792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110033977.3A Active CN112750191B (en) 2021-01-12 2021-01-12 Method for manufacturing soft shadow in real-time rendering

Country Status (1)

Country Link
CN (1) CN112750191B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105611386A (en) * 2015-12-23 2016-05-25 小米科技有限责任公司 Video picture processing method and device
KR20160103926A (en) * 2015-02-25 2016-09-02 삼성전자주식회사 Shadow rendering method and shadow rendering apparatus
CN106485776A (en) * 2016-11-23 2017-03-08 北京三体高创科技有限公司 A kind of method and system of 3D game real-time rendering large scale scene

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7212206B2 (en) * 2003-08-20 2007-05-01 Sony Computer Entertainment Inc. Method and apparatus for self shadowing and self interreflection light capture
US7542038B2 (en) * 2005-06-30 2009-06-02 Intel Corporation Method and system for pivot-point based adaptive soft shadow estimation
US7969438B2 (en) * 2007-01-23 2011-06-28 Pacific Data Images Llc Soft shadows for cinematic lighting for computer graphics
DE102016103874A1 (en) * 2015-03-03 2016-09-08 Imagination Technologies Limited Systems and methods for soft shading in 3D rendering

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20160103926A (en) * 2015-02-25 2016-09-02 삼성전자주식회사 Shadow rendering method and shadow rendering apparatus
CN105611386A (en) * 2015-12-23 2016-05-25 小米科技有限责任公司 Video picture processing method and device
CN106485776A (en) * 2016-11-23 2017-03-08 北京三体高创科技有限公司 A kind of method and system of 3D game real-time rendering large scale scene

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Soft Shadow Maps:Efficient Sampling of Light Source Visibility;Lionel A. et al.;《Computer graphics forum》;第25卷(第4期);第725-741页 *
实时阴影渲染技术的研究与应用;赵丹;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;第I138-1335页 *

Also Published As

Publication number Publication date
CN112750191A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
US10600167B2 (en) Performing spatiotemporal filtering
CN108537861B (en) Map generation method, device, equipment and storage medium
KR100896155B1 (en) Flexible antialiasing in embedded devices
KR102242626B1 (en) Graphics processing enhancement by tracking object and/or primitive identifiers
US7184040B1 (en) Early stencil test rejection
JP6342513B2 (en) Effective construction method of high resolution display buffer
CN107154063B (en) Method and device for setting shape of image display area
US6650327B1 (en) Display system having floating point rasterization and floating point framebuffering
US20200342658A1 (en) Hybrid frustum traced shadows systems and methods
CN109358852B (en) Method for realizing skin changing of vehicle-mounted GUI (graphical user interface) by using shader
TWI320913B (en) Methods, systems and computer-readable storage medium for shading process compiling of 3d computer graphics
CN109785417B (en) Method and device for realizing OpenGL cumulative operation
CN111724313B (en) Shadow map generation method and device
EP3580726B1 (en) Buffer index format and compression
US7508390B1 (en) Method and system for implementing real time soft shadows using penumbra maps and occluder maps
CN106251291A (en) Utilize OpenGL with OpenCL to cooperate and realize the method and system of image scaling
CN112819726A (en) Light field rendering artifact removing method
CN112750191B (en) Method for manufacturing soft shadow in real-time rendering
CN111739074B (en) Scene multi-point light source rendering method and device
US20230316626A1 (en) Image rendering method and apparatus, computer device, and computer-readable storage medium
CN117891378A (en) Three-dimensional object pickup method, storage medium and device based on WebGPU acceleration
EP4379647A1 (en) Render format selection method and device related thereto
TWI810458B (en) Apparatus, system and method for optimized pixel shader attribute management
TW202137141A (en) Methods and apparatus for edge compression anti-aliasing
CN114693857A (en) Ray tracing multi-frame noise reduction method, electronic equipment, chip and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant