PDA

View Full Version : MEL - Generating strokes at render time


maNus
06-23-2003, 09:31 PM
Hey,

I'm currently working on a litte script and I have the following problem. When I'm generating strokes just before render time using the pre-render MEL function, Maya generates the strokes, but doesn't render them.

Here is a little procedure that does something like that. Enter the name of the procedure in the pre-render MEL field in the global render menu and press render. Maya now creates, but doesn't render the stroke.

global proc maNus_test_preRen()
{
// create curve
string $curve = `curve -d 1 -p 2 0 2 -p -5 0 -5 -k 0 -k 1 `;

// adjust the brush presets to red
brushPresetSetup();
bPset "color1R" 1;
brushPresetApply();

// attach stroke to the selected curve
select -r $curve;
AttachBrushToCurves;
}

When you rerender the scene, Maya will render the previously created stroke and will, of course create a new stroke. Does anybody knows why Maya doesn't render the strokes? And how I can solve this problem. Thanks in advance.

::maNus::

gmask
06-23-2003, 09:39 PM
IS ther eany reason why you could just create these wires on a per frame basis inside the main scene instead of before each frame at rendertime?

maNus
06-23-2003, 09:51 PM
I just created this little procedure as an example for my problem. In my extended script I'm creating the strokes before the first frame gets rendered. I then use the created strokes throughout the animation and after the last frame is rendered, I delete them... but even then Maya won't render them.

::maNus::

gmask
06-23-2003, 09:57 PM
Originally posted by maNus
I just created this little procedure as an example for my problem. In my extended script I'm creating the strokes before the first frame gets rendered. I then use the created strokes throughout the animation and after the last frame is rendered, I delete them... but even then Maya won't render them.

::maNus::

Can you give me an idea of what they would be used for?.. I'm having a hard time seeing why you would do this in prerender script.

maNus
06-23-2003, 10:12 PM
Is there maybe another way of creating something before or at rendertime? I read something about using expressions on the AW forum but I don't really know how to do that...

This is what my hairGen script does. It takes a selected NURBS surface, creates a defined number of patches and creates for every patch a dynamic ctrl hair. Then I create a number of strokes on all the patches and ctrl them with the corresponding ctrl hair.

Because of performance reasons I want to create all of those strokes at rendertime.

::maNus::

gmask
06-23-2003, 10:18 PM
Originally posted by maNus
Is there maybe another way of creating something before or at rendertime? I read something about using expressions on the AW forum but I don't really know how to do that...


Well you could have a MEL script that is executed at everyframe that reads your instructions or control hairs from a text file.

Anotehr approach I have taken is to have a MEL script PREPROCESS everythign and incrementally save the file and then I render it.. it's slow .. I guess it wouldbe faster if I did it at rendertime but I need to do more work after the fact so that wouldn't work for me.

maNus
06-23-2003, 10:23 PM
Thank you for your advice gmask. How would you do it then? And do you know why Maya doesn't render the created strokes? If so, how can I fix it?

::maNus::

gmask
06-23-2003, 11:04 PM
Originally posted by maNus
Thank you for your advice gmask. How would you do it then? And do you know why Maya doesn't render the created strokes? If so, how can I fix it?

::maNus::

I have no idea why it doesn't work.. I can only assume that it wasn't meant to work that way and for some reason because the curves are not part of the original scene that the post proces for PaintFX ignores them or doesn't even know that they are there.

Duncan Brimsmead reeads the posts over at highend3d.com especially the ones in the fluid section and he also dev'd paintFX .. he could porobably explain it to you or give you a solution.


I guess depending on how you are generating the strokes it doesn't really matter where or what creates then you just need something inside Maya referring to them.

Anyway I think your script would work the way you want if it wa sconnected to a script node and setup to run at every frame to create these hairs.. you might have to delete the hairs fromt he previous frame if you are render frames sequencially since they would be stored in memory.

I guess the trick is setting up so that it only doe sthis when it is rendering which I suppose is where a prerender script my be useful.

There is a script on Highedn3d.com caled hidetill render that bascially uses a prerender script to turn on objects that you wanted to hide while working for peformace reasons. This is very similair to what you need except what you are hiding is really CPU and potentially Memory intensive.

maNus
06-24-2003, 07:30 AM
I already posted the question on Highend. I'm going to try a couple of other things now and hopefully can Duncan Brimsmead explain me why Maya is doing this.

Thank you for your time gmask.

CGTalk Moderation
01-15-2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.