PerspectiveLookAtRectangle confusion

hello matrix-lovers,

in the attached patch, there’s a simple scene, which i want to render from different views/perspectives. The confusion comes, when recombining those views, because the phong shading (in this case) is affected in a surprising way.

There’s ways to manually tweak this, but i’m curious if someone can explain the situation.

or, is there a different way to create a PerspectiveLookAtRect (Transform ViewProjection) that doesn’t have these side-effects?

or, did i miss something very basic?

thanks

Testor.v4p (57.6 kB)

and for the old fashioned ones, here’s the dx9 version (with the same behaviour).

Testor_dx9.v4p (59.1 kB)

i dont know if its a bug or why its like that!

what if you use the crop-transform input of the renderer? you can use a scaling of 1 in your PerspectiveLookAtRect and scale it to 0.5 with your crop-transform?

the shading aligns good, but maybe there are other problems with the cropping, dunno…

@hrovac:

thanks!

what i want to achieve at the end is a quad with a camera looking directly at the quad from a given position. That’s exactly what PerspectiveLookAtRect (Transform ViewProjection) does… plus the strange effect.

and i don’t see a way to reach this goal with cropping or similar…

https://discourse.vvvv.org/t/12402

Been there!
Its the view direction that renders the lighting, so you have to manually enter the view from the camera position, otherwise it gets over ridden by the perspective camera somehow. I can go looking for an example patch if you need more help…

ahkay, fcourse changing every effects view manually could be an option…

buuuut, here’s a solution not scaling of the view but the renderers crop. thanks alex for the tip!

Testor1.v4p (56.3 kB)

also works with the aspectratio pin instead of crop :)

but this is not an elegant solution… makes a lot of problems when using post after such a renderpass.

just remove highlight, specullar calculated depending on view angle

can you explain that with more words, please?

expanding antokhio’s cryptic reply:

phong shades via the hlsl method lid() which returns a float3:

  • x component: ambient = 1
  • y component: diffuse = ((n • l) < 0) ? 0 : n • l
  • z component: specular = = ((n • l) < 0) || ((n • h) < 0) ? 0 : ((n • h) * m)

so the only component with dependency on view direction is h in specular (which is the halfvector normalize(view+light)

he’s basically saying you don’t need to change any shader code if you only need lambertian shading without the blinn specular

hi woei totally correct, u can also visualize this logical way.
Highlight is an light reflection on a shinny object, thinking that reflection is same from any point of view is obviously wrong…