Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

readColorBuffer deprecated, how to use MHWRender::MRenderTargetManager::acquireRenderTarget()

3 REPLIES 3
Reply
Message 1 of 4
MikeSSSS
788 Views, 3 Replies

readColorBuffer deprecated, how to use MHWRender::MRenderTargetManager::acquireRenderTarget()

MikeSSSS
Enthusiast
Enthusiast

I'm trying to write an image from Viewport2.0 that has been acquired from two cameras that I have in my scene simultaneously. I see a deprecated example for:

 

m3d.readColorBuffer(img, true);

 

I cannot find any SDK examples for MHWRender::MRenderTargetManager::acquireRenderTarget() that are using a camera, or perhaps I am misunderstanding the use of the Target Manager.

 

Can anyone provide any insights?

 

Thank you for your help and time!

0 Likes

readColorBuffer deprecated, how to use MHWRender::MRenderTargetManager::acquireRenderTarget()

I'm trying to write an image from Viewport2.0 that has been acquired from two cameras that I have in my scene simultaneously. I see a deprecated example for:

 

m3d.readColorBuffer(img, true);

 

I cannot find any SDK examples for MHWRender::MRenderTargetManager::acquireRenderTarget() that are using a camera, or perhaps I am misunderstanding the use of the Target Manager.

 

Can anyone provide any insights?

 

Thank you for your help and time!

3 REPLIES 3
Message 2 of 4
MikeSSSS
in reply to: MikeSSSS

MikeSSSS
Enthusiast
Enthusiast

So I have a hack, that is not a solution, but I'd like to get some discussion for anyone who might know.

 

I can do something in mel like:

 

lookThru "myCamera";
refresh;
lookThru "persp";

refresh Also has a flag to save an image, so I can sort of do this hack, but the screen is going to flicker. I additionally lose any parameters that I have set for my camera (i.e. resolution, etc.).

 

So to repeat the question in case it was not clear:

 

Question: How do I get the raw pixels of what an individual MFnCamera is looking at? 

 

 

So I have a hack, that is not a solution, but I'd like to get some discussion for anyone who might know.

 

I can do something in mel like:

 

lookThru "myCamera";
refresh;
lookThru "persp";

refresh Also has a flag to save an image, so I can sort of do this hack, but the screen is going to flicker. I additionally lose any parameters that I have set for my camera (i.e. resolution, etc.).

 

So to repeat the question in case it was not clear:

 

Question: How do I get the raw pixels of what an individual MFnCamera is looking at? 

 

 

Message 3 of 4
Anonymous
in reply to: MikeSSSS

Anonymous
Not applicable

Still looking at this, and I think now I just don't understand what an MRenderTarget is.

 

Ideally each of my cameras would have one I am assuming? Then I could acquire the MRenderTarget for each camera and get its pixels?

 

Or at least, that is the workflow that would make sense, now the question is how to do it in Viewport2.0? I think I am just lacking a layman's term (i.e. explain it to me like a 5 year old) answer of how to setup a MFnCamera as an MRenderTarget

0 Likes

Still looking at this, and I think now I just don't understand what an MRenderTarget is.

 

Ideally each of my cameras would have one I am assuming? Then I could acquire the MRenderTarget for each camera and get its pixels?

 

Or at least, that is the workflow that would make sense, now the question is how to do it in Viewport2.0? I think I am just lacking a layman's term (i.e. explain it to me like a 5 year old) answer of how to setup a MFnCamera as an MRenderTarget

Message 4 of 4
MikeSSSS
in reply to: Anonymous

MikeSSSS
Enthusiast
Enthusiast

Apologies for the bump, but I want to post everytime I get closer to a solution (future folks who search for this may appreciate this--to folks in the present, I apologize!).

 

 

I ended up using cmd2blast devkit example to capture frames from each of my cameras after doing a 'look thru'

 

The problem is this is a 'blocking call' it appears, so my viewport is quite slow if I try to capture more than 1 frame per second.

 

I'm going to try to see if I can try something with threads to capture what multiple cameras see, though I think this may break.

 

Ideally I could just capture a framebuffer from each Maya Camera, but again, I have not figured out how or if this is possible.

 

 

Apologies for the bump, but I want to post everytime I get closer to a solution (future folks who search for this may appreciate this--to folks in the present, I apologize!).

 

 

I ended up using cmd2blast devkit example to capture frames from each of my cameras after doing a 'look thru'

 

The problem is this is a 'blocking call' it appears, so my viewport is quite slow if I try to capture more than 1 frame per second.

 

I'm going to try to see if I can try something with threads to capture what multiple cameras see, though I think this may break.

 

Ideally I could just capture a framebuffer from each Maya Camera, but again, I have not figured out how or if this is possible.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report