1
$\begingroup$

I'm experimenting with making a shader that looks like linework and colouring on paper. As part of this I'm trying to apply a repeating texture map to give the base paper look to everything in my scene. As it's supposed to look like it's all on the same piece of paper, the paper texture needs to be independent of the object surfaces in the scene.

I found I can get pretty close to what I want by using the Window texture coordinate node with the texture map I'm using to represent the paper. However, there are a few issues, biggest of which is that the aspect ratio of the texture changes to that of the viewport, which I don't want to change.

Here's a perfectly square rendering with a resolution of 1920/1920 (note: The "paper" texture is a simple placeholder to test the concept, and I'm also adding a colour ramp that won't be in the final version to exaggerate the contrast of the texture (it's very light grey on white. Also, the items that have colour are part of a previous shading experiment and should be ignored for the purposes of this question).

enter image description here

Here's the same scene rendered in a 16/9 aspect ratio. As you can see, the texture has been squashed horizontally, the only thing that's changed between the first and second image is that I've changed the output resolution to 1920/1080.

enter image description here

My node setup looks like this (The colour ramp on the texture is there purely to increase the contrast and it won't be in the final version):

enter image description here

What I'd ideally like is for the paper texture to be pixel exact to the input image with no scaling at all, so that it looks like I simply drew the lines over the top of the original file. Failing that, I'd like the aspect ratio of the texture to be preserved and not dependant on the rendering aspect ratio.

Is that possible? How do I achieve it?

$\endgroup$
2
$\begingroup$

You can divide the perspective out of a perspective camera's texture-space like this:

enter image description here

.. and scale it to the desired size in the texture, a Mapping node, or multiplication.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.