Skip to main content
GameDev.net gamedev.net
🔒 Locked

How transparent character in WoW is rendered

Started by pcwlai Apr 24, 2007 at 11:44 PM 18 replies 3.2k views
Original Post
pcwlai
pcwlai
As topic. Common observation for single and overlapping transparent characters: Only front facing polygons visible (like normal solid character) Observation for single transparent character: Character parts and accessories rendered with correct z-depth result, e.g. the shoulder equipment covering the character shoulder as in solid rendering. Observation for overlapping transparent characters: In the same character, same result as in single transparent character. Across the overlapping characters, the behave like normal alpha blending result, e.g. the character penetrated into another character is rendered. My try to archive the single transparent character is by using 2 passes, 1st with depth write only then 2nd with normal alpha blending. Though this cannot archive the overlapping solution. Anyone have an idea on how to archive both result? (p.s. multiple render target is not required as WoW can render the result on GPUs with only 1 render target)
The poorest programmer in the game industry!!
lc_overlord
lc_overlord
Well your close, but instead of doing it for all transparent objects in one go, do it like this.
First sort all transperent objects back to front.
Then render all opaque objects.
Finally render all transparent objects(back to front) two times each, first with depth only and secondly with alpha blending.
They probably use either color masking or adjust the alpha setting to reduce any unwanted state changes.
Christian Weis
Christian Weis
You havn't shown some pics but I think they used the special case where alpha is "0.5" . This way it dosn't matter whether to draw from front to back or the other way around. No sorting required also. After all solid geometry enable depth testing but disable depth writes and draw them.

cu,
Chris
pcwlai
pcwlai
I would like to post some screen shots though I don't find a place to upload them, any suggestion on a free of charge place to do so?

In a single character composing many objects, like the character and the equipments, the alpha rendering is just like normal solid object but transparent. This can be archived by the method described by lc_overlord (I tested).

In multiple characters though, when they overlap or penetrate each other, you still can see their whole. With the above mentioned method, the character rendered later with parts overlapping with early transparent ones will be masked by the previous depth values.

What I can think of is, creating a secondary depth buffer, store depth buffer after all solid rendering restore, after rendering each character by 2 pass method, restore it.

This method is quite slow and so, I am seeking any better method.
The poorest programmer in the game industry!!
Stani R
Stani R
Quote:
Original post by pcwlai
I would like to post some screen shots though I don't find a place to upload them, any suggestion on a free of charge place to do so?


Clickety Click

pcwlai
pcwlai
Thanks lightbringer for the host! Here is the best screen shot I can at the moment.

Image Hosted by ImageShack.us
The poorest programmer in the game industry!!
tstrimp
tstrimp
Holy crap! I have just witnessed icon hell... It wasn't pretty.
lc_overlord
lc_overlord
Quote:
Original post by pcwlai
In multiple characters though, when they overlap or penetrate each other, you still can see their whole. With the above mentioned method, the character rendered later with parts overlapping with early transparent ones will be masked by the previous depth values.

What I can think of is, creating a secondary depth buffer, store depth buffer after all solid rendering restore, after rendering each character by 2 pass method, restore it.

This method is quite slow and so, I am seeking any better method.


Yea, and you have to remember that wow uses a pretty simple rendering engine so that everybody can play it, so they don't use any secondary depth buffer.
They do however use object sorting, to prove this take a rogue, stealth and then walk trough any semi transparent object slowly, at the mid point you will see the transparency pop a bit when the object your walking trough is suddenly rendered after your character instead of before.

pcwlai
pcwlai
Quote:
Original post by lc_overlord
Quote:
Original post by pcwlai
In multiple characters though, when they overlap or penetrate each other, you still can see their whole. With the above mentioned method, the character rendered later with parts overlapping with early transparent ones will be masked by the previous depth values.

What I can think of is, creating a secondary depth buffer, store depth buffer after all solid rendering restore, after rendering each character by 2 pass method, restore it.

This method is quite slow and so, I am seeking any better method.


Yea, and you have to remember that wow uses a pretty simple rendering engine so that everybody can play it, so they don't use any secondary depth buffer.
They do however use object sorting, to prove this take a rogue, stealth and then walk trough any semi transparent object slowly, at the mid point you will see the transparency pop a bit when the object your walking trough is suddenly rendered after your character instead of before.


I will try to reproduce this when I meet my colleges tomorrow. Object sorting is important and key to many effects. Though, if just sorting, then, the shoulder equipments may not completely obscure the character shoulder (the obscuring part of the shoulder is not rendered) properly as in screen shot. I don't think they perform shorting between the character and it's equipments. I get another screen shot which can prove this. Will post it when I get it tomorrow as well.
The poorest programmer in the game industry!!
pcwlai
pcwlai
The white outline is 1st transparent character. The red outline is the second transparent character. Both character interpenetrates each other.

Observing the left should of 1st character, the shoulder equipment obscure the character's shoulder and the staff obscuring the shoulder. This should be sorted by depth buffer? As sorting this inside a character render is not easy because of the poses? ( I get another screen shot which can clearly show the depth buffer effect, will post it tomorrow when I get it)

The poorest programmer in the game industry!!
pcwlai
pcwlai
The blue outlined part is the depth buffer artifacts.

Image Hosted by ImageShack.us
The poorest programmer in the game industry!!
Sphet
Sphet
I'm pretty sure they are using depth shells:

1 - draw the object as any other solid object, but disable writes to the colour channels - only write to the depth buffer.

2 - draw the object transparent, but with only depth testing set to 'equal' and depth writing turned off.

It gives you correct inter-object sorting but you can only see the nearest triangle in a mesh. If you need, you can sort all the objects in z range and draw the shells from back to front, but i've rarely had to do that - most objects I want to use this for need to be transparent against the environment, not each other.

/S
pcwlai
pcwlai
Quote:
Original post by Sphet
I'm pretty sure they are using depth shells:

1 - draw the object as any other solid object, but disable writes to the colour channels - only write to the depth buffer.

2 - draw the object transparent, but with only depth testing set to 'equal' and depth writing turned off.

It gives you correct inter-object sorting but you can only see the nearest triangle in a mesh. If you need, you can sort all the objects in z range and draw the shells from back to front, but i've rarely had to do that - most objects I want to use this for need to be transparent against the environment, not each other.

/S


Do you mean, drawing the 1st character in depth buffer, drawing the 1st character in color buffer, drawing the 2nd character in depth buffer, drawing the 2nd character in color buffer? I will try it. My current attempt is to draw all into depth buffer then again all into color buffer to minimize state changes.

Though, if not sorting then draw from back to front, if the front object is drawn first, then, the shell will obscure the back?
The poorest programmer in the game industry!!
Todo
Todo
Quote:
Original post by Christian Weis
I'd assumed
pre-multiplied alpha
.

cu,
Chris


Still not right. Here's an easy counter-example:

Three quads are drawn on top of each other. Let's draw them in some order { 1, 2, 3 }:

1) Dst = Dst * 0.5 + Src_Q1 (Src_Qx is premultiplied)2) Dst = Dst * 0.5 + Src_Q2 = ( Dst * 0.5 + Src_Q1 ) * 0.5 + Src_Q2 = Dst * 0.25 + Src_Q1 * 0.5 + Src_Q23) Dst = Dst * 0.5 + Src_Q3 = Dst * 0.125 + Src_Q1 * 0.25 + Src_Q2 * 0.5 + Src_Q3


If you draw them in any other order, you'll get different results (this should be easy to see). Note that (premultiplied) alpha blending is associative, not commutative, thus order-dependent!
pcwlai
pcwlai
From the circled potions, it seems both (inter-)characters are sorted by depth buffer?

Image Hosted by ImageShack.us
The poorest programmer in the game industry!!
Christian Weis
Christian Weis
Quote:
Original post by Todo
Quote:
Original post by Christian Weis
I'd assumed
pre-multiplied alpha
.

cu,
Chris


Still not right. Here's an easy counter-example:

Three quads are drawn on top of each other. Let's draw them in some order { 1, 2, 3 }:

1) Dst = Dst * 0.5 + Src_Q1 (Src_Qx is premultiplied)2) Dst = Dst * 0.5 + Src_Q2 = ( Dst * 0.5 + Src_Q1 ) * 0.5 + Src_Q2 = Dst * 0.25 + Src_Q1 * 0.5 + Src_Q23) Dst = Dst * 0.5 + Src_Q3 = Dst * 0.125 + Src_Q1 * 0.25 + Src_Q2 * 0.5 + Src_Q3


If you draw them in any other order, you'll get different results (this should be easy to see). Note that (premultiplied) alpha blending is associative, not commutative, thus order-dependent!


You're right. I'd mistake associative for commutative. Sorry for that.

cu,
Chris
pcwlai
pcwlai
After a day's inspection and try outs, I figured out what WoW is doing. I will try to post out those result screen shots if I get the chance.

Here is what I came up with:
When rendering transparent characters, the skinning mesh is always using depth pass then color pass.
When rendering transparent characters, the equipments and accessories may use normal alpha blending, i.e., depth write disabled, or method above or "not transparent".
Transparent characters are always sorted from back to front. Not just between characters but between their sub parts. The parts are divided in a very precise manner. e.g. Body, head, face, weapons, helmet, armor, shoulder, etc.
Closely overlapping characters are drawn with one with more transparency and another with less transparency.
There is a sophisticated sorting criteria, like shoulder will be "solid" in most of the time, body is transparent in most of the time, weapon at back is half and half, all these depends on relative screen position and current sorting elements.

There seems to be a lot of trouble in doing these in order to archive the desired transparent result. Though, it really gives you the illusion and visual clues on the game play.

Maybe there is still errors in some cases but this really requires a very careful inspection before you can notice it.

My respect is given to the WoW team for making these "cheats" which really nice.
The poorest programmer in the game industry!!
Todo
Todo
Most of what you conclude (aesthetics aside) boils down to one well-known technique : depth-sorted geometry. It has been mentioned before. If your objects are convex, then it's (sort of) easy. If they're not, break 'em up in convex pieces (head, torse, feet, etc.).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.