Get non-render camera render pixels



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/04/2009 at 10:10, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R11 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    This is something of a continuation of my previous post on VolumeData::AttachVolumeDataFake() which had no response.

    What I was hoping to achieve with that mysterious function was a way to get screen render pixels from a camera that isn't the active camera (the actual camera being used for rendering). Is there any way to do this without setting the other camera as active? Are the camera, basedraw, view, and other render data too interdependent to achieve this?

    The idea is to apply the view from the other camera to a material on another object as a texture. This can be done with the active camera but can't figure away for non-active cameras.

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/04/2009 at 16:56, xxxxxxxx wrote:

    Oh, I always wanted to do the same thing! The CamShader :)

    I haven't done much with channel shaders yet, so I can only explain how I think it would work. My idea would be to implement a channel shader that actually works like a refraction. So you get the ray that comes from the active camera and hits the object's surface, and you kinda reroute the ray so it shoots out of the second camera. The math should be rather easy, I *think*.

    Really I think the calculation should work almost like a refraction (or reflection).

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/04/2009 at 03:07, xxxxxxxx wrote:

    In what context do you want to get the pixels, in a shader, post effect etc.?

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/04/2009 at 06:13, xxxxxxxx wrote:

    Shader for sure. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/04/2009 at 23:48, xxxxxxxx wrote:

    Quote: Originally posted by c4dJack on 17 April 2009
    >
    > * * *
    >
    > Oh, I always wanted to do the same thing! The CamShader :)
    >
    >
    > * * *

    guess how an old plugin of mine is called ;)
    I didn't finish it though...

    i took a camera (or an other object) and spawned new rays from those coordinates



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2009 at 09:11, xxxxxxxx wrote:

    Why didn't you finish it? Would you be willing to share your code? :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2009 at 09:11, xxxxxxxx wrote:

    yeah, that would be really cool...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2009 at 00:06, xxxxxxxx wrote:

    I didn't have the time to finish it, and wasn't able to reproduce the focal options of the camera at that time. Here is a part of the code

    > \> Vector CamShaderData::Output(PluginShader \*chn, ChannelData \*cd) \> { \>      ... \>           Ray ray; \>           ray.p = LV(m.off); \>           m.off = 0.0; \>           Vector dest = Vector(cd->p.x-0.5, 0.5-cd->p.y, 1.0); \>           dest = dest\*m; \>           ray.v = LV(dest); \> \>           SurfaceIntersection si; \>           Vector v; \>           if(cd->vd) \>                v = cd->vd->TraceColorDirect(&ray;, MAXREAL, cd->vd->raydepth, cd->vd->raybits, 0, &si;); \>      ... \> } \>



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2009 at 07:24, xxxxxxxx wrote:

    That is very close to the direction my code was going but the result was always black. In my case though, I was trying to get the camera 'rays' so that the camera options would be already considered. If your code works, that'll be a step in the correct direction. :)

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2009 at 11:27, xxxxxxxx wrote:

    I also notice that this is very close to Per Anders' solution for a camera shader but it was restricted to the active render camera. Were you ever able to work this with *any* camera? That's the main problem for me.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2009 at 12:56, xxxxxxxx wrote:

    Okay. That works basically - you should have mentioned that Matrix m = cam->GetMg() but that makes sense. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/04/2009 at 23:33, xxxxxxxx wrote:

    ah, yes m is the Camera Matrix, but in my code it doesn't have to be a camera it may be any object.


Log in to reply