Texture image crop in node editor

Hello there, I would like to ask about possibility to crop texture image that you put into node editor in Blender. Is there such a way to do it, there seems to be few old topics about it but it looks like that it is not referring to what I mean. I know that I can bypass it by scaling uv map in uv editor but be able to crop (or select a part of imported texture image that will be used) image texture just like that would be a great help to me. Is it even possible? Down there I post a screen from slate material editor (3ds max) where you can see what I got in my mind.

Thanks for input T.

Hi, the Mapping node should help. Some other tricks to look into:

Some cool stuff there, thank you for pointing that out, but cropping the way I would like to wasn’t mentioned.


Are we sure?

1 Like

Well I appreciate your effort this acually does look like what I am looking for but no this is not what I am up to. This method you scale image texture to size you want and It does look like cropping it but acually it isn’t. I am really looking for cropping like function where after crop I would be able to scale,stretch, repeat to tiles, etc. that cropt part (without possibly seeing parts that were cropt out).
Lets say you would open a gimp or PS put that image texture there, crop the part you want and save out to another file and that file you would use in 3D soft to apply to material except with this crop function you can easily do it in 3d software itself without opening another software, croping, resaving etc.

Hi Tomáš, I think LoboTommy’s answer is pretty close to what you are looking for but you may need to check the Min and Max boxes to and set the XYZ dimensions in the Mapping Node as well.

This does not work, he wants to be able to tile a cropped portion. min and max just extends the edge:

You can throw some math nodes at the uv channel to get a hacky version of a tileable crop.
Certainly nothing nice and easy, but in a pinch, it technically works:

2 Likes

Thank you guys for inputs that last from sterlingRoth looks promising it might be a bit complicated but as soon as I can get working node setup I can turn it into some group and reuse it. Anyway what I am looking for is a crop node. It is already in Blender but only in compositor nodes. By the way there are plenty really handy nodes there I don’t get why those are not available in node editor aswell ?

Sorry, I misunderstood. I thought the requirement was just to extract a scaled portion of the texture. I get it now.

The architecture of the renderer is a little more complicated. in the compositor, you can have everything loaded into 2d buffers and process them node by node.

In cycles, any nodes in the shader tree are evaluated every time a ray hits that shader. So in an attempt to keep performance high, a lot of nodes aren’t supported. Like a blur node would be super handy, but apparently the computational overhead is too high to justify it.

You also have to consider the varieties of data flowing through the node graph. plugging an image into a crop node is pretty straightforward in the compositor nodes, because everything is already a 2d image. What happens when I plug this into a crop node?

image

object random > colorramp = one color for the whole mesh, with no coordinates. Since there are no coordinates, there is nothing to crop. For the compositor, this is no problem, as every image always has coordinates.

If they built an image texture node with cropping built into it, that would work around this issue, but that would need to be hard coded in at this point.

1 Like

Yeah I thought it might be a coding problem, thanks for clarification. Nevermind thank you guys, I it is not such mandatory feather for me, just that it would be really handy and plus I am used to that from 3ds max.

Cheers

In Cycles, you need to have some kind of background color or texture… And then it’s only a matter of creating a mask for mixing.
here’s an example:


it’s also possible to include “Crop Image Size” and “Relative”, but that needs to be done in python.

Cool idea thank you, but still in this case you created adjustable mask that covers parts of image texture you don’t want to see and as such it doesn’t really cropping anything and furthermore I can’t use such a setup for tiling this part of masked texture (bec I would see violet parts aswell).

Try this. It’s still only playing with mapping vectors but you can crop, tile, and zoom an Image Texture by following the instructions and node setup. Hopefully the node labels are self explanatory.

Thanks to Bartek, Sterling and Secrop for the tutelage / reminders.

3 Likes

If you also want tilling, then you should give better examples…
here, cropping with tilling and the possibility to move the tile:

Hey, thank you for input (and other guys aswell), I thought that what I was looking for was clear from this topic (it was mentioned quite a few times there)anyway I did some testing of your nodes and it probably does something but I am a bit confused about controlling such made node. I must admit that I am fairly new with this math nodes but I did try to recreate your node group and then apply it but afterwards I struggle to control them. I cannot find out which values are “starting one”. With default values the texture is probably too scaled, streched, croped out bec i can’t see it at all. Could you please be so kind and give me a bit of a hand there (screens attached bellow). Thanks

Here is applied texture (with basic UV) without CROP node:

Here is applied texture (with basic UV) WITH CROP node (just brown color):

Here is the recreated node group (might be i got it wrong there) :

The default values from your screenshot produce exactly what would be expected…
If you crop 0.5 from left and right, top and bottom, then whatever you get is exactly the color from the pixel in the middle of the texture.

Here’s the description of the inputs:
Vector >> You need to input this coordinate! typically it would be the UV map.
Left >> the left margin of the crop (in the interval [0, 1])
Right >> the right margin of the crop (in the interval [0, 1])
Bottom >> the bottom margin of the crop (in the interval [0, 1])
Top >> the top margin of the crop (in the interval [0, 1])
X >> moves the cropped tile in the U direction (also [0, 1])
Y >> moves the cropped tile in the V direction (also [0, 1])

Note that the node inputs are normalized… If you want to use Pixels as dimensions, then you need to convert them to a normalized value.

3 Likes

Ok man, this indeed does freaking work the way I want (missing Uv vector input was a problem)! Wow thanks to you and cheers. I am still amazed how did you figured out that math node setup? I get what each nodes mean there (I just read description) but still I woudn’t be able to produce correct combination of them. Well cheers to you!

If you want wood, you may want to consider randomizing where each plank is looked up from; either through object ID or from whatever you use to generate the plank pattern (i.e. Brick texture). That thing there just screams bad CGI.