Jump to content

Mantra Program Procedural shader


Recommended Posts

Hey guys,

I am trying to create curves at render time using an external script and am wondering if any of you know how to do this outside of the HKD.

Specifically I am trying to figure out how the program procedural is suppose to communicate the curve information back to Mantra.

Any help is appreciated!

Thanks,

Walt

Link to comment
Share on other sites

Hey guys,

I am trying to create curves at render time using an external script and am wondering if any of you know how to do this outside of the HKD.

Specifically I am trying to figure out how the program procedural is suppose to communicate the curve information back to Mantra.

Any help is appreciated!

Thanks,

Walt

Heh, I've just been playing around with this kind of thing myself :).

It is quite fun stuff.

Basically the way it works is that the program procedural will be triggered at rendertime. Anything that comes from the standard out (stdout) from your program will be interpreted as geometry.

So if you look at the basic example where they:

gconvert default.bgeo stdout

It will basically print all the information in the default.bgeo to the stdout, which will then be picked up in the ifdstream. It seems to be exactly the same as in renderman.

In order for it to work better it needs to have bounding information, so it will only compute when a ray falls within that box.

If you are using python it will save you a lot of time if you put your python scripts under :

$HOME/houdinix.x/scripts/python

Initially I didn't do that and there was a conflict between the version of python houdini was using and the one installed on the system. If you are using additional modules you should probably also put them into the above directory.

In terms of getting started I recommend:

*) in houdini create a line sop

*) attach an attributecreate -> create a "width" attribute and give it a small value (like 0.01).

*) add a mantra node, camera & light and render. The line should be there.

*) back in sops -> rightclick on the last node of your line network and -> save geometry as: myline.geo

*) open myline.geo with a text editor and have a look at this geometry.

*) Now make a new python script like:

geostring="""PGEOMETRY V5
NPoints 2 NPrims 1
NPointGroups 0 NPrimGroups 0
NPointAttrib 1 NVertexAttrib 0 NPrimAttrib 0 NAttrib 1
PointAttrib
width 1 float 0
0 0 0 1 (0.00999999978)
0 1 0 1 (0.00999999978)
Poly 2 : 0 1
DetailAttrib
varmap 1 index 1 "width -> WIDTH"
 (0)
beginExtra
endExtra"""
print geostring

Then refer to that script

$HOME/houdinix.x/scripts/python/makegeo.py

in your program procedural and assign this procedural shader to an empty geo node in Render -> Geometry -> procedural shader.

Now make the kind of curve you would desire and save it again as a curve.geo, then have a look inside. Now you'll just need to use that other script to generate the right kind of data for you.

I've just made a little clifford attractor as a quicktest with 10 million points (uses about 5gigs of ram).

What I personally really want to start looking into is a program procedural that writes delayed load procedurals into the stream. That way you can generate huge amounts of geo on the fly, put it in little buckets and have those buckets rendered in optimal memory conditions. Kind of what Eetu is doing in his billion particles test, but more automated.

Link to comment
Share on other sites

  • 6 months later...

Hmm.

Your example does not work for me and for sure I´m doing something really wrong here.

I´m having no problems to import the script in the shell, but at render console gives me "CreateProcess failed" and "mantra: program[/obj/render] unable to run program"

My path looks like $HOME/houdini10.0/scripts/python/makeGeo.py

Since my $HOME contains blank space I tried it at other location, but same story there.

Is this something someone met while playing around with this?

Link to comment
Share on other sites

Perhaps if you execute "python $HOME/houdini10.0/scripts/python/makeGeo.py" instead?

Doesn´t help.

I would not be surprised if this is just some simple f* up from my side.

I will have to take a look at this after the weekend, my head is just blank now. :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...