affine texture mapping

Stuard1984
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 :) ) http://neatcorporation.com/forums/viewtopic.php?t=1904 and want to ask how i could accief this psx style affine texture mapping effekt also :)
Image

Greetings,
Stuard
User avatar
nuFF3
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.

EDIT

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 ;)
https://github.com/keijiro/Retro3DPipel ... ter/Assets
Stuard1984
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
https://drive.google.com/file/d/1QwSXA1bdyz69m-hFiSPKVFo2TwFTaxz8/view?usp=sharing

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 :)
Greetings,
Stu
Stuard1984
Location: mancave

PostThu Feb 01, 2018 7:14 pm

Hello,
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(input.position.xyz);
        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);

https://answers.unity.com/questions/414020/how-to-disable-texture-perspective-correction.html

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

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

PostTue Feb 06, 2018 12:24 pm

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

https://github.com/keijiro/Retro3DPipeline/blob/master/Assets/Retro3D/Retro3DSurface.shader

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);
                v.vertex.xyz += 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 );
                UNITY_TRANSFER_FOG(o,o.pos);
                o.projPos = ComputeScreenPos (o.pos);
                COMPUTE_EYEDEPTH(o.projPos.z);
                TRANSFER_VERTEX_TO_FRAGMENT(o)
                return o;
Giga_Steve

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