God Ray)

Source: Internet
Author: User

God Ray looks awesome. It's actually very simple. Now there's almost no game to use. In May of this year, I also tried to do this in the project, which is indeed much easier than I thought. I have always wanted to write an article, but I have never had time to write it down. It is not difficult. If you do things, that is, a day or two.

 

Thanks to my colleague Aman Jiang, who optimized my previous God Ray processing method to make it more appropriate. In addition, I have introduced several good articles. Although some methods cannot be implemented due to engine restrictions, I finally tried to find a solution together.

(Alas, how nice it is to give me more time ...... I made t_t myself)

 

The image is excerpted from crysis. Thanks to crytech for this great game.

 

However, gaming graphics have entered a new era, and it is almost impossible to monopolize the market through technology. The vast majority of game manufacturers are almost on the same starting line-any very good effect will soon be cracked and used by countless people.

The current European and American masterpiece looks like this.

The era of pursuing graphics is over, and even the era of pursuing physics is over. Perhaps more importantly, it is to think about how to use existing means to make games better ......

 

God Ray occurs in the final pixel space. If you can determine that the location of the pixel space in the sunlight is CX cy, the process is similar to this:

First, retained the previous vertex or the render target of the current vertex for processing. We call this image as a reference image tex_ref.

Then, from the current pixel X, Y, to the Cx Cy as a line segment, on this line segment, according to a certain number (assume: 32) sample the render target of the current or upper vertex, and add the sampling results to obtain the total light intensity P affected by the highlights of the current vertex.

Then, use POW (p, param_power) * param_intensity to obtain the final light intensity.

 

This mainly means that for a strong area, the energy will be extended along the line with the reference point based on the strength of the light and the position of the reference point. In this way, the strong area is blurred and magnified. The final result is that the shape of the area is stimulated and mixed with the original color of the scene to form the effect of light.

 

If your algorithm is just the same as above, congratulations, you are about to cry.

 

First of all, the special effects of the game are much higher than the high light intensity in the scenario. Some materials may be reflected to a large extent due to the strong light intensity. The direct result of this operation is: as soon as you put the special effect, you will see a set of flashes from the special effect. Or a piece of metal suddenly emits a flash.

The solution to this problem has been provided by foreigners: When you render the tex_ref of God Ray, all the mesh is rendered in black except lensflare and the sky box, particles are excluded from this pass. The final result is: Only lensflare in the scenario and the high-light domain on the sky box will issue God Ray, which is exactly what we want. This method consumes one more pass and cannot use the render target of the upper limit. However, this should be worthwhile for the final effect, if the number of objects in your scenario is small, try it. After all, the pixel phase of this approach is very simple, that is, simply returning black or a color based on the logo, with very few samples.

 

Second, what you see now is likely to have no high-intensity domain, but it should have a magical effect. For example, if you lean against a wall and there is a hole in the wall, there is a large bulb outside the hole, but unfortunately because you are leaning against the wall, the hole is very small in your perspective, and it is not revealed, so you cannot see this bulb. However, in reality, there should be a ray of light coming out of the slit. There are multiple solutions to this problem. The first one is to draw a reference convex on the Tex ref. It is a little troublesome to use the scale. Another method is more direct: Let the art put a slightly smaller highlight point in this place, and let the highlight point emit God Ray.

 

Third, when the high-Light Fields in the empty box are large and relatively regular, and there is no blockage in front of the box, the whole light will become a large volume, which will make the whole scene very explosive, it will also hurt the eyes of all over the world. This is the best solution: the shader uses a 1D noise texture or a 2D noise texture to control the intensity of God Ray sampling. Due to engine restrictions, the first two points cannot be completed well. The third point is that the changes are large and the results are very good.

 

More problems have not yet been encountered. I think there will be a better way for anyone who has studied this thing. Please kindly advise.

 

 

What I admire most now is God Ray of a Chinese game ...... In the screen space, we pasted a flashing texture animation with Alpha ...... No matter where the light source is, this effect has been fixed at the bottom left of your monitor ...... I lament that China really does not lack the talent to be fooled. The effect can only be good. In fact, it doesn't matter if you don't worry. In fact, in the end, which of the following is NOT a fool ?......

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.