Estranged, the story of a lone fisherman, stranded on a mysterious island during a violent storm. Explore rich environments and meet the curious inhabitants of the island as you find a way back to the mainland.

Post news Report RSS Giving the Mod a Graphical Edge

In this article Christiaan Bakker (AniCator) will update you about some of the progress we have made on a graphical level. At the start we also briefly touch on how we are going to handle future update posts.

Posted by on

It has been quite a long time since last posted a proper development update article. Of course we did not intend to leave you in the dark. Gathering information about all our progress takes time, and it is easier to write things on the spot than looking at it in retrospect.

Instead of focusing on multiple new features like we have in previous development update, we will be focusing on one new feature instead.

This article is a rather technical one and the subject may not interest everyone of you. We hope you will have a fun read!

Ripping out the Shader Editor

Source Shader Editor is something we distributed with the last Estranged Alpha - on a simple level it lets us create shaders (programs that take data from the game and tell the graphics card how to show it on screen) in an editor.It was a third party tool created by a mod developer named Biohazard.

Now why would we rip out the Shader Editor? The answer is pretty simple. We are now able to write our own shaders directly for Source. Which allows us to interact with the Source Engine on a deeper level.

Why would we not just keep both the editor and our own code, it shouldn't affect the project that much at all. In fact we still have the Shader Editor materials sitting in our mod acting like nothing has ever happened.

We ripped it out because we are trying to keep things clean. The Shader Editor is a pretty bulky buddy, adding a bunch of extra files to the codebase and also its own shader data files, the so called ‘canvas' files.

One of our new friends, Drew Watts, has also been helping integrating some of his custom shaders into our mod. We don't want these files to just be out there in some canvas files because they are not our work, they're Drew's.

Now what does programming shaders from scratch without the Shader Editor allow us to do that we can't do when using the editor. Well, as it turns out. Quite a lot!

The Phong Reflection Model

A bunch of modders out there may be familiar with the ‘VertexLitGeneric' (model shader) VMT parameters named ‘$phong' and all of its children: ‘$phongfresnelranges', ‘$rimlight', etc... An good example of a model that uses the Phong reflection model is the character model of Alyx.You can find more information about the Phong for these materials on the Valve Developer Community wiki.

Now what is this Phong? Or more specifically in this case; what is the Phong reflection model?
It is a mathematical model that allows you to calculate the local illumination of points on a surface. A.k.a. it allows you to calculate light reflection of the lights in the area.

World geometry in Source usually uses the ‘LightmappedGeneric' shader and does not support the ‘$phong' parameter and its children.

Specular Phong support for World Geometry

This is where it gets interesting. Estranged's ‘LightmappedGeneric' isn't using the default shader code anymore. It has been customized and made to support up to 10 lights. This means that we can input a maximum of ten lights for Phong reflection calculations.

The system isn't completely stable yet but most of it is working properly now. It wasn't easy to get it all to work but it was worth the effort.

A few things had to be done to get it to work properly. Initially we used the same function that the Phong shading for ‘VertexLitGeneric' uses to get its light information. This function supplied us with four lights that turned on and off rather rapidly fading into existence based on ‘ambient cube' information.

After asking around we found out that we can make our own interface to allow the client to interact with the shader DLL files. So a function was written to get us 10 lights instead and BAM! The shader could now process up to ten lights! The best part of it all is that we are able to control how they are handled instead of having to rely on an inaccessible function.

Post comment Comments
BadXFox
BadXFox - - 194 comments

Great :D

Reply Good karma Bad karma+8 votes
Taquito
Taquito - - 389 comments

Can't wait to play this.

Reply Good karma Bad karma+2 votes
AncientT
AncientT - - 425 comments

Thats what i wanna see! >:D

Reply Good karma Bad karma+3 votes
navysealguy3
navysealguy3 - - 230 comments

this is how frostbite makes their textures look so good, specualrity and high res normals, you'll make any game look gret

Reply Good karma Bad karma+5 votes
AncientT
AncientT - - 425 comments

I am quite curious on how you guys customized it to support 10 lights and get Phong to work on geometry! How did you guys figure out how to do this? I am so curious right now! >:D

Reply Good karma Bad karma+4 votes
ScicoPax
ScicoPax - - 154 comments

Yes! I want to know too!

Reply Good karma Bad karma+1 vote
[Tox(sic)]
[Tox(sic)] - - 344 comments

Good on you to give credit where it's due! The screenshots look marvelous.

Reply Good karma Bad karma+2 votes
Armageddon104
Armageddon104 - - 3,128 comments

I love all the little additions you guys are adding.

While the graphical features are great I hope the brushwork is being overhauled, many of the locations make no sense and many areas are extremely blocky and could be fixed up easily.

Also will you ever consider releasing this phong shader in a more complete form for the community?

Reply Good karma Bad karma+5 votes
adelina1985a
adelina1985a - - 132 comments

this needs testing! hehehe

Reply Good karma Bad karma+2 votes
Mr.Scary
Mr.Scary - - 131 comments

Cant wait for the final thing, this has so much potential.

Reply Good karma Bad karma+1 vote
SalesKital
SalesKital - - 134 comments

now we just need new zombies that are actually scary lol. still, like what i see here.

Reply Good karma Bad karma+3 votes
AniCator Author
AniCator - - 178 comments

You'd be surprised.

Reply Good karma+1 vote
ThrillerProd
ThrillerProd - - 173 comments

It's really nice, you don't use the SSE ?

Reply Good karma Bad karma+1 vote
Drew++
Drew++ - - 1 comments

Not anymore. It's on our developer build simply to prototype shaders. Using C++ and our own .dll gives use much more control on blending to the scene, and lets us optimize much better!

Reply Good karma Bad karma+1 vote
sexydiddo
sexydiddo - - 2 comments

Fantastic !

Reply Good karma Bad karma+1 vote
Regol1th
Regol1th - - 263 comments

I cannot wait to play this.

Reply Good karma Bad karma+1 vote
ScicoPax
ScicoPax - - 154 comments

How did you start to make shaders for Source? I want to learn, but I haven't found a good tutorial, and I really want to learn how to make shaders.

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: