Jump to content


Timbab

Member Since 17 Jun 2012
Offline Last Active Jul 03 2012 12:52 PM
-----

Posts I've Made

In Topic: .vsh / .psh - HLSL/ASM Shaders - SWGalaxies - Totally lost

22 June 2012 - 07:09 AM

Hey, thanks for the replies. I was gonna mention that pdf, but you found it already. :)

Good that you mention the compiler, I do have it, two actually, a new version (9 something) and one the one from 2004 (Used in some of the newer shaders in the game), and I can compile the files, but I don't get the files I want, for example if I copy the exact code clean from the 2d_blur.psh with out the added compiler bytes and compile, I get this (It looks screwed, cause it's in hex):

I'll attach 2 pics so you can see it in hex.
ÿÿþÿ-CTABÿÿxDHX"hs0«userConstants««ps_2_0Microsoft (R) HLSL Shader Compiler 9.29.952.3111Q @@@€@€° B€ä°ä €ä°
ä €
ä €ä€ ä°€ä€U ä°€䀪 ä°B€ä€ä B€ä€ä B€ä€ä B€ä€ä €ä€	ä €ä€ä 䀀ä€
ä 䀀ä€ä 䀀ä€ä 䀀ä€ÿÿ
http://img854.images...05/62536327.png


Instead of this (original)
FORM?PSHPFORM?0000PSRC?//hlsl ps_2_0

#include "pixel_program/include/pixel_shader_constants.inc"
#include "pixel_program/include/functions.inc"

sampler s0 : register(s0);

float4 main
(
	in float2 textureCoordinates  : TEXCOORD0
)
: COLOR
{
	float4 result = 0.0f;
	float2 textureCoordinateOffsets = 0.0f;
	for (int i = 0; i < 16; ++i, textureCoordinateOffsets += userConstants[16].xy)
		result += tex2D(s0, textureCoordinates + textureCoordinateOffsets) * userConstants[i];

	return result;
}
PEXE?????-CTAB??xDHXhs0?userConstants??ps_2_0Microsoft (R) D3DX9 Shader Compiler 4.09.00.1126Q?`ApAQ? A0A@APAQ??@?@AAQ?@@@?@?@????	?????????????????U??????????????????????????U???????????????????????B
?	????B	?????B?????B?????B?????B?????B?????B?????B?????B?????B?????
?
??	??	?	????
?????
??	???????????????????
??????????????????????????????????????????U??????????????????????????U???B?????B?????B?????B?????B?????????????????????????????????????????????
http://img9.imagesha...19/12675741.png


In cmd I'd open up fxc.exe and use this command: fxc /T ps_2_0 /Fo 2d_blur.psh 2d_blur.cpp, does anyone know what I'm doing wrong? I might have to add the form in manually, but regardless, the code won't even show up.

The .vsh I can edit as far as I know, fully, as it compiles on the fly. I've already tried some stuff with minor successes, but nothing major yet, I'm sure I could and can modify the .psh files once I can compile it in the right way. But I also talked to someone who manually managed to get new .psh files working ages ago, but he can't remember correctly how he did it, so it IS possible.

@Reedbeta, what do you limit to 'only shaders'? Right now I can edit their functions.inc, it also has 'module' .inc files, and well also the .psh(Soon hopefully) and vsh files. Outside of that, I found out I might be able to make multi passes work by editing the .eft (Effect files that link to the psh/vsh), I do know some things in game, like water, use multiple passes. I've attached all the shaders in the .zip above though, in case you want to check out what I mean.

Couldn't I use the player position/character as a focal point, somehow?

For instance, I found that part of the fog distance to the player that's used for the view distance (Though I found out too that in the end I can't modify it, at least not the normal fog for it), is calculated with this:

float calculateFog(float4 vertexPosition_o)
{
	float4 position_w = mul(vertexPosition_o, objectWorldMatrix);
	float3 viewer_w = cameraPosition_w - position_w;
	float  viewerDistanceSquared = lengthSquared(viewer_w);
	return 1.0 / exp(viewerDistanceSquared * fog.w);
}

Couldn't you do something similar with a blur/DoF like effect? It doesn't have to be 100% DoF, a faux one would do too.

Look at this for example, a modder achieved the following a few years ago, he never said how he did it exactly, he just said this:

"It also allows for camera blurring when focal on "centric" objects. "

"Nothing. Didn't touch sandstorms or fog. The only exception is that the draw distance now has a parameter in the Vertex/Pixel shader files that can force Depth of Field on some cards - but that won't affect sandstorms or natural in-game fog."

http://forum.modsour...ttach=925;image
http://forum.modsour...ttach=929;image

Just as a reference, here is the original game with view distances 0%, 50% and 100%.
http://img528.images...eenshot0447.jpg
http://img526.images...eenshot0448.jpg
http://img194.images...eenshot0449.jpg

Any ideas would be fantastic, thanks in advance!

Edit: Got the compiling and importing fixed now.

Curious, is it hard converting .fx files into .psh and .vsh? I've been trying some stuff, but no real luck so far.