Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPS Creator X10 / The Truth About Shaders in x10

Author
Message
srealist
8
Years of Service
User Offline
Joined: 18th Dec 2010
Location: Orlando, Florida, USA
Posted: 28th Dec 2012 18:36
This is an attempt to set straight the many conceptions and misconceptions about how shaders truly work in FPSC x10 after several years of trying to get my own head around it all. Where I say anything incorrect here, I hope others will tell me and I will edit the first post. I’m also offering a fair amount of opinion but it is all open for discussion and hopefully some of you x10 gurus can help me.

This is not a tutorial on how to make texture maps or custom shaders for FPSCx10. There are other threads that cover how to make shader maps and unless you are already a high-level shader wizard, you will not be making any custom shaders for FPSCx10.

Rumor : FPSCx10 uses PS4 (pixel shader 4, see NVIDIA for details) shaders. This is not entirely true. While x10’s shader system is built using PS4, the shader language used in FPSCx10 is a custom creation. You can NOT find any existing PS4 shader that will work in FPSCx10. As there exists no documentation, outside of the sparse comments found in the default shaders and the Wibbly Relief shader, writing or converting an existing shader to work in FPSCx10 is very difficult and unless you already have experience writing shaders, it’s virtually impossible.

Rumor: Shaders can be defined in the FPE file for an entity. This is false. FPSCx10 ignores the shader path and defaults to its built-in shaders so long as you have the required texture maps. To use a custom shader, such as Wibbly Relief, you must declare it within the entity’s parameters *in the editor.* Otherwise, any results you are seeing are from the default shader system. This one fooled me for a long time.

Shaders on static entites: FPSCx10s shader system works quite nicely on static entities so long as it is done correctly. For a good example, see SciFi/FurnitureB/ModtablesB6. Load this into a scene and place a static light within range. Make sure that lightmapping is set to the highest quality and run the level in test mode. As you walk around the table you will notice that it has specularity and some bumpiness. That is the shader working! To understand how to do this to your own creations or to update existing media, explore the file paths for the texture files and examine the four textures found in the texturebank.

NOTE that the FPE file declares a .fx file that doesn’t exist. NOTE that the FPE file declares a .tga texture that doesn’t exist. What’s happening here?!? Quite simply, this is the result of a half finished product. FPSCx10’s source code gives us some insights to this phenomenon. When the FPE file is parsed, and a shader file is found declared, FPSCx10 ignores it and replaces it with the default shader. When a .tga file extension is found, FPSCx10 ignores it and replaces it with .DDS. While it is not necessary to follow this protocol, you might as well as a practice in consistency because as soon as you start coming up with your own ways of doing it, you might find yourself getting unknown and unexpected problems. If it worked for TGC, it will work for you…probably…

Shaders on segments: These work great so long as your texture files are done well. Much of what is said above applies here as well. Will add more here later.

Shaders on dynamic entities (non-character): In short, don’t use them. They will never match the lightmapping for the rest of your scene. They will befuddle and confuse you. They will one time look fantastic and then the next time ruin your scene. It is good practice to limit dynamic entities in a scene to items that require interaction or animation.

But but but…I have to have a glowing sci fi panel in my epic space thriller! Guess what? You can do that with a static entity. Check out SciFi/Wall Furniture/Light 4. It’s another little mystery as we now see it uses illuminationent.fx. But, it doesn’t. That file does not exist. Just like bumpent.fx doesn’t exist. FPSCx10 parses the FPE file, ignores this shader request and uses the default shader. The glow is achieved by adding an alpha channel to the _S.dds file (or spec map) and putting white were you want it to glow.

Shaders on characters: I don’t know much about these as most of my games did not have any characters. From what I have seen the character shaders do not seem to suffer the same problems that dynamic entities do. However, I will others tell me more about this and edit later.

Gotta take my kids for a walk…

More later….
Hockeykid
DBPro Tool Maker
11
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 6th Jan 2013 21:53
Quote: "Rumor : FPSCx10 uses PS4 (pixel shader 4, see NVIDIA for details) shaders. This is not entirely true. While x10’s shader system is built using PS4, the shader language used in FPSCx10 is a custom creation. You can NOT find any existing PS4 shader that will work in FPSCx10. As there exists no documentation, outside of the sparse comments found in the default shaders and the Wibbly Relief shader, writing or converting an existing shader to work in FPSCx10 is very difficult and unless you already have experience writing shaders, it’s virtually impossible."


Not exactly its own language, it's just based off of the names of the constants that are passed into the shaders, whereas other shaders might not use the same constants. Though, at the moment I can't seem to find where FPSC X10 passes the constants into the shaders.

Quote: "Rumor: Shaders can be defined in the FPE file for an entity. This is false. FPSCx10 ignores the shader path and defaults to its built-in shaders so long as you have the required texture maps. To use a custom shader, such as Wibbly Relief, you must declare it within the entity’s parameters *in the editor.* Otherwise, any results you are seeing are from the default shader system. This one fooled me for a long time."


Custom shaders will ONLY be used on NON-instanced objects, normal entities will use "simple.fx" and characters will use "skinning.fx".

Quote: "Shaders on characters: I don’t know much about these as most of my games did not have any characters. From what I have seen the character shaders do not seem to suffer the same problems that dynamic entities do. However, I will others tell me more about this and edit later."


They always use the "skinning.fx".

Sean

srealist
8
Years of Service
User Offline
Joined: 18th Dec 2010
Location: Orlando, Florida, USA
Posted: 8th Jan 2013 19:25
Thanks for the clarifications, Sean. The instancing thing is fascinating. Would this mean that if you use a custom shader, you can only use that entity once? Or is there a way to turn instancing off on an entity?

Login to post a reply

Server time is: 2019-05-20 03:24:19
Your offset time is: 2019-05-20 03:24:19