Get camera position issue

Started by bigben, May 28, 2007, 07:00:31 PM

Previous topic - Next topic

bigben

As part of my population masking I wanted to set up a functional mask that would cover the camera's fov from the camera position.  Rather than do lots of calculating of angles I finally twigged to a hack of HB's face mask, replacing the normal vector with a vector from the terrain position back to the camera.

When I put it together however, a few things don't quite work as expected.

1. There's no camera assignment (not really an issue for this application)
2. The mask follows the preview camera, not the render camera (also not a real problem for rendering)
3. The mask is positioned at the origin when you generate the population

[attachthumb=#1]

[attachimg=#2]
fov of mask deliberately set less than fov of camera. This is positively freaky but looks similar to the problem illustrated in http://forums.planetside.co.uk/index.php?topic=1537.msg15324#msg15324. I can't think of a reason why the surface shader and population density shader don't seem to correspond.

If you replace the get camera position with a constant vector everything works as expected.
[attachimg=#3]

The attached TGD has everything used for this test. In the interim I can animate the constant vector as a workaround which is a big improvement on using an image map (http://forums.planetside.co.uk/index.php?topic=972.msg10345#msg10345)

Matt

#1
Unfortunately "Populate" acts completely independently of the renderer, and the "Get Camera Position" function only reads the camera position that is fed to the render state at render time. "Get Camera Position" is part of a set of nodes that read internal render state variables, and these are only meaningful while a render is in progress (including the preview render). I suppose it may be possible for us to change the way that Get Camera Position retrieves that vector, but unfortunately it's just the way the renderer works for now.

Update: I will take a look at the Populator and see how easy it will be to set up some of those render state variables outside of the renderer.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

bigben

Thanks Matt.

It simplify things a bit with this particular use, but it's not critical since the camera position can quite easily be fed into a constant vector using the animation data.  It's just an extra animated node that has to be tracked when changes are made.  Would it make any difference if it was assigned to a camera like the Through camera projection?

Ben

Matt

I don't think that would be possible with the current feature set. In future of course we'll have a way to read any parameter from any node into another node and parameter. Until then, hmm.. perhaps a really useful node would be a Function node that reads the value of another node's parameters, i.e. a "Link Parameter" or "Get Parameter" function node. That would allow you to read any camera position into the function network. In future we plan to be able to do it the other way too: use a function to drive parameters, but that wouldn't be needed for the problem you're currently working on.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

bigben


Quote from: Matt on May 31, 2007, 08:24:00 AM
I don't think that would be possible with the current feature set. In future of course we'll have a way to read any parameter from any node into another node and parameter. Until then, hmm.. perhaps a really useful node would be a Function node that reads the value of another node's parameters, i.e. a "Link Parameter" or "Get Parameter" function node. That would allow you to read any camera position into the function network. In future we plan to be able to do it the other way too: use a function to drive parameters, but that wouldn't be needed for the problem you're currently working on.

Matt


Both of these last two sound *really* useful and my interim measure will see me through until they're available for this situation.