CN114266855A - Light effect simulation method and device of dot matrix screen and electronic equipment - Google Patents
Light effect simulation method and device of dot matrix screen and electronic equipment Download PDFInfo
- Publication number
- CN114266855A CN114266855A CN202111592248.8A CN202111592248A CN114266855A CN 114266855 A CN114266855 A CN 114266855A CN 202111592248 A CN202111592248 A CN 202111592248A CN 114266855 A CN114266855 A CN 114266855A
- Authority
- CN
- China
- Prior art keywords
- virtual
- dot matrix
- matrix screen
- unit
- lamp bead
- 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.)
- Pending
Links
Images
Landscapes
- Image Generation (AREA)
- Control Of Indicators Other Than Cathode Ray Tubes (AREA)
Abstract
The invention provides a method and a device for simulating a light effect of a dot matrix screen and electronic equipment, wherein the method comprises the following steps: cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub UV spaces, and one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit. In the mode, the UV space of the virtual dot matrix screen is cut into small units, so that each small unit and the whole dot matrix screen can be finely controlled, and the controllable requirement of a user is met; in addition, the light effect simulation of the virtual dot matrix screen is completely realized by the shader, so that the simulation flow can be simplified, the operation complexity can be reduced, the requirement of real-time operation can be met, and the simulation of the virtual dot matrix screen can be easily expanded.
Description
Technical Field
The invention relates to the technical field of virtualization, in particular to a method and a device for simulating a light effect of a dot matrix screen and electronic equipment.
Background
With the development of virtual technology, online virtual concerts are receiving more and more attention of people, so that many companies push out their own virtual idols and online concerts. For a virtual concert, it is an important design consideration how to create a scene lighting atmosphere in an artistic manner, and simultaneously, the participants can not reduce the telepresence due to the unreality brought by the virtual world.
In order to restore the stage elements of the real commercial performance, the Light effect of a real imitation LED (Light-Emitting Diode) dot matrix screen in the virtual world is needed. In the related art, the scheme of simulating the dot matrix screen is roughly divided into two directions, one is light simulation based on program control, the scheme has high reduction precision, but complex logic needs to be designed to regulate and control the state of a lamp bead, and the idea of project application is not seen at present. In addition, the other method is to make remixing off-line by using software such as AE (Adobe After Effects, later animation synthesis software), and the workflow of the scheme is relatively complex. Therefore, the solutions provided by the related art are difficult to satisfy the requirements of real-time game operation and artist controllability.
Disclosure of Invention
The invention aims to provide a light effect simulation method and device of a dot matrix screen and electronic equipment, so that the simulated dot matrix screen meets the requirements of real-time game operation and artist controllability.
In a first aspect, the present invention provides a method for simulating a light effect of a dot matrix screen, the method being applied to a shader; the method comprises the following steps: cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; wherein, one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit.
In an optional implementation manner, the step of adjusting the display effect of the virtual bead in the virtual dot matrix screen according to the control instruction for the unit includes: obtaining a mosaic image of a sub UV space corresponding to each unit according to random noise; and controlling the brightness of the virtual lamp beads in the virtual dot matrix screen based on the pixel values of the mosaic image.
In an alternative embodiment, the mosaic image is a grayscale image; the step of controlling the brightness of each virtual lamp bead in the virtual dot matrix screen according to the pixel value of the mosaic image comprises the following steps: and aiming at each unit in the virtual dot matrix screen, determining the brightness of the virtual lamp bead corresponding to the current unit according to the gray value of the current unit in the mosaic image.
In an optional embodiment, the step of determining the brightness of the virtual lamp bead corresponding to the current unit according to the gray value of the current unit in the mosaic image includes: if the gray value of the current unit in the mosaic image is a first numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit to be in a turn-off state; if the gray value of the current unit in the mosaic image is a second numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a full-bright state; and if the gray value of the current unit in the mosaic image is larger than the first numerical value and smaller than the second numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit according to the gray value.
In an optional embodiment, the step of obtaining the mosaic image of the sub UV space corresponding to each cell according to the random noise includes: generating random noise through a preset noise generator; and inputting the generated random noise into the UV space corresponding to each unit, and outputting a mosaic image.
In an alternative embodiment, each cell is arranged in a cartesian coordinate system; before the step of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction for the unit, the method further comprises: and performing coordinate conversion on the sub UV space corresponding to each unit to obtain the UV space under a polar coordinate system.
In an optional implementation manner, the step of adjusting the display effect of the virtual bead in the virtual dot matrix screen according to the control instruction for the unit includes: and under a polar coordinate system, based on two preset lamp bead ranges with frame time difference, controlling the virtual lamp beads corresponding to the designated units to be lightened by the original point along the polar axis in an outward diffusion mode.
In an optional implementation manner, the step of controlling the virtual lamp beads corresponding to the designating unit to be lit by the origin along the polar axis in an outward diffusion manner based on the two preset lamp bead ranges with the frame time difference includes: sampling the designated units to obtain virtual lamp bead maps; obtaining an interpolation range according to two preset lamp bead ranges with frame time differences; based on the interpolation range, the virtual lamp bead mapping is subjected to linear difference to control the virtual lamp beads corresponding to the virtual lamp bead mapping to be lightened by the original point along the polar axis in an outward diffusion mode.
In an optional embodiment, the step of obtaining an interpolation range according to two preset lamp bead ranges with frame time differences includes: obtaining two preset lamp bead ranges with frame time differences through a smooth step function; and subtracting the two sets of lamp bead ranges to obtain an interpolation range.
In an alternative embodiment, the above-mentioned designated unit is provided with a separate UV space.
In an alternative embodiment, each cell is arranged in a cartesian coordinate system; the above-mentioned step according to the control command to the unit, the display effect of virtual lamp pearl in the virtual dot matrix screen of adjustment includes: and controlling the virtual lamp beads corresponding to each unit in the virtual dot matrix screen to flow and flash according to a preset image according to a first speed set in the X-axis direction and/or a second speed set in the Y-axis direction in the sub UV space.
In an optional embodiment, the step of controlling the virtual lamp bead corresponding to each unit in the UV space to flicker in a flowing manner according to a preset image includes: sampling a preset image to obtain a sampled image; and controlling the sampled image to flow and flicker on the virtual dot matrix screen through the virtual lamp beads according to the first speed set in the X-axis direction and/or the second speed set in the Y-axis direction.
In an optional implementation manner, the step of adjusting the display effect of the virtual bead in the virtual dot matrix screen according to the control instruction for the unit includes: responding to the input operation of a preset gray-scale image, and sampling the preset gray-scale image to obtain a sampled gray-scale image; and determining the display color of the virtual lamp beads in the virtual dot matrix screen by sampling the gray value of the gray map.
In a second aspect, the present invention provides a light effect simulation apparatus for a dot matrix screen, the apparatus comprising: the cutting module is used for cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, and the plurality of units correspond to respective subspaces; wherein, one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and the control module is used for adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction for the unit.
In a third aspect, the present invention provides an electronic device comprising a processor and a memory, the memory storing machine executable instructions capable of being executed by the processor, the processor executing the machine executable instructions to implement the light effect simulation method for a dot-matrix screen as described above.
In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the above-described method for simulating a light effect of a dot-matrix screen.
The embodiment of the invention has the following beneficial effects:
the invention provides a light effect simulation method and device of a dot matrix screen and electronic equipment, firstly, cutting a UV space of a virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces, and one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and then according to the control command to the unit, adjust the display effect of virtual lamp pearl in the virtual dot matrix screen. In the mode, the UV space of the virtual dot matrix screen is cut into small units, so that each small unit and the whole dot matrix screen can be finely controlled, and the controllable requirement of a user is met; in addition, the light effect simulation of the virtual dot matrix screen is completely realized by the shader, so that the simulation flow can be simplified, the operation complexity can be reduced, the requirement of real-time operation can be met, and the simulation of the virtual dot matrix screen can be easily expanded.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention as set forth above.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a light effect simulation method for a dot matrix screen according to an embodiment of the present invention;
FIG. 2 is a schematic view of UV space cutting provided by an embodiment of the present invention;
fig. 3 is a flowchart of another light effect simulation method for a dot matrix screen according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a UV space after cutting of a virtual dot matrix screen according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a mosaic image corresponding to a sub-UV space according to an embodiment of the present invention;
fig. 6 is a flowchart of another light effect simulation method for a dot matrix screen according to an embodiment of the present invention;
fig. 7 is a display effect diagram of a virtual lamp bead in a cut UV space in an off state according to an embodiment of the present invention;
fig. 8 is an effect diagram of the virtual dot matrix screen provided by the embodiment of the present invention after the virtual beads are lit;
fig. 9 is a flowchart of another light effect simulation method for a dot matrix screen according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a light effect simulation apparatus for a dot matrix screen according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
With the development of virtual technology, online virtual concerts are receiving more and more attention, so that many companies push out their own virtual idols and online concerts. For a virtual concert, it is an important design consideration how to create a scene lighting atmosphere in an artistic manner, and simultaneously, the participants can not reduce the telepresence due to the unreality brought by the virtual world. Therefore, the virtual singing is also required to restore the stage elements of the real commercial performance as much as possible, such as stage art lights, LED dot matrix screens covering the whole background, holographic projections, spherical backdrop and the like.
In order to restore the stage elements of the real commercial performance, the light effect of the real imitation LED dot matrix screen in the virtual world is needed. In the related art, the scheme of simulating the dot matrix screen is roughly divided into two directions, one is light simulation based on program control, the scheme has high reduction precision, but complex logic needs to be designed to regulate and control the state of a lamp bead, and the idea of project application is not seen at present. And in addition, the remixing is done off-line through software such as AE and the like, and the workflow of the scheme is complex. Therefore, the scheme provided by the related technology has large calculation amount, is difficult to adapt to the real-time performance requirement of the game, and the related scheme is related to the front of the engine, has weak expandability and is difficult to meet the controllable requirement of the artist.
Based on the above problems, embodiments of the present invention provide a method and an apparatus for simulating a light effect of a dot matrix screen, and an electronic device. To facilitate understanding of the embodiment, first, a detailed description is given of a light effect simulation method for a dot matrix screen according to an embodiment of the present invention, where the method is applied to a Shader (Shader), the Shader (Shader) is usually used to implement image rendering and is used to replace an editable program of a fixed rendering pipeline, the Shader replaces a conventional fixed rendering pipeline, and can implement related calculations in 3D graphics calculations, and due to editability, various image effects can be implemented without being limited by the fixed rendering pipeline of a graphics card. As shown in fig. 1, the method for simulating the lighting effect of the dot matrix screen comprises the following specific steps:
step S102, cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; wherein, a unit corresponds a virtual lamp pearl of virtual dot matrix screen.
The virtual dot matrix screen can be a simulated LED electronic display screen, the LED electronic display screen is generally formed by uniformly arranging tens of thousands to hundreds of thousands of semiconductor light-emitting diode pixel points, and the LED pixel points with different colors can be manufactured by using different materials. In specific implementation, in order to realize fine control of the whole screen of the virtual dot matrix screen, the UV space of the virtual dot matrix screen needs to be cut into one unit, and in order to realize fine control of each unit, an independent UV space can be set for each unit. Specifically, U and V in the UV space represent chromaticity, which is used to describe image color and saturation for specifying the color of a pixel.
As shown in fig. 2, which is a schematic diagram of the cutting of the UV space, UV0 in fig. 2 represents the UV space of the virtual dot matrix screen without any processing, and the UV space has components of two directions, i.e., U direction (corresponding to the X-axis direction in the cartesian coordinate system) and V direction (corresponding to the Y-axis direction in the cartesian coordinate system); UV1 in fig. 2 represents the UV space being cut; UV1 in fig. 2 represents a cut UV space, and the cut UV space is cut into square cells, wherein each cell corresponds to a sub-UV space, and each cell corresponds to a virtual lamp bead, so that the display brightness and color of the virtual lamp bead can be controlled by controlling the brightness and color of the cell. The sub-space corresponds to a UV space corresponding to one cell in the UV space after cutting.
And step S104, adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit.
The control instruction may be to adjust color, brightness, or saturation in the sub-UV space corresponding to each unit; or inputting a preview image or animation into the sub-UV space corresponding to each unit, and adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the type of the preview image or the animation; the display style of the virtual lamp bead corresponding to each unit can also be adjusted, for example, the virtual lamp bead flickers in a diffusion mode from the center outwards, and the flickering lamp gradually flickers from one end to the other end. The control command may be set according to a user requirement, and is not specifically limited herein.
The display effect of the virtual lamp bead comprises the display color, the display brightness, the display saturation, the display mode, the display style and the like of the virtual lamp bead. During specific implementation, the display effect of the real dot matrix screen can be simulated by adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen, so that the real stage effect can be simulated.
The embodiment of the invention provides a light effect simulation method of a dot matrix screen, which comprises the following steps of firstly cutting a UV space of a virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces, and one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and then according to the control command to the unit, adjust the display effect of virtual lamp pearl in the virtual dot matrix screen. In the mode, the UV space of the virtual dot matrix screen is cut into small units, so that each small unit and the whole dot matrix screen can be finely controlled, and the controllable requirement of a user is met; in addition, the light effect simulation of the virtual dot matrix screen is completely realized by the shader, so that the simulation flow can be simplified, the operation complexity can be reduced, the requirement of real-time operation can be met, and the simulation of the virtual dot matrix screen can be easily expanded.
The embodiment of the invention also provides another light effect simulation method of the dot matrix screen, which is realized on the basis of the embodiment, and the method mainly describes a specific process of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit (realized by the following steps S304-S306); as shown in fig. 3, the method comprises the following specific steps:
step S302, cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; wherein, a unit corresponds a virtual lamp pearl of virtual dot matrix screen.
In a specific implementation, in order to realize fine control over the whole virtual dot matrix screen, the following codes are arranged on a shader to cut the whole UV space of the virtual dot matrix screen into one unit:
float2_uv1=float2(_uv_tile_x*uv0.x,_uv_tile_y*uv0.y);
float2 uv1=floor(_uv1);
uv1=float2(uv1.x/_uv_tile_x,uv1.y/_uv_tile_y);
float2 d1=frac((uv0-uv1)*float2(_uv_tile_x,_uv_tile_y))-0.5;
float led1=smoothstep(0.5,_cellGap,abs(d1.x))*smoothstep(0.5,_cellGap,abs(d1.y));
uv1*=led1;
the above-mentioned _ UV _ tile _ x and _ UV _ tile _ y represent the division of the UV space in the U direction and the division in the V direction, respectively, and may be understood as the division number in the U direction and the division number in the V direction, and the larger the division number is, the larger the number of cells to be divided in the axial direction is. The _ cellGap represents a preset cell pitch (which may also be referred to as a primitive gap); the smooth step may be referred to as a smooth step function, and may be used to generate a smooth transition value within a predetermined range of intervals (e.g., the range of 0.5 to _ cellGap described above). The role of the float function is to take the smallest integer of a floating point number (e.g., 1.0 would be output if 1.4 were input). The code functions to change the original UV0 space in fig. 2 into a UV1 space in which individual cells are arranged.
In some embodiments, to achieve fine control over each unit, a separate set of UV spaces may also be provided for each unit, implementing code (which is provided in the shader) as follows:
float2_uv2=float2(_uv_tile_x*uv0.x,_uv_tile_y*uv0.y);
float2 uv2=frac(_uv2)*step(1.0,led1);
as shown in fig. 4, which is a schematic diagram of the UV space after the virtual dot matrix screen is cut, UV1 in fig. 4 represents the UV space after the UV space of the whole virtual dot matrix screen is cut into one unit; UV2 shows a schematic diagram in which a UV space is set independently for each UV space after the UV space of the entire virtual dot matrix screen is cut into cells one by one. The color and saturation of the UV space corresponding to each unit in the UV2 is the same as that of the corresponding UV space when the whole dot matrix screen is not cut.
And step S304, obtaining the mosaic image of the sub UV space corresponding to each unit according to the random noise.
The random noise may be a noise image, and the noise image is input into a cut UV space (the cut UV space corresponds to a subspace corresponding to all cells in the virtual dot matrix screen), so as to obtain a mosaic image corresponding to the UV space, where each image area in the mosaic image corresponds to one cell. As shown in fig. 5, which is a schematic diagram of a mosaic image corresponding to sub-UV spaces, each cell of the mosaic image in fig. 5 corresponds to one cell in the UV space.
In a specific implementation, random noise may be generated by a preset noise generator, and then the generated random noise is input to the sub UV space corresponding to each cell to output a mosaic image. The noise generator may generate random noise through a random seed generator.
And S306, controlling the brightness of each virtual lamp bead in the virtual dot matrix screen based on the pixel value of the mosaic image.
In specific implementation, the brightness value of the virtual lamp bead corresponding to each pixel value in the mosaic image can be set in advance, and then the brightness of the virtual lamp bead corresponding to each unit in the virtual dot matrix screen can be determined according to the pixel value of each unit in the mosaic image. For example, when the pixel value is 0, the virtual lamp bead may be set to an off state, when the pixel value is 1, the virtual lamp bead may be set to a full-on state, and when the pixel value is in the middle, the brightness may be set according to the size of the pixel value (the larger the pixel value is, the higher the brightness value of the virtual lamp bead is).
In some embodiments, the mosaic image may be a grayscale image; the step S306 can be implemented as follows: and aiming at each unit in the virtual dot matrix screen, determining the brightness of the virtual lamp bead corresponding to the current unit according to the gray value of the current unit in the mosaic image.
The current unit can be any one of the virtual dot matrix screens, and the brightness value of the virtual lamp bead corresponding to each unit can be determined according to the gray value in the mosaic image corresponding to the unit. For example, if the gray value of the current unit in the mosaic image is a first numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a turn-off state; if the gray value of the current unit in the mosaic image is a second numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a full-bright state; and if the gray value of the current unit in the mosaic image is larger than the first numerical value and smaller than the second numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit according to the gray value.
The first value and the second value can be set according to user requirements. Specifically, the first numerical value may be 0, the second numerical value may be 255, and when the gray value of each cell in the mosaic image is greater than 0 and less than 255, the brightness of the virtual lamp bead of the cell may be determined according to the size of the current gray value, for example, the larger the gray value is, the brighter the virtual lamp bead is; different brightness values can also be set for each gray value (specifically, the brightness values can be set according to research and development requirements).
In some embodiments, the above steps S304-S306 can be implemented by setting the following code in the shader:
wherein freq in the code represents noise frequency, which can be understood as noise random degree; scale represents frame scaling and represents the diffusion rate of the noise.
In the related technology, usually the on-off of each virtual lamp bead is controlled in a programmed manner, and then a set of very complex system is designed for each virtual lamp bead, but the calculation amount of the method is large, and participants can not feel the fine change in most cases, so that the scheme uses a rough strategy to process the on-off condition and the brightness level of the virtual lamp beads, namely, random noise is input into the UV space of the cut virtual dot matrix screen through a noise generator, and then the brightness of the virtual lamp beads is controlled through the gray value of the output mosaic image. The method is simple and easy to implement and is suitable for a scene running in real time.
The method for simulating the lighting effect of the dot matrix screen is a brand-new LED dot matrix screen simulation method which is completely based on a shader, can meet the real-time operation requirement and is easy to expand.
The embodiment of the invention also provides another light effect simulation method of the dot matrix screen, which is realized on the basis of the embodiment, and the method mainly describes a specific process of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit (realized by the following step S606); as shown in fig. 6, the method includes the following specific steps:
step S602, cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; wherein, a unit corresponds a virtual lamp pearl of virtual dot matrix screen, and every unit setting is in the cartesian coordinate system.
In a specific implementation, the coordinates of each unit are set in a cartesian coordinate system, where the X-axis direction in the coordinate system corresponds to the U-direction in the sub-UV space, and the Y-axis direction corresponds to the V-direction in the sub-UV space.
And step S604, performing coordinate conversion on the sub UV space corresponding to each unit to obtain the UV space under a polar coordinate system.
The patterns in the actual dot matrix screen may be very complex, and in order to adapt to the expression of two subjects of lamp ring diffusion and motion graph of the virtual lamp bead, a cartesian coordinate system and a polar coordinate system need to be controllably switched. In specific implementation, the following codes can be set in the shader to implement coordinate system transformation:
in the above code, Center represents a virtual bead Center point, RadialScale represents a virtual bead size, LengthScale represents a virtual bead radius, delta.x represents a component in the U direction in the sub-UV space, and delta.y represents a component in the V direction in the sub-UV space. Specifically, the virtual lamp bead provided in the embodiment of the present invention is a circular virtual lamp bead, the larger the radius of the virtual lamp bead is, the larger the virtual lamp bead is, and the size of the virtual lamp bead does not exceed the size of the corresponding unit.
And step S606, under a polar coordinate system, based on two preset lamp bead ranges with frame time difference, controlling the virtual lamp beads corresponding to the designated units to be outwards diffused and lightened from the original points along the polar axis.
In a specific implementation, the designated units are provided with independent UV spaces, and the designated units can be any one or more units in the UV2 space shown in fig. 4, and can also be all units in the UV 2. The two sets of lamp bead ranges with the frame time difference can be set according to research and development requirements, and therefore the diffusion range of the virtual lamp bead lamp ring is determined according to the lamp bead ranges.
In some embodiments, the step S606 can be implemented by the following steps 10-12:
and step 10, sampling the designated units to obtain a virtual lamp bead map.
The virtual lamp bead mapping is an image corresponding to the virtual lamp beads obtained after sampling the designated unit. As shown in fig. 7, a display effect diagram of a virtual lamp bead in a cut UV space in a turned-off state is shown, each circle in fig. 7 corresponds to one virtual lamp bead, and each virtual lamp bead displays the original texture of a bulb in the turned-off state, so that the display mode is closer to the real display effect of the virtual lamp bead in the turned-off state.
In some embodiments, the virtual bead display effect in the extinguished state may also be in a hidden state, specifically controlled by the research and development parameters.
And 11, obtaining an interpolation range according to two preset lamp bead ranges with frame time differences.
During specific implementation, two preset lamp bead ranges with frame time differences are obtained through a smooth step function; and subtracting the two sets of lamp bead ranges to obtain an interpolation range.
And 12, based on the interpolation range, performing linear difference on the virtual lamp bead maps to control the virtual lamp beads corresponding to the virtual lamp bead maps to be outwards diffused and lightened from the original points along the polar axis.
As shown in fig. 8, the effect diagram of the virtual dot matrix screen after the virtual beads are lit is shown, and the lamp rings of the virtual beads lit in fig. 8 are different in size and are specifically determined according to the set parameters. Specifically, the following code is code that implements steps 10-12 described above:
//Random led flicker spread
float2 t=float2(Polar_UV_01.x+NoiseFactor,Polar_UV_01.y+NoiseFactor);
float A=smoothstep(_TimeFactor-_lightWeight,_TimeFactor,t.x);
float B=smoothstep(_TimeFactor,_TimeFactor+_lightWeight,t.x);
half4 LEDCells=ArrayCells.Sample(s_ArrayCells,uv2);
half4 Spread1=lerp(LEDCells*_lightDarkStrengh,half4(1.0-Polar_UV_02.x)*_lightColor,float4(A-B));
float fac=smoothstep(_lightGapScale,_lightGapScale+0.3,Polar_UV_02.x);
half4 out_color=lerp(Spread1,float4(0.0,0.0,0.0,0.0),float4(fac,fac,fac,fac));
in the above code, t represents a random event, a represents a virtual bead diffusion range 1, B represents a virtual bead diffusion range 2, leds represent a sampled virtual bead map, Spread1 represents a bead diffusion calculated by subtracting B from a, lightWeight represents the number of virtual beads with a parameter flashing, lightgap represents a virtual bead brightness level, lightdarkstrenggh represents whether the virtual beads show an original texture (normal color texture) after being extinguished, and lightColor represents a virtual bead light emission color.
According to the light effect simulation method of the dot matrix screen, in a polar coordinate system mode, the virtual lamp beads can be lightened in an outward diffusion mode along the polar axis from the original point, and the visual characteristic of lamp ring diffusion can be circled by subtracting two lamp bead ranges with frame time difference. The method can simulate the dot matrix screen more truly, has more sufficient substitution feeling, and meanwhile, the function of the virtual dot matrix in the simulation method is easy to expand, is friendly to artists, and is suitable for a real-time operation scene.
The embodiment of the invention also provides another light effect simulation method of the dot matrix screen, which is realized on the basis of the embodiment, and the method mainly describes a specific process of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit (realized by the following steps S904-S908); as shown in fig. 9, the method includes the following specific steps:
step S902, cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; wherein, a unit corresponds a virtual lamp pearl of virtual dot matrix screen, and every unit setting is in the cartesian coordinate system.
And step S904, controlling the virtual lamp beads corresponding to each unit in the virtual dot matrix screen to flow and flash according to a preset image according to a first speed set in the X-axis direction and/or a second speed set in the Y-axis direction in the sub UV space.
In a specific implementation, the first speed may be set only in the X-axis direction of the sub-UV space, the second speed may be set only in the Y-axis direction of the sub-UV space, or both the first speed and the second speed may be set in the X-axis direction and the Y-axis direction. Above-mentioned first speed and second speed can set up according to user's demand, and the speed of setting is big more, and virtual lamp pearl flows the mobile speed of scintillation big more in the sub UV space.
The preset image may be any image that the user wants to present through the virtual electronic screen. Specifically, after a user sets a first speed and/or a second speed for an X-axis direction and/or a Y-axis direction in a sub-UV space, the UV space can flow, then the flowing UV space is used for sampling a preset image to obtain a sampling image, and the sampling image can be controlled to flow and flicker on a virtual dot matrix screen through a virtual lamp bead according to the first speed set in the X-axis direction and/or the second speed set in the Y-axis direction. That is, the mode can realize the function of presetting picture flow and can control the flow speed and the flow direction.
Step S906, sampling the preset grayscale map in response to the input operation of the preset grayscale map, so as to obtain a sampled grayscale map.
Step S908, determining the display color of the virtual bead in the virtual dot matrix screen according to the gray value of the sampled gray map.
The preset gray-scale image can be set according to the preset mask requirement, then the gray-scale image is sampled to serve as the Alpha value of the final output image, the range of the gray-scale value is 0-255, 255 is that the output color is completely displayed, 0 is that the color is not output at all, the intermediate value can be output color values in different degrees according to the size of the gray-scale value, and generally, the larger the gray-scale value is, the more the output colors are.
Above-mentioned light effect simulation method of dot matrix screen not only can realize the lamp ring diffusion under polar coordinate system, can demonstrate the effect of various complicated pictures for emulation real LED dot matrix screen, this mode provides streamer and shade function under one set of cartesian coordinate system, just so can demonstrate heavy and complicated change in the dot matrix screen through the mode of image sampling, and be of value to the control of user light effect in the virtual dot matrix screen, and then can promote user experience.
Corresponding to the above method embodiment, an embodiment of the present invention provides a light effect simulation apparatus for a dot matrix screen, as shown in fig. 10, the apparatus includes:
the cutting module 1000 is configured to cut the UV space of the virtual dot matrix screen to obtain a plurality of cut units, where the plurality of units correspond to respective subspaces; wherein, a unit corresponds a virtual lamp pearl of virtual dot matrix screen.
And the control module 1001 is configured to adjust the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction for the unit.
The light effect simulation device of the dot matrix screen firstly cuts the UV space of the virtual dot matrix screen to obtain a plurality of cut units, the plurality of units correspond to respective sub-UV spaces, and one unit corresponds to one virtual lamp bead of the virtual dot matrix screen; and then according to the control command to the unit, adjust the display effect of virtual lamp pearl in the virtual dot matrix screen. In the mode, the UV space of the virtual dot matrix screen is cut into small units, so that each small unit and the whole dot matrix screen can be finely controlled, and the controllable requirement of a user is met; in addition, the light effect simulation of the virtual dot matrix screen is completely realized by the shader, so that the simulation flow can be simplified, the operation complexity can be reduced, the requirement of real-time operation can be met, and the simulation of the virtual dot matrix screen can be easily expanded.
Further, the control module 1001 is further configured to: obtaining a mosaic image of a sub UV space corresponding to each unit according to random noise; and controlling the brightness of the virtual lamp beads in the virtual dot matrix screen based on the pixel values of the mosaic image.
In some embodiments, the mosaic image is a grayscale image; the control module 81 is further configured to: and aiming at each unit in the virtual dot matrix screen, determining the brightness of the virtual lamp bead corresponding to the current unit according to the gray value of the current unit in the mosaic image.
During specific implementation, if the gray value of the current unit in the mosaic image is a first numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a turn-off state; if the gray value of the current unit in the mosaic image is a second numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a full-bright state; and if the gray value of the current unit in the mosaic image is larger than the first numerical value and smaller than the second numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit according to the gray value.
Further, the control module 1001 is further configured to: generating random noise through a preset noise generator; and inputting the generated random noise into the sub-UV space corresponding to each unit, and outputting a mosaic image.
In some embodiments, each cell is arranged in a cartesian coordinate system, the apparatus further comprising a coordinate transformation module for: and before the display effect of the virtual lamp beads in the virtual dot matrix screen is adjusted according to the control instruction for the units, performing coordinate conversion on the sub UV space corresponding to each unit to obtain the UV space under a polar coordinate system.
Further, the control module 1001 is further configured to: and under a polar coordinate system, based on two preset lamp bead ranges with frame time difference, controlling the virtual lamp beads corresponding to the designated units to be lightened by the original point along the polar axis in an outward diffusion mode. The designated unit is provided with a separate UV space.
Specifically, the control module 1001 is further configured to: sampling the designated units to obtain virtual lamp bead maps; obtaining an interpolation range according to two preset lamp bead ranges with frame time differences; based on the interpolation range, the virtual lamp bead mapping is subjected to linear difference to control the virtual lamp beads corresponding to the virtual lamp bead mapping to be lightened by the original point along the polar axis in an outward diffusion mode.
In a specific implementation, the control module 1001 is further configured to: obtaining two preset lamp bead ranges with frame time differences through a smooth step function; and subtracting the two sets of lamp bead ranges to obtain an interpolation range.
Further, each cell is arranged in a cartesian coordinate system; the control module 1001 is further configured to: and controlling the virtual lamp beads corresponding to each unit in the virtual dot matrix screen to flow and flash according to a preset image according to a first speed set in the X-axis direction and/or a second speed set in the Y-axis direction in the sub UV space.
In a specific implementation, the control module 81 is further configured to: sampling a preset image to obtain a sampled image; and controlling the sampled image to flow and flicker on the virtual dot matrix screen through the virtual lamp beads according to the first speed set in the X-axis direction and/or the second speed set in the Y-axis direction.
Further, the control module 81 is further configured to: responding to the input operation of a preset gray-scale image, and sampling the preset gray-scale image to obtain a sampled gray-scale image; and determining the display color of the virtual lamp beads in the virtual dot matrix screen by sampling the gray value of the gray map.
The light effect simulation device of the dot matrix screen provided by the embodiment of the invention has the same realization principle and generated technical effect as the method embodiment, and for brief description, the corresponding content in the method embodiment can be referred to where the device embodiment is not mentioned.
An embodiment of the present invention further provides an electronic device, as shown in fig. 11, where the electronic device includes a processor 101 and a memory 100, where the memory 100 stores machine executable instructions capable of being executed by the processor 101, and the processor 101 executes the machine executable instructions to implement the light effect simulation method for a dot matrix screen.
Further, the electronic device shown in fig. 11 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
The Memory 100 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 11, but that does not indicate only one bus or one type of bus.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100, and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method for simulating the lighting effect of the dot matrix screen, where specific implementation may refer to method embodiments, and details are not described herein.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (16)
1. A method for simulating a light effect of a dot matrix screen, the method comprising:
cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, wherein the plurality of units correspond to respective sub-UV spaces; one unit corresponds to one virtual lamp bead of the virtual dot matrix screen;
and adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit.
2. The method of claim 1, wherein the step of adjusting the display effect of the virtual beads in the virtual dot matrix screen according to the control command for the unit comprises:
obtaining a mosaic image of the sub UV space corresponding to each unit according to random noise;
and controlling the brightness of the virtual lamp beads in the virtual dot matrix screen based on the pixel values of the mosaic image.
3. The method according to claim 2, wherein the mosaic image is a grayscale image;
the step of controlling the brightness of the virtual lamp beads in the virtual dot matrix screen according to the pixel values of the mosaic image comprises the following steps:
and aiming at each unit in the virtual dot matrix screen, determining the brightness of the virtual lamp bead corresponding to the current unit according to the gray value of the current unit in the mosaic image.
4. The method according to claim 3, wherein the step of determining the brightness of the virtual bead corresponding to the current cell according to the gray-level value of the current cell in the mosaic image comprises:
if the gray value of the current unit in the mosaic image is a first numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit to be in a turn-off state;
if the gray value of the current unit in the mosaic image is a second numerical value, the brightness of the virtual lamp bead corresponding to the current unit is set to be in a full-bright state;
and if the gray value of the current unit in the mosaic image is larger than the first numerical value and smaller than the second numerical value, setting the brightness of the virtual lamp bead corresponding to the current unit according to the gray value.
5. The method according to claim 2, wherein the step of obtaining the mosaic image of the sub-UV space corresponding to each of the units according to random noise comprises:
generating random noise through a preset noise generator;
and inputting the generated random noise into the sub UV space corresponding to each unit, and outputting the mosaic image.
6. The method of claim 1, wherein each of said cells is arranged in a cartesian coordinate system;
before the step of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction for the unit, the method further includes:
and performing coordinate conversion on the sub UV space corresponding to each unit to obtain a UV space under a polar coordinate system.
7. The method of claim 6, wherein the step of adjusting the display effect of the virtual beads in the virtual dot matrix screen according to the control command for the unit comprises:
and under the polar coordinate system, based on two preset lamp bead ranges with frame time difference, controlling the virtual lamp beads corresponding to the designated units to be lightened by the original point along the polar axis in an outward diffusion mode.
8. The method of claim 7, wherein the step of controlling the virtual lamp beads corresponding to the designated units to be lit diffusely outward from the origin along the polar axis based on the two preset lamp bead ranges with the frame time difference comprises:
sampling the designated units to obtain virtual lamp bead maps;
obtaining an interpolation range according to two preset lamp bead ranges with frame time differences;
and carrying out linear difference on the virtual lamp bead map based on the interpolation range so as to control the virtual lamp beads corresponding to the virtual lamp bead map to be lightened by the original point along the polar axis in an outward diffusion mode.
9. The method of claim 8, wherein the step of obtaining an interpolation range according to two preset lamp bead ranges with frame time differences comprises:
obtaining two preset lamp bead ranges with frame time differences through a smooth step function;
and subtracting the two sets of lamp bead ranges to obtain an interpolation range.
10. The method according to claim 7, wherein the designated cell is provided with a separate UV space.
11. The method of claim 1, wherein each of said cells is arranged in a cartesian coordinate system;
the step of adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction for the unit comprises the following steps:
and controlling the virtual lamp bead corresponding to each unit in the virtual dot matrix screen to flow and flash according to a preset image according to a first speed set in the X-axis direction and/or a second speed set in the Y-axis direction in the sub-UV space.
12. The method of claim 11, wherein the step of controlling the virtual lamp bead corresponding to each unit in the UV space to perform flowing flicker according to a preset image comprises:
sampling the preset image to obtain a sampled image;
and controlling the sampling image to flow and flicker on the virtual dot matrix screen through a virtual lamp bead according to the first speed set in the X-axis direction and/or the second speed set in the Y-axis direction.
13. The method of claim 1, wherein the step of adjusting the display effect of the virtual beads in the virtual dot matrix screen according to the control command for the unit comprises:
responding to the input operation of a preset gray-scale image, and sampling the preset gray-scale image to obtain a sampled gray-scale image;
and determining the display color of the virtual lamp beads in the virtual dot matrix screen according to the gray value of the sampling gray map.
14. A light effect simulator for a dot matrix screen, the simulator comprising:
the cutting module is used for cutting the UV space of the virtual dot matrix screen to obtain a plurality of cut units, and the plurality of units correspond to respective subspaces; one unit corresponds to one virtual lamp bead of the virtual dot matrix screen;
and the control module is used for adjusting the display effect of the virtual lamp beads in the virtual dot matrix screen according to the control instruction aiming at the unit.
15. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the method of light effect simulation of a dot matrix screen according to any one of claims 1 to 13.
16. A computer-readable storage medium having stored thereon computer-executable instructions which, when invoked and executed by a processor, cause the processor to implement a method of light effect simulation of a dot-matrix screen according to any one of claims 1 to 13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111592248.8A CN114266855A (en) | 2021-12-23 | 2021-12-23 | Light effect simulation method and device of dot matrix screen and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111592248.8A CN114266855A (en) | 2021-12-23 | 2021-12-23 | Light effect simulation method and device of dot matrix screen and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114266855A true CN114266855A (en) | 2022-04-01 |
Family
ID=80829356
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111592248.8A Pending CN114266855A (en) | 2021-12-23 | 2021-12-23 | Light effect simulation method and device of dot matrix screen and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114266855A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114949846A (en) * | 2022-05-17 | 2022-08-30 | 网易(杭州)网络有限公司 | Scene terrain generation method and device, electronic equipment and medium |
-
2021
- 2021-12-23 CN CN202111592248.8A patent/CN114266855A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114949846A (en) * | 2022-05-17 | 2022-08-30 | 网易(杭州)网络有限公司 | Scene terrain generation method and device, electronic equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108876931B (en) | Three-dimensional object color adjustment method and device, computer equipment and computer readable storage medium | |
CN106815883B (en) | Method and system for processing hair of game role | |
JP4680407B2 (en) | Coding with variable bit field | |
CN106600712B (en) | A kind of texture replacement method based on two dimensional image | |
CN110458930A (en) | Rendering method, device and the storage medium of three-dimensional map | |
CN109448089A (en) | A kind of rendering method and device | |
CN104392479B (en) | Method of carrying out illumination coloring on pixel by using light index number | |
CN110333924A (en) | A kind of image morphing method of adjustment, device, equipment and storage medium | |
CN102819855B (en) | The generation method of two dimensional image and device | |
CN110115841B (en) | Rendering method and device for vegetation object in game scene | |
CN114119818A (en) | Rendering method, device and equipment of scene model | |
JP2003242520A (en) | Data structure of texture data, program and texture mapping method | |
CN102541488B (en) | Image processing method and system for realizing seamless alignment of projection screen | |
US20040056859A1 (en) | Image generating method, storage medium, image generating apparatus, data signal and program | |
CN114266855A (en) | Light effect simulation method and device of dot matrix screen and electronic equipment | |
US7133052B1 (en) | Morph map based simulated real-time rendering | |
CN111583378A (en) | Virtual asset processing method and device, electronic equipment and storage medium | |
JP4174133B2 (en) | Image generation method | |
CN102521867B (en) | Mobile phone anime character and background creation method | |
CN102117347A (en) | Three-dimensional editing method for LED lighting scenes | |
CN110858153B (en) | Control self-adaptive display method and device | |
CN113313798B (en) | Cloud picture manufacturing method and device, storage medium and computer equipment | |
CN115131480A (en) | Method and device for manufacturing special effect of horse race lamp and electronic equipment | |
CN114937103A (en) | Model rendering method and device for dynamic effect, electronic equipment and storage medium | |
US20060033736A1 (en) | Enhanced Color and Lighting Model for Computer Graphics Productions |
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 |