Creating/Editing Pixel shaders. - by user3456
user3456 on 12/3/2006 at 19:52
Is there a way to decompile/recompile the pso files ? Changing some of the effects of bloom etc..
Gestalt on 13/3/2006 at 06:15
I don't know if it's possible to decompile the shaders (I'm guessing not, but this is far from my area of expertise), I think it might be possible to replace them entirely. According to (
http://www.shaderx.com/direct3d.net/tutorials/shader/shader3.html) this, .pso files can be generated by Microsoft Pixel Shader Assembler (part of the DirectX SDK, I think) and (
http://developer.nvidia.com/object/nvasm.html) NVASM.
It's possible that you might be able to replace the bloom shader with your own, or some other postprocess effect (motion blur, sepia tone, Tron-style glow). I don't really know, though. It might be worth attempting.
user3456 on 13/3/2006 at 16:32
hm interesting.. but unfortunately i dont know how to code c++ :( have the dx sdk and the shader compilers but.. there seem to be no shader samples with it so.. i cant do anything.
New Horizon on 13/3/2006 at 17:23
Might be interesting to note, that when I was playing around with the shader files. I copied and renamed...an ambient shader I think...to the name of the shader used for the frob highlight. What happened you ask? Well, some objects were illuminated...in a manner very similar to T1 and T2. Didn't work on doors for some reason, but it sure worked on coins. If I knew how to create a shader that simpley applied an ambient light to an object, I would do it.
Durinda D'Bry on 14/3/2006 at 09:39
Nvidia has Cg compiler to write shaders for different platforms (incl. DirectX, OPenGL etc.). Source is like plain C language (easy to learn even for non-programmer) but anyway knowledge of some "domain" details is required.
I had the same idea to rewrite some Flesh shaders to improve performance or modify look of some effects but found this work pretty complex and time consuming:( Would be nice if someone may do this:p Probably we may even add effects... BTW just for info: for game usage existing shaders are put in some kernel IBT file.
New Horizon
Shaders are executed in chain so simple replacement may not work as desired sometimes...
namespace on 15/3/2006 at 19:19
Hi!
I doubt that you will have any luck with new shaders as long
as you don't have the uncompiled sourcecode of the original shaders.
I guess they are using 1.0 Vertex/Pixelshaders since the game runs on
cards that don't support any higher version (geforce fx and above use 2.0).
1.0 Shaders are very lowlevel and dumb "programs". You have a lot of
limitations concerning the number of textures you can use, the number of instructions per shader, the number of operations and pretty much everythig
else.
The code looks abit like assembly, you move values from one register to another, apply an operation on them etc.
If I rembember correctly you can't even do the complete phong calculation in
one shaderpass (diffuse + specular + ambient), so the amount of features
you can add tends to zero.
The other problem is the reverse engineering, I never heard of a program
that can decompile dx shaderobjects. But without the source it would be impossible to add new shaders because you don't know in which gpu-registers the application puts the inputdata.
Like, wheres the normalmap? Is it t0, t1? Or: what does
mul r0,t0, r1 ; do? You can't tell without knowing whats stored in r0, t0 and r1.