I’m trying to replicate that look of the spider verse shaders and postet my results on twitter. In case you are interested have a look.
it all works pretty well, but i encountered a problem with my node setup…
In my setup i used “Texture Coordinate > Camera” for the mapping, wich works quite well with an orthographic camera. But when using a perspective camera, the texture “bends” around the object.
Using “Texture Coordinate > Window” does kind of what i want, but the texture ist distorted relatively to the aspect ratio of the camera/viewport.
Sadly i am not familiar with vector maths, so maybe one of you guys can show me the right direction or even another approach to map a texture flat from the point of view. It would also be very nice if it works in eevee and withou compositing.
The easiest solution is just to counteract the distortion, but you have to change the multiplier every time you resize the window.
A better solution is to use a tiling image texture instead of a checker texture and get the texture coordinates from ‘Camera Data’ > ‘View Vector’.
hey, thanks for your answer!
solution 1 is kind of what i did first, but i ideally want the shader to be able to perform at different aspect ratios.
i’ve also experimentet with the view vector, but it still distorts the texture. And to me it seems that using an image texture makes no difference in comparison to a checker texture.
The correct coordinate to use is indeed the TextureCoordinates->Window. It’s the only one that doesn’t distort spherically.
But since the window’s coordinate is normalized, there’s no ratio information in it.
So, two options:
- transform the coordinates by the pixel ratio factor by creating a new combineXYZ with x=width/height of your screen (you can write directly in the x value 1980/1080, or whatever you have), and set y=1; Then multiply that vector with the coordinates with a mixRGB set to multiply and factor=1. Perhaps you could use drivers here, but I haven’t tested it.
- use OSL, as you can calc the derivatives of window coordinates, or IIRC you can retrieve screen resolution from getattribute().