Welcome, Guest.
Username: Password: Remember me

TOPIC: text helper

text helper 1 year 3 months ago #1

a header file for drawing text
demo usage:
Warning: Spoiler! [ Click to expand ]

Result:




github link
Last Edit: 1 year 3 months ago by kingeric1992.
The administrator has disabled public write access.
The following user(s) said Thank You: WLHM15

text helper 1 year 3 months ago #2

Neat... Looks like I did it the hard/tedious way. since I didn't want to use any external texture.



github.com/BlueSkyDefender/Depth3D/blob/...t_Sharp.fx#L316-L452

Your solution is better and easier. Since it allows for much more freedom.
My GitHub page where you can get the Latest release of SuperDepth3D github.com/BlueSkyDefender/Depth3D

My PayPal Me Link If you like to donate paypal.me/BlueSkyDefender

Also my steam page steamcommunity.com/id/BlueSkyDefender

Discord Server discord.gg/W2f7YhX
Last Edit: 1 year 3 months ago by BlueSkyKnight.
The administrator has disabled public write access.

text helper 1 year 3 months ago #3

yeah, I don't think ppl would ever use this, but it is kind of handy as a utility header.

another approach would be the 3x5 char like in the ascii sahder.
//3x5 num/char text
int getTextBit( int id ) {  
    int cText[10] = { 
        31599,  9362, 29671, 29647, 23497,//0,1,2,3,4
        31183, 31215, 31305, 31727, 31689 //5,6,7,8,9
        //expand char here
    };

    return cText[max(id, 9)];
}

float text(float2 uv, int n){
    uv = 1.0 - uv;

    float bit = pow(2.0, floor(uv.x*3.0) + 3.0*floor(uv.y*5.0));
    uv = abs(uv - 0.5);
   
    return step( 0.5, floor(float(getTextBit(n))/bit) % 2.0)*
           step(uv.x, 0.499)*step(uv.y, 0.499);
}
and it is possible to add a AA func to upscale the text to x2 scale or x3 scale.
Last Edit: 1 year 3 months ago by kingeric1992.
The administrator has disabled public write access.

text helper 1 year 2 months ago #4

This might come in handy :)

btw: pow(2,x) -> exp2(x)
The administrator has disabled public write access.

text helper 1 year 2 months ago #5

should be fine as long as gl/hlsl compilers are doing constant folding.
pow(2, x) --> exp2( x * log2(2) ) ---> exp2(x)

though, not the same for the case of pow(x, 2)
where hlsl would resolve to x*x and gl might not.
The administrator has disabled public write access.

text helper 5 months 3 weeks ago #6

@kingeric1992:text helper.fx(44, 1): error X3000: syntax error: unexpected 'identifier'
The administrator has disabled public write access.

text helper 5 months 2 weeks ago #7

thanks,!Why i use the shader can't this show text?
The administrator has disabled public write access.

text helper 5 months 2 weeks ago #8

kingeric1992,hi,Why i use the shader can't this show text? i use reshade322,yes can show text now :P

Warning: Spoiler! [ Click to expand ]

Last Edit: 5 months 2 weeks ago by hunt1hunt.
The administrator has disabled public write access.