Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Strangely enough, that's not possible. The visibility of each part is controllable from Python, but not the Cast Shadows. (It seemed so inevitable that I went ahead and wrote most of the script just now, only to find that the necessary function isn't there!)
My python page
My ShareCG freebies
Attached Link: Ambient Occlusion
Sheesh, what a shame. Something to control all of those object properties like cast shadows, polygon smoothing, bending etc would have been great. I've got a big, complicated wish. I'd love to see something that does ambient occlusion. Ambient occlusion is used to fake radiosity as well as to product grime maps where grime fills nooks and crannies of a model. It's the procedure behind plugins such as DirtyNuts for Cinema 4D. What I have in mind is something that outputs the results as a greyscale image using the template of the object concerned, so you can then use that image as a texture that dulls the object in the places that should be dark/dirty. A google search will turn up lots of info on ambient occlusion, but I've picked out one particular link and posted it above because it explains the technical aspects pretty clearly I think.
View Ajax's Gallery - View
Ajax's Freestuff - View
Ajax's Store -
Send Ajax a message
Attached Link: DirtyNuts
Here's an example of using the same approach to create dirt maps with DirtyNuts.
View Ajax's Gallery - View
Ajax's Freestuff - View
Ajax's Store -
Send Ajax a message
Some of those properties are reachable. Polygon smoothing is. (ockhamsbungalow.com/python/SmoothOnOff.zip) I really thought Cast Shadows would be accessible, because it's an "old" menu choice. But no. I'll look at the dirt. Somebody (Shadownet?) asked me about this once before, and frankly I don't quite see the purpose.... Or rather, I don't see why it needs to be done at run-time. Is there a reason why this can't be done as part of painting the texture map?
My python page
My ShareCG freebies
Maybe I do see the point after all. The Problem: a UV map is a set of flat projections, with no reference to the actual angle of any side. Let's say I want to show raindrops on the upward-facing parts of a car, by 2D methods. (Displacement map.) The UV map won't tell me which facets are really facing upward at this moment, but Python can get that info from the model itself at this moment. The script would then (1) translate these facets to the UV locations; (2) pick up a (specified) bitmap that is solidly covered with 2D raindrops; (3) OR the pixels of the bitmap with the original displacement map, weighting the mix so that more of the raindrop bitmap is mixed where the real surface is facing upward right now; (4) reapply the mix to the model before rendering. Is that close to your idea?
My python page
My ShareCG freebies
It was probably me that asked you about it. No, there's no reason you can't paint the map by hand, it's just a total pain doing it. The idea of something like this is that you can save yourself days of agonizingly dull mucking about by running the script and getting a jpeg that shows you exactly where you need to put your grime. I see the script as being a time saver that helps you create your texture map. When you work with models of buildings or industrial objects, there are often parts which intersect and should have grime at the intersection point, but which do not have the intersection point marked on the UV map. This means that to figure out where to put the grime, you have to take a guess, draw it on the texture, render, see how well you guessed, then adjust your texture and repeat until you've managed to put the grime in the right spot. It takes ages. Even something that just draws the intersection lines onto the UV map would be tremendously helpful, but something like DirtyNuts will not only find those correct spots on the UV map for you, but will also draw the grime there so you can just composite it with your colour map to get a nice dirty texture.
View Ajax's Gallery - View
Ajax's Freestuff - View
Ajax's Store -
Send Ajax a message
ok repost my idea about a python many usefull for animator: - tracking 2d/3d for P4 PP and later - example: You import a footage in poser (in footage a real ball red move up and down) with this python i can lock the color of this ball to the hip of a character. note: Maybe will better create a parent from a marker() (you would can rename inside the python interface) and a joint of the character. About the rotation of body part will see later ... ()this marker can move with tracking from a color or a contrast luminace zone best regards; Andygraph
Which is equivalent to the N and component nodes in the picture.
Yeah, you can handle what Ockham was talking about in post 6 with that. It's a very different thing to ambient occlusion though. Also, you can't bake it to an image map. I might try to put togethers some pictures to show what I'm looking for.
View Ajax's Gallery - View
Ajax's Freestuff - View
Ajax's Store -
Send Ajax a message
Don't know if this is possible/worthwhile...
I've just bought the P5 upgrade for Mac and it has this nifty script to calculate the distance from camera to object. So, when doing DOF renders it gets me most of the way to setting things up properly. What I'd like to suggest is:
A script that will generate the camera to obj distance and also calculate the "in focus" range based on the other camera settings. Apply those calculations to 2 simple planes (which are parallel to the camera plane) marking each side of the "in focus" range. This would provide visual markers for the focal zone so you can clearly view what will be in/out of focus before rendering.
Don't know if it can be done - or even if anyone else wants to see it (LOL!)
Thanks everyone!
Lee
Message edited on: 05/16/2004 06:31
Attached Link: http://www.keindesign.de/stefan/poser/dof_p5.html
I knew I'd seen something somewhere recently. A starting point for a more featureful DOF script ?Message edited on: 05/16/2004 07:49
It's me again. :)
Thanks for the pointer to Stefan's DOF/P5 tutorial. That was the first place I went when I started experimenting with DOF. He did a good job of explaining it.
Now that I've been thinking about my request for a DOF script, it hit me that what I really want is a way to figure out what value to put into the F-Stop field in the Render Options panel. Finding the Focal Distance is trivial thanks to the existing script(s). It would be nice to see a graphical representation of the Focus Plane (perfect focus plane), the Near Focus Plane (everything between this plane and the camera is fuzzy) and the Far Focus Plane (everything behind this plane is fuzzy). I'm not sure if knowing the Focal Distance and the camera's Focal value are sufficient to calculate the F-Stop to achieve clear focus within the bounding box of the Near and Far Focal Planes.
Oh, since I've been toying with all of this today, I've got a "no script required" method of deriving the Focal Distance directly within Poser. This method seems to work fine so far, but I've only used it in a few test renders.
Here's the method:
Sorry about the long post. I hope this inspires or helps someone! :)
Lee
Message edited on: 05/16/2004 11:19
Message edited on: 05/16/2004 11:21
Message edited on: 05/16/2004 11:30
After reading a thread on this topic I thought it would make a good Wish List contender - How about a python script to enable the Cameras to be visible in the workspace and to be manipulatable? The thread mentions that this is possible using the hierarchy editor, but a python script would be much better.
Here you go. As usual, change the ~ tildes to tabs. import poser for OneActor in poser.Scene().Actors(): ~if OneActor.IsCamera(): ~~OneActor.SetOnOff(1)
My python page
My ShareCG freebies
Saw an intersting idea here at http://www.renderosity.com/messages.ez?ForumID=12356&Form.ShowMessage=1875704 and was wondering if someone could make a python script that will do the following: 1. create a toon light shader with the light color at white and dark color at grey, and then plug that into the alt-diffuse. 2. move the current diffuse texture node over to the toon shader, setting the diffuse value to zero on the main diffuse. 3. not affect any other settings. 4. do this for an entire scene or at least a whole object at a time. I don't know python so I don't know if this is possible or not, but the settings yield a good result so I'm hoping there's a way to automate things. I'm going to try to learn enough python to do this myself, but I'm not sure how difficult the task is.
This is most likely impossible. Python can't reach the P5 materials system (nodes, shaders) in any direct way. May change in a later version, but for now, the materials are just out of Python's reach.
My python page
My ShareCG freebies
Ambient Occlusion (at least, the popular ray traced kind) will not be possible as a Python script, unfortunately. This is something that would need to be implemented as a shader node, like in Pixels:3D. However, we have been using something incredibly similar to AO for a long time now: These "global light sets" are very close to depth map based AO, see this page. Looks familiar, doesn't it? You can actually bake AO to textures and use them in Poser. I did that with a custom shader in Pixels that would export me the rendered shading a as a texture, but it still needs some major improvements. It should be possible to do it with pther programs that support texture baking, e.g. 3ds or C4D.
My python page
My ShareCG freebies
I'll think about the mixer again. Yesterday I was playing with BVH files and realized it's necessary!
My python page
My ShareCG freebies
There is something about mixing BVHs on the net. Can't remember the link, but it's a dissertation by an American student, from 2001 I believe. He's done quite some research on joining a walk sequence to a run sequence and stuff like that. I assume that's what you want?
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
The only way I can think of accessing the material room is having the script save the current scene, open the PZ3 as a text file, manipulate the right lines, save again and then force Poser to reload the scene - I'm not even sure the "revert to saved" command is accessible from Python. Very clunky. Heck, I wish Curious Labs would build their programs the way Microsoft and many Java programmers do, exposing functionality via a programmatic interface, and the user interface just calls the programmatic interface. A simple practice that'll make sure your app is always fully scriptable.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
A wish: a callback utility that'll make sure the hierarchy window opens with all its trees collapsed instead of fully expanded. Very useful when parenting something in large scenes.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
I learned a neat trick for working with lighting. When you're trying to get a light set to look right, you render the scene multiple times, each time with only one light on. Then you bring the renders into an image editor, layer them, and set all but the bottom layer to "screen". This simulates what the lights will look like when they're all rendered at once, and you can adjust the intensities by changing the layer opacities until you get the effect you like. For complex scenes, it can be much faster than tweaking a light, rendering to see how it looks, tweaking again, and so on.
Unfortunately, it can be a pain to turn manually off all the lights but one, render, turn that one off and another one on, and so on. Also, Poser 5 seems to lose the light's shadow settings (shadows on or off, raytraced or depth mapped) when you turn it off, and you have to reset them and hope you remember which is which.
What I'd love is a script that notes each light's shadow settings, turns them all off, renders and saves a series of images with only one light turned on with the proper shadow settings, then turns them all back on with the right shadow settings when it's done.
I'll do that. Should be easy to strip down
from my LightPanel.
It won't be quite as automatic as
it should be, because Python can't save
finished renders to disk for some stupid
reason.
So there are two possible ways to go:BR>
Leave its renders stacked up in the Poser
interface, where you can click on them
to examine or save manually.
If you're not animating, the script could
put each light into one frame. Then you
could save the animation as an Image Sequence
in the usual way.
Which is better?
Message edited on: 09/04/2004 14:22
My python page
My ShareCG freebies
Okay, I'll do it the stacked way. One other fussy little point: I'm pretty sure most light sets are simply numbered, so the script will take the lights in numerical order, leaving "Render 1" as the scene with Light 1 alone. If the light set has named lights, as is true of SnowSultan's "Globall", this might be less satisfactory. (I think the underlying internal name is still a number.)
Message edited on: 09/04/2004 15:07
My python page
My ShareCG freebies
Attached Link: http://ockhamsbungalow.com/Python/OneLightPerRender.zip
Try this, see if I have the right idea.My python page
My ShareCG freebies
Great! Incidentally, I just pulled the intensity of the unused lights down to zero instead of turning them off. Seemed easier, and apparently it works just as well.
My python page
My ShareCG freebies
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Let's see if this will work. It's impractical to get through 100 very old entries, especially when Renderosity is having one of its hissy-fits. Beginning with a repost of the last new request, from BabyDollTX. ...Wonders if it would be possible to script turning off shadow casting for all parts of a figure? anybody tried it?
My python page
My ShareCG freebies