AndrewVK Posted July 24, 2005 Share Posted July 24, 2005 I ask this question earlier, but no luck. From VRAY_DemoBox.c example... int VRAY_DemoBox::initialize(int argc, char *argv[], const UT_BoundingBox *) { UT_Args args; args.initialize(argc, argv); args.stripOptions("m:::M:::"); if (args.found('m') && args.found('M')) { myBox.initBounds(args.fargp('m', 0), args.fargp('m', 1), args.fargp('m', 2)); myBox.enlargeBounds(args.fargp('m', 0), args.fargp('m', 1), args.fargp('m', 2)); } else if (args.argc() == 7) { myBox.initBounds(atof(args(1)), atof(args(2)), atof(args(3))); myBox.enlargeBounds(atof(args(4)), atof(args(5)), atof(args(6))); } else { myBox.initBounds(-1, -1, -1); myBox.enlargeBounds( 1, 1, 1); } return 1; } If i am not mistaken this snip of code should track "procedural mode" statement given by user: "Render Sop Bounds" "Explicit Bonds" "Procedural" But this example always return box (-1,-1,-1)(1,1,1) no matter which method i select. Am i miss something? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 24, 2005 Share Posted July 24, 2005 Hey Andrew, Just guessing here, but shouldn't that be //...// if (args.found('m') && args.found('M')) { myBox.initBounds(args.fargp('m', 0), args.fargp('m', 1), args.fargp('m', 2)); myBox.enlargeBounds(args.fargp('M', 0), args.fargp('M', 1), args.fargp('M', 2)); } //... // That is, upper-case-M for the enlargeBounds() calls, no? Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 24, 2005 Author Share Posted July 24, 2005 Hey Mario! Guessing is all that remains for us in a case with procedurals There is no words about this statements in the doc: args.found('m') && args.found('M') args.argc() == 7 what is m,M ????? attribute of explicit bounds ????? when argc == 7 ????? attribute of render sop bounds ???? Anyway...changing m to M not help...first and second conditions never meet. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 25, 2005 Share Posted July 25, 2005 As I understand it, the parameters -m and -M are used to pass the user-requested lower and upper bounds of the procedural's bounding box. And each of those parameters take 3 arguments (x, y, and z), so for a (-1,-1,-1)-to-(1,1,1) bound you should see "-m -1 -1 -1 -M 1 1 1" as part of the arguments. These get injected by Houdini depending on how you set the Render>Geometry parameter in your object, so that: *) Render>Geometry>Procedural: injects nothing and uses the string in "Mantra Procedure" exactly as given *) Render>Geometry>Procedural (explicit bounds): injects -m and -M set to the values of the parameters "File Min Bounds" and "File Max Bounds". *) Render>Geometry>Procedural (render SOP bounds): injects -m and -M set to the extents of the geometry in the SOP whose render flag is set. Try writing out an ASCII ifd file and, if all goes well, you should see a line that starts with ray_procedural <args...>. You can inspect this line to see if things are being passed as you expect. In any case, I would imagine that these bounding box arguments are just hints passed in by the user, but that your procedural would be (should be) free to set its own bounds based on whatever it's doing -- I'm guessing that Mantra would only pay attention to the value returned by VRAY_Procedural::getBoundingBox() and not from some command-line parameters to the procedural... For an explanation of args.found() etc, have a look at the UT_Args class which it uses as a convenient tool to parse the command line. But, as the comments say, you're free to use any parsing facility you like... DISCLAIMER: All of the above is based on looking at the code and the headers.. I haven't tried any of it (and I refuse to do it in Windoze/MSVC.NET.CRAP which is what I'm currently running at home) so all of the above could be wrong. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 25, 2005 Author Share Posted July 25, 2005 Hey Mario! Thanks for explanation:) If i shall add these lines: printf("%i\n",argc); printf("%s\n",argv[0]); printf("%s\n",argv[1]); printf("%s\n",argv[2]); printf("%s\n",argv[3]); printf("%s\n",argv[4]); printf("%s\n",argv[5]); printf("%s\n",argv[6]); printf("%s\n",argv[7]); I shall receive such result: 1 demobox (null) -1 -0.25 -M 1.5 1 0.25 So the question is: why argc = 1 ???? where is my -m as well as bbxmin value and what is the matri....brrrrrr (null)??? ps. -1, -0.25 , 1.5, 1, 0.25 - values from render sop bounds. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 25, 2005 Share Posted July 25, 2005 ps.-1, -0.25 , 1.5, 1, 0.25 - values from render sop bounds. 19821[/snapback] I count 5 values, aren't you missing one there? was your bbxmin value the default or 0 maybe? hence the null? bit weird though. how about trying args.display(); maybe that will be more revealing. Quote Link to comment Share on other sites More sharing options...
MADjestic Posted July 25, 2005 Share Posted July 25, 2005 btw, what does that Vray procedurals do? I tried to compile the code but then... I couldn't even find it in Houdini - what's it supposed to be in Houdini? A ROP? A Vex function? A VOP?.. a "Make photoreal" button? Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 25, 2005 Author Share Posted July 25, 2005 I count 5 values, aren't you missing one there? 19822[/snapback] This is part of my question ".....where is my -m as well as bbxmin" Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 25, 2005 Author Share Posted July 25, 2005 btw, what does that Vray procedurals do? I tried to compile the code but then... I couldn't even find it in Houdini - what's it supposed to be in Houdini? A ROP? A Vex function? A VOP?.. a "Make photoreal" button? 19824[/snapback] Sorry guys....russian is little bit easier in this case Процедуралы позволяют генерить геометрию на лету непосредственно в процессе редера. Фур - неплохой кандидат в процедуралы. Зачем загружать ifd немеряным количеством курв если можно генерить их поштучно тогда когда они нужны. Подключение процедуралов тоже процес нифига не документированый а по сему геморный. 1. компилиш процедурал в $HOME\houdini7.0\dso\mantra\ 2. добавляеш процедурал в файл VRAYprocedural который дожен лежать в $HOME\houdini 7.0 (образец этого файла лежит там же где сам пример) 3.пишеш ds скрипт MantraProcedural.ds который кладеш в $HOME\houdini7.0\config\Scripts\ в данном случае он выглядит очень просто #include "D:/HOUDINI/houdini/config/Scripts/MantraProcedural.ds" command { name "demobox" label "Demo Box" } в качестве name используеш то как ты обозвал свой процедурал в пункте 2. После всего этого он наконец то появится под кнопочкой Mantra Procedural в ui твоего объекта Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 25, 2005 Share Posted July 25, 2005 why argc = 1 ????where is my -m as well as bbxmin value and what is the matri....brrrrrr (null)??? Because there was only one arg? The null is there to signify 'end-of-string' (and a null is not the same as ascii-code '0'). The fact that reading bytes past that location gives you values that seem to make sense doesn't mean they were part of the command-line (more likely just some garbage left at that location from previous runs). In fact, you can probably continue to do printf's until you've read the entire data segment. Then again... maybe there is some bug in there... The *only* way to find out what's going on is to save out an ASCII ifd file, record what the line that starts with "ray_procedural ..." says, and then print out (from inside the procedural) the command-line arguments that were passed to it. If everything's working as it should, the arguments to your procedural should contain all the words that you see after "ray_procedural" in your ifd. Try that and see what happens. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 25, 2005 Author Share Posted July 25, 2005 The *only* way to find out what's going on is to save out an ASCII ifd file 19831[/snapback] ifd output disabled in Houdini NC i`m stuck :tumbleweed: Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 25, 2005 Share Posted July 25, 2005 ifd output disabled in Houdini NC i`m stuck :tumbleweed: 19839[/snapback] OK. I'll give it a try when I get a chance and let you know what I find. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 25, 2005 Share Posted July 25, 2005 This is part of my question ".....where is my -m as well as bbxmin" 19827[/snapback] Sorry I meant you only listed 5 of the values that you actually inputed into Houdini, least I assumed that was what you were listing. I guess you weren't. btw, what does that Vray procedurals do? I tried to compile the code but then... I couldn't even find it in Houdini - what's it supposed to be in Houdini? A ROP? A Vex function? A VOP?.. a "Make photoreal" button? It's a render option for an object, so instead of rendering as the object you send to the renderer it renders it by running a piece of code. Bit like the way you can render polys as subdivision, or points as sprites or metaballs, but you get to decide how the geometry is created in the renderer. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 25, 2005 Share Posted July 25, 2005 OK. I haven't exhausted all possibilities by any means, but I did manage to run a couple of quick test, and here's what I've found out so far: 1. The syntax for the ray_procedural command seems to be something like ray_procedural <params> procedural_command_line And at least two of the params are '-m' and '-M' (which get inserted by Houdini, not the user). 2. Due to #1, the parameters -m and -M are for the ray_procedural command's eyes only, *not* the procedural itself. IOW, they are invisible to the procedural as they get consumed by Mantra before the procedural gets called. 3. The sample must be outdated since given #1 and #2, I don't think there would ever be a case where the test if (args.found('m') && args.found('M')) would ever evaluate to true (unless the procedural itself coincidentally used those parameters). 4. In the event that the user *does* define a bounding box for the procedural (via either Render>Geometry>Procedural (explicit bounds) or Render>Geometry>Procedural (render SOP bounds)), this bounding box is made available to the procedural's initialize() function through its third parameter (which is ignored in the sample). So this is the mechanism made available to get at the user-defined bounding box. For my test, I replaced the initialization function in the sample with: int VRAY_DemoBox::initialize(int argc, char *argv[], const UT_BoundingBox *usrbox) { for(unsigned i=0;i<argc;i++) std::cerr<<"ARG["<<i<<"]: "<<argv[i]<<"\n"; if(usrbox) { std::cerr<<"UserBounds: "<<(*usrbox)<<"\n"; myBox = *usrbox; } else { myBox.initBounds(-1,-1,-1); myBox.enlargeBounds(1,1,1); } return 1; } Try it and see what you get. Hope that helps. Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted July 25, 2005 Author Share Posted July 25, 2005 THANK YOU SUPERMARIO!!! :notworthy: :notworthy: :notworthy: All is clear now and works as expected :thumbsup: Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 25, 2005 Share Posted July 25, 2005 Glad it helped Actually, it's good you brought this up because I was thinking of trying out some procedural stuff for Mantra. Cheers! Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted July 25, 2005 Share Posted July 25, 2005 ... 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.