PVKIIPVKII

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
> Post 2.3 Shader Enhancements, Some work being done for post 2.3
CrackaPolly
post Jan 31 2010, 12:29 PM
Post #1


Rabid Parrot


Group: PVKII Team
Posts: 1,183
Joined: 12-February 08
Member No.: 3,836



Been a long time since the last dev journal so here is something relating to post-2.3 work.

Part of our current plans for things to be done after 2.3 is to overhaul the visual. This is going to include improving some of the maps where there are areas lacking in detail as well as in model detail. I've been doing some work with the shader sdk to improve some of the shaders we use.

Firstly, originally in one the new maps for 2.3 we wanted to use a video on some geometry to perform a much more visually pleasing job of drawing a rapidly changing texture. So to facilitate this I wrote a new special entity prop_dynamic_video to allow a mapper to specify a BIK video to use as the texture of a model. While in the end we did not use this in the map, the code will remain and made it into the 2.3 patch. Basically a few things need to be taken to care when putting a video onto a model. The UV mapping of the default texture needs to fit perfectly the necessary rect that the video takes up in a way that the video is contiguous. Although it is theoretically possible to do a more complicated UV map and author the original video with all the frames keeping in mind the UV map. In this picture the reason for the green checkboard is because this model was not authored with video on it in mind and explains why the UV map needs to fit only the subrect of a whole texture that the video will be best fit to in a 2 exponential sides only textures. (Also the BIK will output the audio into the world making syncing of audio to video not an issue, and it will loop)



With post-2.3 I have been looking at some improvements to the character shading. In particular I have worked on implementing an improved model for rendering specular highlights. The lighting model it uses is known as the Cook-Torrance model with a Beckman Distribution for the roughness factor into the main model. I believe Orange Box is using the Blinn-Phong model. Here gives an explanation of the different lighting models http://en.wikipedia.org/wiki/Specular_highlight.

The benefits of using this lighting model is that it better approximates the specularity much better than Phong shading. The best case situations of this model are with metals and plastics, but it works great across many applications. In implementing it I also kept the support for the rim lighting term they have in Orange Box, as well as Base Texture tinting of the specularity which is useful for better simulating gold and things of that nature. I replaced the rim mask with a lightwarp mask because rim mask is unused and having a lightwarp mask is important to allowing better skin rendering approximation when you have skin and other parts of the model on the same texture which many of the player models do.

In this new lighting model there are two main parameters which affect how the specularity will look.

a. Roughness - This is a measure of how rough the material is. To keep consistent with phong for easy transfer of phong exponent texture I have this setup where black is extremely rough texel and white is extremely smooth texel.
b. Reflectance at normal incidence - This is sort of like a phong boost, but it works in a different way. As the direction of the light approaches the normal of the surface of the model it will be brighter. As this value goes up you will see overall a brighter specularity, but not at an equal distribution, light that is hitting the model close to its normal will be much brighter than light that is perpendicular to the surface normal. I represent black as 0 reflectance value and white as a 10.0 reflectance value.

The main method of using these new parameters is through a texture I call the RTNL Texture. Which just stands for Roughness/Texture Tint Mask/Reflectance at Normal/Lightwarp Mask corresponding to the RGBA channels of a texture. Here are some examples of the comparing the new lighting between no specular, and phong specularity:


With the heavy knight there is a drastic difference mainly because metal is one of the best case scenarios for this lighting model. Some things that are not easily seen in a picture are that with this new lighting it helps to make the texture look more gritty because I used a non-uniform roughness across the armor so that as light passes around the model you will see parts that take longer to fully specular in comparison to other parts. (Kinda hard to explain, but on the helmet you can sorta see that dirtiness in the specular) Also this comparison is missing a comparison of the chain mail part which is why it is constant in all 3 images.


With the archer you can see his face is rendered in a much more realistic fashion, other areas of the specularity are generally much more subtle because the roughness in this case is pretty low, but overall is brighter and in motion the specular results are much more divergent.


With the captain we can see the skin is also render much more realistically. Also his buttons and other gold objects produce much better specularity and use a tint mask to look more like gold.


With the parrot I used a special lightwarp texture to better simulate the depth of the feathers, essentially it is a high density stair stepped effect. He is also getting specularity which makes him match the lighting of the scene much more properly.

I've also done some work on another refract shader which takes into account the object geometry rather than relying on a normal map to refract with. This is useful for bottles or ice statues where the geometry needs to be refracting and there is no normal map so to speak.
Go to the top of the page
 
Quote Post
Schatzmeister
post Jan 31 2010, 12:52 PM
Post #2


Captain


Group: Senior
Posts: 605
Joined: 8-January 07
From: Holy Roman Empire
Member No.: 1,628



Wow, amazing work!
Go to the top of the page
 
Quote Post
ZinuX
post Jan 31 2010, 01:31 PM
Post #3


Mutated Walrus Hamster


Group: Beta Tester
Posts: 1,810
Joined: 25-October 08
From: Holland
Member No.: 5,202



Nice


--------------------

Go to the top of the page
 
Quote Post
Smack
post Jan 31 2010, 03:41 PM
Post #4


Damn this compooter


Group: Senior
Posts: 1,319
Joined: 20-April 09
From: My creepy cabin in the graveyard
Member No.: 5,665



The Cook-Torrance Specular Captain looks so much more virile!

yowza!

Very nice indeed!


--------------------
Wise Chinese proverb say "He who pays for porn has failed at life."
Go to the top of the page
 
Quote Post
Paladin
post Jan 31 2010, 05:23 PM
Post #5


Fail to fail succeed to succeed


Group: Senior
Posts: 889
Joined: 16-December 08
Member No.: 5,463



The Heavy Knight has now become shiny smile.gif


--------------------
Gif incompatible with IE, use Firefox to view.
Go to the top of the page
 
Quote Post
sverek
post Feb 1 2010, 09:24 AM
Post #6


ℋȺℛⅅℭ➐ℛℰ


Group: PVKII Team
Posts: 429
Joined: 25-February 08
From: Japan
Member No.: 3,949



Very nice to read dev blog!

Amazing job on shaders, I didn't see much coders who can handle shaders. Thanks, great reading.


--------------------
Go to the top of the page
 
Quote Post
CrackaPolly
post Feb 1 2010, 11:06 AM
Post #7


Rabid Parrot


Group: PVKII Team
Posts: 1,183
Joined: 12-February 08
Member No.: 3,836



Oh also I recall some people were requesting things like SSAO, but originally that was what I started to work on when I got into doing shader upgrades, but it isn't possible from what I can see. SSAO requires a depth buffer at the minimum and the default depth buffer is specially setup for something relating to depth blending of particles and so it is a very short range from the camera. Tried to manually render the scene in another pass with my shader on all materials, but not possible to do on a brush geometry so it currently can't be done without some access to these things.
Go to the top of the page
 
Quote Post
jRocket
post Feb 1 2010, 04:12 PM
Post #8


Rabid Parrot


Group: PVKII Team
Posts: 1,404
Joined: 4-August 04
Member No.: 5



I think ambient occlusion can be turned on in the driver level for nvidia owners. I haven't tried it with PVKII though.


--------------------
Go to the top of the page
 
Quote Post
gubbe
post Feb 1 2010, 07:12 PM
Post #9


Fancy Lad


Group: Senior
Posts: 426
Joined: 5-June 08
From: Finland
Member No.: 4,289



oh man that is awesome!
Curse thee valve for holding this wonderful game back.


--------------------
Go to the top of the page
 
Quote Post
Miggog
post Feb 2 2010, 01:04 PM
Post #10


Swashbuckler


Group: Senior
Posts: 200
Joined: 19-April 08
From: Finland
Member No.: 4,200



Valve is probably just jealous of pvk graphics.

Hot damn those Cook-torrance specular maximus 2000 effects on Heavy Knight and the captain! icon_yay.gif
Go to the top of the page
 
Quote Post
Scurvy Bob
post Feb 2 2010, 01:45 PM
Post #11


Fancy Lad


Group: Senior-
Posts: 329
Joined: 21-January 09
From: Germany
Member No.: 5,524



awesome work smile.gif keep it up guys!

A question about 2.3:
Why don't you just release it like you did with all the previous versions and let us play on dedicated servers or offline untill valve starts to move their asses? Well, we would be happy and could give you feedback and you could already prepare a little patch, if we find something to fix.
This is just an idea that came to my mind, I'm not forcing you to do this. But it would definitely make the community happy and stop the frustration.

cheers

This post has been edited by Scurvy Bob: Feb 2 2010, 01:45 PM


--------------------
Go to the top of the page
 
Quote Post
CrackaPolly
post Feb 2 2010, 07:20 PM
Post #12


Rabid Parrot


Group: PVKII Team
Posts: 1,183
Joined: 12-February 08
Member No.: 3,836



Well I think Crazytalk is awaiting response before he decides anything of that nature. Thought it has been discussed some.
Go to the top of the page
 
Quote Post
ZinuX
post Feb 2 2010, 09:38 PM
Post #13


Mutated Walrus Hamster


Group: Beta Tester
Posts: 1,810
Joined: 25-October 08
From: Holland
Member No.: 5,202



Do you mean, response in like talking back, or in an action way (you talked, but they hadn't really physically responded a.k.a. released the patch) ?

I am worried if it is the first one.


--------------------

Go to the top of the page
 
Quote Post
CrackaPolly
post Feb 3 2010, 02:20 AM
Post #14


Rabid Parrot


Group: PVKII Team
Posts: 1,183
Joined: 12-February 08
Member No.: 3,836



Here are some of the other player models in the new shader:






About the patch we hope for it to be Steam released as soon as possible, but if we may end up release standalone soon if that doesn't happen. It will be good to catch bugs for a steam patch short time from it being finally released.
Go to the top of the page
 
Quote Post
Kobaïa is de Hün...
post Feb 3 2010, 03:03 AM
Post #15


Waffle Fries


Group: Senior
Posts: 2,026
Joined: 7-May 09
From: The Hotel Adlon
Member No.: 5,696



Beautiful. This is definitely the changes that make this mod rise above every other mod stuck in the Source Engine mold; way to bring some serious glorious uniqueness.


--------------------

Go to the top of the page
 
Quote Post
Ryujen
post Feb 3 2010, 09:59 PM
Post #16


Land Lubber!


Group: Senior
Posts: 22
Joined: 27-December 09
From: Any One-Inch Distance.
Member No.: 6,564



At last the berseker gets his Schwarzenneger-like muscles (when he was still young of course) light-speculated in all their excellence, just look at those triceps lol
Go to the top of the page
 
Quote Post
Black Super Pred...
post Feb 8 2010, 11:38 AM
Post #17


ScallyWag


Group: Senior
Posts: 88
Joined: 20-January 08
From: the jungel
Member No.: 3,694



NICE


--------------------
-This planet is a game reserve. And we're the game.
Go to the top of the page
 
Quote Post
Veerdin the Blin...
post Feb 18 2010, 02:20 PM
Post #18


ScallyWag


Group: Senior
Posts: 54
Joined: 16-February 10
From: Everywhere and nowhere
Member No.: 7,020



Looking forward to it! That shader looks awesome.
Go to the top of the page
 
Quote Post
mrmong
post Feb 23 2010, 07:37 PM
Post #19


Swashbuckler


Group: Beta Tester
Posts: 266
Joined: 28-October 08
From: uk
Member No.: 5,294



i have some questions about the Bik video texture thing you mentioned for an idea of mine (gonna suggest a cool map idea maybe) smile.gif

- will you be able to apply it to "vertexlitgeneric" stuff like models as well as Light mapped stuff.

-can you move the model around that the video is playing on

-Would a large video file cause performance issues?

this is unrelated to my map idea but would a video texture work well as a 2d skybox? (assuming you placed another one to seal the map)
Go to the top of the page
 
Quote Post
CrackaPolly
post Feb 24 2010, 05:51 AM
Post #20


Rabid Parrot


Group: PVKII Team
Posts: 1,183
Joined: 12-February 08
Member No.: 3,836



Its a prop_dynamic it only works with. The entity name is prop_dynamic_video in the current sdk.

For a model there is a UV map, if you want the video to look right you have to take care with the UV map for the model because it won't be a perfect square for the video it will be some subrect of that texture that is used by the video. The rest will just be garbage data.

I've not tested any extremely large files, I just used the valve bik to test.

You can use a 3d skybox with a dome model with the video properly uved to the dome to use a BIK as the skybox.
Go to the top of the page
 
Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
 



Lo-Fi Version Time is now: 9th September 2010 - 02:08 AM