8
$\begingroup$

Is it possible to make a node setup to where if a camera is close to an object, the texture gets bigger, but far away it decreases in size?

$\endgroup$
12
$\begingroup$

It is. The crucial point is using the cycles Camera Data node, from then on should be trivial.

Just use the View Distance output socket to transform the texture coordinates as you see fit.

In my setup I just use a Color Mix node to mix between two Texture Mapping vector coordinates with different scale factors, and the View Distance as mixing factor, but you can get inventive with the distance value and use it as you see fit.

View Distance

| improve this answer | |
$\endgroup$
  • $\begingroup$ I'm curious, what does the divide node actually do in this setup? $\endgroup$ – NeutronBlender Jul 23 '17 at 20:54
  • $\begingroup$ It adjusts the scaling factor to the desired distance. Since it uses the actual camera distance in Blender scene units it divides the value by 10, so the scaling factor is bigger and more noticeable in this specific example, adjust it for your own case $\endgroup$ – Duarte Farrajota Ramos Jul 24 '17 at 0:23
  • $\begingroup$ is it possible to control the texture resolution with the camera data node? So I can do similar to the simplify tab but on a per object basis. The goal is to lower the VRAM footprint based on distance. $\endgroup$ – user3597862 Mar 5 '19 at 18:09
  • $\begingroup$ What is "texture resolution"? If you are planning on loading several sized textures into memory you will probably end up consuming more RAM than with a single one $\endgroup$ – Duarte Farrajota Ramos Mar 5 '19 at 18:13
  • $\begingroup$ Hi, I want to load one texture into ram, but decide it's resolution/file size dependant on the distance from the camera. For example if I have an 8k texture and the closest model in view that uses it is 50 metres from the camera, then I could get away with a much smaller resolution and save memory. I'd like it to be calculated on a frame by frame basis so it would work with animations. I'm not entirely sure if this is how mip mapping already works? $\endgroup$ – user3597862 Mar 5 '19 at 18:30

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.