Jump to content
  • Advertisement
Sign in to follow this  
Migi0027

DX11 DX11 - Troubles with weighting

This topic is 2099 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys wink.png ,

 

so I've been trying to get this weighting function right, but it isn't working as expected, the result and how I do it:

 

Supposed to look like: (The one on the left)

fig7.jpg

 

Though, I get this result:

muyfk9.png

 

Here's how I do it:

float2 texcoord = -input.Tex+ float2(1.0, 1.0);

// ghost vector to image centre + halo vector based from ghost
float2 ghostVec = (float2(0.5,0.5) - texcoord) * uGhostDispersal;
float2 haloVec = normalize(ghostVec) * uHaloWidth;

...

// get the weight
float weight = length(float2(0.5,0.5) - frac(texcoord + haloVec)) / length(float2(0.5,0.5));
weight = pow(1.0 - weight, 10.0f);
return float4(weight,weight,weight,1);

How it's done by the guide I'm reading: (Yeah, not HLSL)

vec2 texcoord = -vTexcoord + vec2(1.0); // flip texcoordoords

vec2 ghostVec = (vec2(0.5) - texcoord) * uDispersal;
vec2 haloVec = normalize(ghostVec) * uHaloWidth;

//	sample halo: -----HERE
float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));
weight = pow(1.0 - weight, 10.0);

fResult = result;

His and my constants:

MY:
static float uGhostDispersal = 0.25; // Same as uDispersal
static float uHaloWidth = 1.0;
static float uDistortion = 1.0;

HIS:
uniform float uDispersal = 0.25;
uniform float uHaloWidth = 1.0;
uniform float uDistortion = 1.0;

So what on earth could I be doing wrong? ( Like usual tongue.png )

 

Thank you for your time, appreciate it. happy.png

-MIGI0027

Edited by Migi0027

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!