[Problem] Ray Marching Volume

Hello Everyone,

I want to visualize a 3D Texture with the help of Ray Marching.

Now a Problem has occurred i am not able to handle.

So here is the Problem, at the edges it gets distorted.
In general, it is like a lupe.
Things in the volume that are further back, become larger.

This is how I build my Ray:

v2f vert (appdata v)
            {
                v2f o;
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
                o.wPos = v.vertex.xyz + 0.5;
                return o;
            }

Ray r;
                r.position = i.wPos;
                r.direction = normalize(i.wPos - _WorldSpaceCameraPos);

At least i get the color with:

 tex3D(_MainTex, currentPos);

Could someone please help me?

That should probably be:
o.wPos = mul(unity_ObjectToWorld, v.vertex).xyz;

However I don’t know if that’ll actually solve anything for you. It kind of depends on what you’re trying to do. Do you want to be reading the 3d texture in world space (ie: always at 0,0,0 in world space) or in object space (ie: if you move the box should the 3d texture move with it).

You’re also not really showing enough of the code for anyone to say what’s wrong.

Sorry for the late reply.
But Thanks, that made it.