affine texture mapping

Location: mancave

PostSat Jan 13, 2018 2:41 pm

hello guys,
i just want to ask - iv'e already made a shader with an psx like vertex snapping (i mean i implemented the nodes from this post into my project shader :) ) and want to ask how i could accief this psx style affine texture mapping effekt also :)

User avatar
Location: Hell

PostTue Jan 16, 2018 9:44 pm

There has already been made posts about this.
While the vertex snapping is relatively easy to make, the affine texture mapping is borderline impossible but not completely impossible.

I'm not sure how I would make it myself, but I know its not completely impossible.


You could always try this one out... This guy 'Keijiro' is sort of the nutty professor of unity, he creates some amazing stuff for unity. Here's his take on a retro 3d pipeline, warts and all ;) ... ter/Assets
Location: mancave

PostWed Jan 24, 2018 12:35 pm

Thanks for your Help :)
Also for the Affine effect? If so i will search again :P
I used the vertex-offset already in my shader and that was relatvley easy to implement and I made it constand in the distance :o

Thanks for the Github link, i'll look more into his work!
I can read C# but Shader programming is another level :D

I'll post it here if i get something done :)
Location: mancave

PostThu Feb 01, 2018 7:14 pm

so my head is reaching its limit of understanding.
I looked inside Keijiro's shader and found this part of the calculation returning in every shader i researched

Code: Select all

        float3 vp = UnityObjectToViewPos(;
        vp = floor(vp * 64) / 64;
        Varyings output;
        output.position = UnityViewToClipPos(vp);
        output.texcoord = TRANSFORM_TEX(input.texcoord, _MainTex);
        UNITY_TRANSFER_FOG(output, output.position);
return output;

In more detail, this part is returning every time in different variations ^^

Code: Select all

output.pos = mul(UNITY_MATRIX_MVP, input.vertex);

and now im sitting in front of my shader forge window and testing this out but nothing works :P
image hosting

so if anyone has an idea reply pls (im going back to my 00's timemachine now)
Location: mancave

PostTue Feb 06, 2018 12:24 pm

ok i cant use the code node and implementing it in the build shader doesont work either :/

i tried to copy the line 36 into my shader but i get only errors back

Code: Select all

VertexOutput vert (VertexInput v) {
                VertexOutput o = (VertexOutput)0;
                o.texcoord0 = TRANSFORM_TEX(input.texcoord0, _MainTex); //this part - thought it cant be that easy :D
                o.uv0 = v.texcoord0;
                o.vertexColor = v.vertexColor;
                o.normalDir = UnityObjectToWorldNormal(v.normal);
                float node_2344 = ((_node_8853*1000.0)*saturate(pow(distance(mul(unity_ObjectToWorld, v.vertex).rgb,_WorldSpaceCameraPos),(-1.0))));
                float3 node_4664 = (mul( UNITY_MATRIX_V, float4(mul(unity_ObjectToWorld, v.vertex).rgb,0) ).xyz.rgb*node_2344);
       += mul( float4(((round(node_4664)-node_4664)/node_2344),0), UNITY_MATRIX_V ).xyz.rgb;
                o.posWorld = mul(unity_ObjectToWorld, v.vertex);
                float3 lightColor = _LightColor0.rgb;
                o.pos = UnityObjectToClipPos( v.vertex );
                o.projPos = ComputeScreenPos (o.pos);
                return o;

PostThu Aug 16, 2018 9:01 pm

I know this is old but did anyone figure out a solution to this? I've been trying to get something working to get affine textures but no luck. Been driving me nuts for a while trying to get a working solution. Any tips are appreciated.

Return to “Questions”

Who is online

Online users: No registered users and 1 guest