Sign in to follow this  
Guest christian

DX shaders in FS2004 - research

Recommended Posts

When browsing around I found some DX shaders defining the water. (I know someone else from NZ found this before me, but I never chased it up until now, too busy).Something like this (WaterHLSL.fx)://// water shader//// texture 0 - base texture// texture 1 - envmap//// result = Base + Env.a * Env// = T0 + T1.a * T1//#include "Common.fx"#include "CommonLandWater.fx"technique T1{ pass p0 { VertexShader = compile vs_1_1 main_T1(); PixelShader = asm { ps_1_1 tex t0 tex t1 mad_sat r0, t1, t1.a, t0 }; Texture[0] = (tDiffuse); Texture[1] = (tEnvMap); TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TextureTransformFlags[0] = Disable; TextureTransformFlags[1] = Disable; AddressU[0] = Clamp; AddressV[0] = Clamp; AddressU[1] = Clamp; AddressV[1] = Clamp; SrcBlend = One; DestBlend = Zero; AlphaBlendEnable = False; }}// Fallback - base texturetechnique T2{ pass P0 { fvf = XYZ | Tex1; VertexShader = NULL; PixelShader = NULL; Texture[0] = (tDiffuse); TexCoordIndex[0] = 0; ColorOp[0] = SelectArg1; AlphaOp[0] = SelectArg1; ColorArg1[0] = Texture; AlphaArg1[0] = Texture; ColorOp[1] = Disable; AlphaOp[1] = Disable; AddressU[0] = Clamp; AddressV[0] = Clamp; SrcBlend = One; DestBlend = Zero; AlphaBlendEnable = False; }}I tried to modify the file, but couldn't get FS2004 to read it. I suspect this isn't possible, so we have to live with the water we currently have.But there could potentially be another exploit: FS2002/4 are using a texture definition called TEXTURE2_SHADER, similar to TEXTURE2_REFLECT for the bgl command BGL_TEXTURE_LIST. Now, it could potentially be possible to load a HLSL shader using this flag. It should be pretty straight forward to write a BGLC file and make use of it. I would do it myself, but don't really have the time as I'm persuing other projects (that wouldn't make use of it). However, this should really be chased up, because this would open a realm of graphical possiblities, eg bumpmapping, fresnel refractions, etc, etc. I suspect this will be the huge big feature in FS2006, but if we get this to work now, this would really hit the spot...Cheers, Christian

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this