5
$\begingroup$

I’ve found this amazing solution for camera mapping node in shader itself (better than UV modifier solution - no distortions on lowpoly objects). It works but I went into trouble which I can not resolve.

I can not match camera FOV and projection node FOV. I need to match it precisely, not by hand. That means I need the projection image match precisely my camera view. ​Don’t you know how to do that.

Example of issue (video) and here node tree (source): Surface Shader live Camera Projection

$\endgroup$
2
  • $\begingroup$ I've tried, but haven't found any button to upload any data... sorry it's my first post :( Yes it coudl be done by driver, but I don't knwo the math operataion which would make it fit even by hand. $\endgroup$ Jun 7, 2021 at 11:01
  • $\begingroup$ Amazing! Thank you for your help! $\endgroup$ Jun 7, 2021 at 14:29

2 Answers 2

7
$\begingroup$

To sync values from one place to another you can use copy&paste driver.

For example go to Output Properties > Dimension > Resolution X and right-click parametr, from dropdown menu select Copy as New Driver. Go to Shader Editor and right-click above Width parametr and choose Paste Driver. Field became violet which means driver is set. Now by changing Output dimension value will sync with node value.

enter image description here

Do the same for FOV.

To get the math work there are two things ...

  • Fix your wrong interpretation of original node tree. If you switch Texture node from Repeat to Clip you can see image is at wrong location. Change math type in second Vector node from Add to Multiply.

enter image description here enter image description here

  • Delete or disable Math conversion from Degrees to Radiance because driver already operates in radiance

enter image description here enter image description here


To match real camera could be useful this thread.

$\endgroup$
1
  • 1
    $\begingroup$ Vklidu - you are amazing! Thank you so much! You solved the whole thing as an expert. I can see you are in czech republic like me - there is now way I could message you directly, so I have to do it here. I would like to know you on other oplatforms as well, if you don't mind. Woukld you mind to connect on facebook for example? facebook.com/profile.php?id=1158420875 $\endgroup$ Jun 9, 2021 at 7:38
1
$\begingroup$

Plugging window coordinate directly into texture seems to achieve the effect you are looking for. Note the red border is part of the source texture so the fact it shows up in the camera view is correct.

enter image description here

$\endgroup$
1
  • $\begingroup$ I need to project from the camera object, that's why it's called "camera projection". With this setup it's projecting from the window - so I can not have more cameras projecting individualy for example. And in every window it would look different. Also doesn't work when you need to project in different aspect ratio (let's say square) and render in different format - 16:9 for example. $\endgroup$ Jun 7, 2021 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .