ArticleDirectory
Wow's rendering engine supports both Fixed rendering pipeline rendering and shader rendering pipeline rendering.
The ghost file is a wow shader file. After analyzing its implementation, you can learn how the engine is rendered and how to build an engine compatible with fixed pipelines and shader pipelines.
The OpenGL low-level shading language commands, terrain1.bls, terrain2.bls, terrain3.bls, and terrain4.bls, respectively, are stored in rendering a texture terrain with 1/2/3/4 layers. terrain1_s.htm, terrain2_s.htm, terrain3_s.htm, and terrain4_s.htm correspond to the terrain with high-gloss reflection, respectively. They correspond to the terrain texture with _ S.
Although the shader canAlgorithmThe layer textures are used in combination with the sequence. However, the wow shader is still limited by its compatibility with fixed pipelines. The arbfp1.0 standard is used to overlay the layers in a standard texture hierarchy. we can see from the texture used,
Layer0texture, layer1texture,..., and blendtexture. Each component of blendtexture is an Alpha image,
When the terrain block is a layer-3 texture, the first layer directly renders an Alpha image, and the second and second layers each require an Alpha image, that is, two alpha images, the two alpha images are stored on the X and W components of blendtexture.
When layer-4 textures are used, use x/y/W of blendtexture to create three alpha images.
Because there are a maximum of four levels of terrain textures, blendtexture's Z is left for use as a shadow, and the shader of the entire terrain block is completed.
Posted on linghuye reading (2332) Comments (20) EDIT favorites Reference Category: 3D graphics Research
Comment # Re: analyze the wow shader file and reply to more comments
What company is wow's image engine?
| Ori # Re: Analysis of wow shader file reply more comments
Well, it's their own engine.
| Civilian Program # Re: Analysis of wow shader file reply more comments
Eldest brother, I have a Bt <ghost WARRIOR 3 PC version> game ,,,,
This game has a very good model. It was made by Japanese devils,
The main character is Jin chengwu's model!
I would like to bring up the model in it for demo,
I checked that the files in the package are very simple. They are all. LDT
All music files can be played with Winamp,
Many texture files can be opened directly using ACDSee,
I want to ask my eldest brother to take a Trojan and help me analyze Japanese ghost-shaped files.
Http://dl2.www2.btchina.net/download.php? S = b93561e4b5ada269 & attachmentid = 589803
This is the BT seed.
| Ori # Re: Analysis of wow shader file reply more comments
To Ori
Are you here looking for hard work?
| KOKK # Re: analyze the wow shader file and reply to more comments
Analyzing Models and emancipating resources are all fun and hobbies of linghuye's boss. Why?
I also want to do this very much. Although my technology is simple, I can't help it!
| Ori # Re: Analysis of wow shader file reply more comments
My wowmapview compilation failed. I don't know where to download it, or can I get a horse? Thank you inversewalking@133sh.com
I was the one who asked you about horizontal cutting last time.
Thank you!
| Zeng # Re: analyze the wow shader file and reply to more comments
No sdl_opengl.h,
| Zeng # Re: analyze the wow shader file and reply to more comments
The required SDL package can be downloaded from the http://www.libsdl.org/index.php to download the source code package.
The SDL/SDL. h and SDL/sdl_opengl.h in wowmapview are all in the include directory of the SDL package,
Copy a project under the wowmapviewproject directory and change it to the sdldirectory. Then, use the C project file in visualc.zip to compile and generate the DLL.
| Civilian Program # Re: Analysis of wow shader file reply more comments
If different pass is designed for different texture layers, which means that the wow terrain is indeed rendered by chunk? Will there be too many DP calls? And you need to constantly switch the texture ......
| Zero # Re: Analysis of the wow shader File
I mean, if the texture is used for rendering, it means that each visible texture is rendered once, and each rendering provides an Alpha image corresponding to the texture (not required for the first layer ), of course, this requires that the mesh corresponding to each texture be organized during running. The advantage of this rendering is that there are few DP calls, and the number of texture types is exactly the number of DP calls, and there is no need to switch the texture frequently. The disadvantage is that pixels with Multi-Layer Texture overlapping are actually rendered multiple times, and most vertices have to be processed multiple times ...... I have no confidence in what I said. I have no experience in the case that intensive and detailed DP calls can affect efficiency to a great extent. I will try again.
Wow basically does not have a level of detail (there can be a maximum of two levels). If you use the level of detail (level of detail, in the worst case, for a chunk in the distance, a DP call may only draw two triangles, which is quite unpleasant to think.
| Zero # Re: Analysis of the wow shader File
What is DP?
Switching the compressed texture in the video memory, I thought it was a little expensive and I didn't need to download it every time.
What is important is that there are requirements in each visible order. Not a simple texture is rendered once, and the final rendering effect cannot be achieved. A chunk's texture overlay weights on each layer are accumulated.
I don't know how to render each visible texture once and do not press chunk for rendering. How can I do this?
In addition, what I thought should be avoided in practice seems to be "and most vertices must be processed multiple times ".
| Civilian Program # Re: Analysis of the wow shader File
DP may be the drawpramitive function, d3d
| Fannyfish # Re: Analysis of the wow shader File
Yes, DP is the drawprimitive (drawindexedprimitive) of d3d ).
Texture-based rendering without chunk. Specifically, for each texture, the chunk vertices used in the texture are combined into a large vertex buffer (or index buffer ), use an Alpha chart (actually only one channel is needed) to control the hybrid weight of the Layer Texture at each vertex position. In this way, the final result is obtained after each layer of texture is rendered.
| Zero # Re: Analysis of the wow shader File
This is just my initial consideration and has not been put into practice. I will try both solutions. Which of the following is highly efficient.
| Zero # Re: Analysis of the wow shader File
In my opinion, texture-based rendering is not an issue of efficiency, but I suspect that it is impossible to achieve the effect of terrain and texture mixing in WoW. the rendering formula I know is (A * (1-a1) + B * A1) * (1-a2) + C * A2, it is not a simple weight mixing like a * A0 + B * A1 + C * A2.
I once thought about rendering by material classification. The conclusion is that it is not feasible. We can only minimize the number of texture material switching, but not completely rendering by material classification.
Wow's Alpha layer data is attached to each chunk, so rendering by chunk is more natural. The optimization of reducing material switching is based on chunk as the rendering unit, that is to say, the classification has the same number of layers, uses the same shader, and uses the chunk with similar textures.
However, we look forward to your practice.
// By the way, I do not like the abbreviation DP. I use OpenGL and prefer VBO, PbO, RTT, :), just joking.
| Civilian Program # Re: Analysis of the wow shader File
I have already implemented it.
The method is to provide two texturestages to the video card when rendering the texture of each layer. stage0 is an Alpha image (that is, only the alpha channel of the image is used, if a programmable pipeline is used, a maximum of four layers of alpha can be inserted into an Alpha pipeline. For this layer, the color gets current, and the Alpha gets texture; stage1 is the texture, and the color gets texture, alpha takes current. Then, in the frame cache, combine the texture with the preceding result: srcblend is set to srcalpha, and destblend is set to invsrcalpha. That is to say for each layer of texture is: res_n = Cur_n-1 * (1-alpha_n) + color_n * alpha_n 2006-05-23 | zero # Re: Analysis of wow shader file reply more comments
Sorry, I am talking about d3d. I have never used OGL, but I should have similar concepts.
| Zero # Re: Analysis of the wow shader File
After that, I took a look at the wow terrain rendering ghost file. Previously, we used HLSL, which is hard to see in the form of assembly, but I still understood it.
I think you are not careful enough. The X, Y, and Z channels of the Alpha image correspond to the Alpha weights of the texture layers 1, 2, and 3 respectively (as you said, they are related to the order of superposition ), the W channel should be the shadow value (1 is the shadow, 0 is normal), and it can be seen that the highlighted light in the shadow is blocked, and the diffuse brightness of 70% is kept.
| Zero # Re: Analysis of the wow shader File
To civilianProgram,
My understanding is exactly the same as yours, and similar outdoor terrain is also achieved. There is a slight difference here, that is, wow may have saved the blend factor in the texture, and then sampler in PS, while I directly added a vertex stream, save the Alpha value of float4 and use the semantics of texcoord1 to let the vertex rendering engine directly perform interpolation.
I really want to make friends with you. I am in Shanghai.
| Jackwolf # Re: Analysis of the wow shader File
LOL can't read nothing
All is Chinese