Please use english language
It is currently 26 Feb 2020, 08:29

All times are UTC





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 03 Dec 2013, 16:12 
Offline

Joined: 22 Jan 2013, 01:10
Posts: 40
I'm trying to convert a shader from SweetFX to OBGEv3 (Oblivion). I have no experience with shader writing, but I figured I could stumble around and look at examples and working shaders and figure out how to convert. I was WRONG. Could someone with shader experience please tell me what's wrong with this file? Here it is:

Code:
iface float BloomThreshold
< string help = "[0.00 to 50.00] Threshold for what is a bright light (that causes bloom) and what isn't."; >
   = 22.50;

iface float BloomPower
< string help = "[0.000 to 8.000] Strength of the bloom."; >
   = 1.100;
   
iface float BloomWidth
< string help = "[0.0000 to 1.0000] Width of the bloom."; >
   = 0.0142;

#include "includes/Resolution.hlsl"
#define px rcpres.x
#define py rcpres.y   
#define pixel float2(px, py)   

texture2D obge_LastRendertarget0_EFFECTPASS;

sampler2D PassSampler = sampler_state {
   texture = <obge_LastRendertarget0_EFFECTPASS>;
   AddressU  = CLAMP;
   AddressV  = CLAMP;
   MINFILTER = LINEAR;
   MAGFILTER = LINEAR;
   MIPFILTER = LINEAR;
};

struct VSOUT {
   float4 vertPos : POSITION;
   float2 UVCoord : TEXCOORD0;
};

struct VSIN {
   float4 vertPos : POSITION0;
   float2 UVCoord : TEXCOORD0;
};

VSOUT DummyVS(VSIN IN) {
   VSOUT OUT = (VSOUT)0.0f;   // initialize to zero, avoid complaints.
   OUT.vertPos = IN.vertPos;
   OUT.UVCoord = IN.UVCoord;
   return (OUT);
}

float4 BloomPass(float4 ColorInput2, float2 Tex) {
   float3 BlurColor2 = 0;
   float3 Blurtemp = 0;
   float MaxDistance = 8 * BloomWidth;
   float CurDistance = 0;
   float Samplecount = 25.0;
   float2 blurtempvalue = Tex * pixel * BloomWidth;
   float2 BloomSample = float2(2.5, -2.5);
   float2 BloomSampleValue;
   for(BloomSample.x = (2.5); BloomSample.x > -2.0; BloomSample.x = BloomSample.x - 1.0) {
        BloomSampleValue.x = BloomSample.x * blurtempvalue.x;
        float2 distancetemp = BloomSample.x * BloomSample.x * BloomWidth;
      for(BloomSample.y = (- 2.5); BloomSample.y < 2.0; BloomSample.y = BloomSample.y + 1.0) {
            distancetemp.y = BloomSample.y * BloomSample.y;
         CurDistance = (distancetemp.y * BloomWidth) + distancetemp.x;
         BloomSampleValue.y = BloomSample.y * blurtempvalue.y;
         Blurtemp.rgb = tex2D(PassSampler, float2(Tex + BloomSampleValue)).rgb;
         BlurColor2.rgb += lerp(Blurtemp.rgb, ColorInput2.rgb, sqrt(CurDistance / MaxDistance));
      }
   }
   BlurColor2.rgb = (BlurColor2.rgb / (Samplecount - (BloomPower - BloomThreshold * 5)));
   float Bloomamount = (dot(ColorInput2.rgb, float3(0.299f, 0.587f, 0.114f)));
   float3 BlurColor = BlurColor2.rgb * (BloomPower + 4.0);
   ColorInput2.rgb = lerp(ColorInput2.rgb, BlurColor.rgb, Bloomamount);   
   return saturate(ColorInput2);
}

technique main
<
   int group = EFFECTGROUP_POST;
   int fxclass = EFFECTCLASS_FILTER;
>
{
   pass p0 {
      VertexShader = compile vs_1_1 DummyVS();
      PixelShader  = compile ps_3_0 BloomPass();
   }
}


I'm getting an compiler error X3502 at line 46, column 25 (This line:
Code:
float4 BloomPass(float4 ColorInput2, float2 Tex) {
).
It says that it is "missing semantics". What the heck does that mean? What's wrong with it? It works fine with SweetFX, why won't OBGEv3 accept it?
Man, I would appreciate some help here.


Top
 Profile  
 
Tomoko
PostPosted: 03 Dec 2013, 16:39 
Offline

Joined: 22 Jan 2013, 01:10
Posts: 40
Nevermind, good people. I figured it out with the help of Google. Feels so much better when one figures it out on his own.

Sorry for what is essentially spam.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group