View Full Version : Geometry Shader How-To

02 February 2005, 10:43 PM
Hey y'all,

I've been using PRMan a lot at my current job, and have grown quite fond of its "read archive" functionality, which will swap out a baked out geometry file with any other object at rendertime. Speeds renders up a lot.

I went looking for a similar function in MR, and found the Geometry Shader, or more accurately, the mib_geo_instance shader. But even after some searching, I couldn't find out much about it, save that its integration with Maya was not really ready for prime-time.

I did some testing (win2k, 6.0) and couldn't get it to work. I got a bit confused when it asked for the "object" in the mib_geo_instance shader. Trying to put in pSphere1 or pSphereShape1 didn't seem to fly. The shader I put in was just a MR blinn that I created for the test (wasn't the texture for the original object).

So, I have a couple questions:

1) Am I correct in that it's just not ready yet, or am I doing something dumb?

2) Is this supposed to go out and instance an exported piece of geometry (say, in a .mi file), or something internal to the scene?

3) Could this be solved through scripting my own shader? It's not something I'm afraid to delve into.

02 February 2005, 10:51 PM
Maybe this is what you are looking for:

Down at the very bottom.

02 February 2005, 05:35 AM
Thanks, Bill, but that actually doesn't do what I want it to. Nice trick -- auto-instances all geometry at the beginning of a render, to speed up .mi writing times, but it isn't what I'm going for.

I'm trying to export a specific geometric object from Maya into a separate file, then, using a geometry instance shader, swap that file back in at rendertime. Helps in using one file across multiple scenes, and keeping them all up to date -- as well as speeding up render times, and any number of ancillary benefits.

The mib_geo_instance shader that ships with Maya seems to be b0rked. It needs to be hooked up to an object in the scene (errors if I try to link it to a file), but even when I hook it up to an object, it doesn't swap out correctly. Or at least, I can't get it to.

This leads me to believe I'd need to write a custom shader to do this, which is a bit of a daunting proposition. Maybe when I get some free time, I'll sit down and do it, but I'm not even sure it can be done without MR standalone.

Am I missing something, anyone?

02 February 2005, 06:18 AM
Sorry, I know what you are talking about now. It can be done with some scripting knowledge, but yes, you are correct the geo shader that ships with maya doesn't work properly. It does work however in mental ray standalone. Considering it was introduced back in Maya 5 I would have assumed they would have fixed this by now.

But there are ways of getting around it, I'll see if I can throw something together this weekend when I have some free time. Basically what's going to happen is what you said, you'll be exporting a piece of geometry to .mi format and then calling that .mi file at render time. Not sure if I can do it or not, but I'll give it a shot.

02 February 2005, 06:26 AM
Thanks, Bill. Most kind of you. Even if you don't have the time, if you could point me in the right direction, I'd love to figure it out myself. I'm a fair hand at MEL and renderman shader language, MR shader writing doesn't look -that- different.

02 February 2005, 07:49 AM
to Bonedaddy:

You need "On Demand Geometry" it's like prman's delayed rib archive.
But it's possible only with mental ray stand allone because you really need create some custom texts and manually edit mi file.

03 March 2005, 06:39 PM
Did this get fixed in Maya 6.5? I know for a fact that in 5.0 it's purposely disabled because it crashes. They used this feature in the Matrix to render water droplets (the rain in the fight scenes), so I know it works, but anyone know if 6.5 fixed it to work out of the box with the new satellite features?


03 March 2005, 06:48 PM
I think that they used a specially coded Maya-MR bridge called "Gossamer" for the Matrix. I could be wrong, though.

And to my knowledge, this ain't working any better than at last check. If anyone wants to chime in and prove me wrong, though, I would be thrilled.

03 March 2005, 12:30 AM
This may be a dumb question but will particle instancing work instead of a shader? It works fine in mental ray in Maya 5, but if the particle is a referenced object, it will crash. The instanced object needs to be in the scene to work with MR, which is not that big of a deal. Not sure how this changed in versions 6 and 6.5.

03 March 2005, 03:26 AM

After trying for quite a while to get the geometry shaders working in Maya 5 and 6, I eventullay found out that they could not be used within Maya because of the lack of support for the MR_CustomText node. However, I have recently read that Alias has added much more support for CustomText in Maya 6.5, but I have not had time to try it yet.

It is possible to get the geometryshaders working with the standalone version of MentalRay, It just involves a bit of coding in the mentalray scene file.

03 March 2005, 12:10 PM
geometry shaders work in maya.
on demand geometry too, one
just needs to know how to code
the geo api.


03 March 2005, 06:46 PM
francesca. Please clairify for me....when you say the geometry shaders work in Maya, do you mean that they work fully within Maya without exporting out a .mi? you still need to export the .mi and render with the standalone MentalRay? thnx!

03 March 2005, 07:18 PM
francesca. Please clairify for me....when you say the geometry shaders work in Maya, do you mean that they work fully within Maya without exporting out a .mi? you still need to export the .mi and render with the standalone MentalRay? thnx!
It's just a thought, but I guess you wont need the standalone. There was a problem with geometric area lights, which needed to be exported as .mi and the scene needed extra text to work in standalone - somehow a similiar problem to yours I guess. Well, francesca somehow managed to get this done via the geo api to work within maya.

CGTalk Moderation
03 March 2005, 07:18 PM
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.