mrice Posted January 23, 2009 Share Posted January 23, 2009 I'm trying to set something up where I can project textures via cameras or lights that arent tied to the render cam's resolution. The projections work fine when I render from the projecting camera or light but break when rendered from another cam. The issue I *think* I'm having is that when I render from the main camera, the NDC coordinates used in the shader (either a light shader or surface shader) are now relative to the rendering camera and not the projector. Is there a straightforward way to do this? If you can't understand what I'm talking about I can upload a scene. MIchael Quote Link to comment Share on other sites More sharing options...
mrice Posted January 23, 2009 Author Share Posted January 23, 2009 I managed to get it working Here's a hip file in case anyone else has trouble light_projector.hipnc Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 23, 2009 Share Posted January 23, 2009 I managed to get it working Yup. You got it. Well done! I don't know what they intended with that "space:lightndc" choice in the TransformVOP's space menu, but it certainly doesn't transform to the light's NDC space (in fact, it's not documented that I'm aware of, so it's probably bogus). End result is that you have to either do what you did: vector Pndc = toNDC(transform("space:light",Ps)); or, using the old transform functions: vector Pndc = toNDC(wo_space(Ps)); Actually, I'm not sure if the "space:light" space is documented either... Also, I should mention that now that we have the teximport() function to extract resolution information from a texture map, you can now fit the map into the projection frustum such that it doesn't distort. So for example: A rectangular projection with a square map, when treated with the old vanilla NDC method, will distort: But now you can relate the light's projection rectangle with that of the texture map, allowing you to fit the map into the projection without distortion: 1. Scaled to fit (blue is just to show the original footprint): 2. Fit horizontally: and so on... Here's a quick demo of how that can be done: ProjLight.tar.gz Cheers! Quote Link to comment Share on other sites More sharing options...
mrice Posted January 24, 2009 Author Share Posted January 24, 2009 Great example, thanks Mario! And good to know that "space:lightndc" doesnt work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.