Skip to main content
Up and Coming
July 21, 2013

Replacing the hmdwarp shader

So, i'm not sure how many have had this issue, but when i enable the hmd warping shader in udk, i get strange down sampling issues as evident by the tail of this space ship:



I've tried every setting I could think of to try and fix this, at first thinking that the down sampling was caused by the DOF shader, but no setting would reverse the effect.

So the only logical solution I could come up with was to replace the current shader with one of my own. I will be using this thread to document my progress and to share the results with others, should I come up with reasonable results.

Edit: After translating the HLSL version of the warp shader, with chromatic abberation into a custom node, and adding all the proper input nodes, I get the following error:



Apparently somewhere the tex2D calls are using more arguments than required? I'm not sure. Can anybody else decipher this?
    This topic has been closed for replies.

    7 replies

    IGameArtAuthor
    Up and Coming
    July 21, 2013
    Hey guys, I managed to make some pretty good progress since I started, here's a glimpse at what it's doing now. Basically it's applying the filter to the screen as a whole, rather than to each separate eye. However i have a few ideas on how to fix this and get both eyes working:



    Up and Coming
    July 22, 2013
    I cant help, but I can encourage! I'm glad to see any work being done on the UDK front, especially graphical improvements.

    Thanks for your efforts! :)
    Up and Coming
    September 16, 2013
    I have successfully been able to read the sensor data from the RIft in the July 2013 version of udk and the next step to having a full implementation is an HMD warp shader. I am wondering how far you managed to get on this?
    I complain a lot. Just think of me as a squeaky wheel lol. Youtube channel -> https://www.youtube.com/user/xblBlackFang/videos
    Up and Coming
    September 19, 2013
    It is normal that you lose resolution after hmdwarp shader is applied. To compensate this loss you need to use screenpercentage around 170 (150 already looks pretty good, 200 looks even better, but obviously performance hit is bigger).
    You can change screenpercentage either by editing UDKSystemSettings.ini or by command 'scale set screenpercentage 170'. Unfortunately, current UDK has to be restarted for new screenpercentage to work correctly. Current UE3 integration doesn't have this issue, new UDK will also work correctly when screenpercentage is changed via console command.
    Up and Coming
    September 19, 2013
    "artyom17" wrote:
    Current UE3 integration doesn't have this issue, new UDK will also work correctly when screenpercentage is changed via console command.
    :lol: Like a tuner for a timpani your upsellin' it like a pro bro! :lol:

    Glad to know UE3 doesn't have these problems, thanks for the heads-up. ;)
    “If you are willing to look at another person’s behavior toward you as a reflection of the state of their relationship with themselves rather than a statement about your value as a person, then you will, over a period of time cease to react at all.” (~I really gotta remember this shiz~) ― Yogi Bhajan
    Up and Coming
    September 20, 2013
    I get an error:

    error X3037: constructor only defined for numeric base types

    This is what the code looks like for me:

    {
    float2 theta = (oTexCoord - LensCenter) * ScaleIn;
    float rSq = theta.x * theta.x + theta.y * theta.y;
    float2 theta1 = theta * (HMDWarpParam.x + HMDWarpParam.y * rSq + HMDWarpParam.z * rSq * rSq + HMDWarpParam.w * rSq * rSq * rSq);

    float2 thetaBlue = theta1 * (ChromAbParam.z + ChromAbParam.w * rSq);
    float2 tcBlue = LensCenter + Scale * thetaBlue;
    if(any(clamp(tcBlue, ScreenCenter-float2(0.25,0.5), ScreenCenter+float2(0.25,0.5)) - tcBlue))
    return 0;

    float4 blueColor = tex2D(sampler2D(readTexture), tcBlue);
    float blue = blueColor.b;

    float2 tcGreen = LensCenter + Scale * theta1;
    float4 greenColor = tex2D(sampler2D(readTexture), tcGreen);
    float green = greenColor.g;
    float alpha = greenColor.a;

    float2 thetaRed = theta1 * (ChromAbParam.x + ChromAbParam.y * rSq);
    float2 tcRed = LensCenter + Scale * thetaRed
    float4 redColor = tex2D(sampler2D(readTexture), tcRed);
    float red = redColor.r;

    return float4(red, green, blue, alpha);
    };


    Any ideas on what I am doing wrong?
    I complain a lot. Just think of me as a squeaky wheel lol. Youtube channel -> https://www.youtube.com/user/xblBlackFang/videos
    Up and Coming
    September 20, 2013
    "HappyHimitsu" wrote:
    "artyom17" wrote:
    Current UE3 integration doesn't have this issue, new UDK will also work correctly when screenpercentage is changed via console command.
    :lol: Like a tuner for a timpani your upsellin' it like a pro bro! :lol:

    Glad to know UE3 doesn't have these problems, thanks for the heads-up. ;)


    viewtopic.php?f=44&t=4332