Jump to content
Sign in to follow this  
MENOZ

delayed load change material attribute per point

Recommended Posts

hi.

In my scene I delay load a tree model.

The tree model geometry and materials are saved into bgeo and ifd files.

The tree model has different materials, wich are applied "per group" using one material sop. For example it has 2 materials for 2 groups of leafs, that loads different texture files.

Now I want to change the color of those leafs based on point color.

So I needed to export the tree again without material assigned to those groups, in this way I can override it (set it) in sop using the material sop.

I have my scattered points, append a material sop, load in the material that I want to use for the leafs (that now are wothout material).

it works, BUT it applies the material to all the leafs. Instead I have two materials, that needs to be applied to 2 different leaf groups.

If in the material sop I set the group it gives me an error (because there is no geometry upstream), and it don't resolve at rendertime.

how can I do to apply two or more materials to different groups in the geometry that I want to delay-load?

thank you

Share this post


Link to post
Share on other sites

I tried to see if the propreties SHOP or VOP does what I need but it seems not.. "how to use them" it's not well documented i think.

still I can't change more than one material per instance.

Instanced objects and Delayed load is a bit confusing, they seems so similar but I can't say wich is better. I don't know if for my needs (override multiple materials in the instanced object) I shoud use instance or delayed load, because I don't know how much they works similar and what they have in common.

Can anybody help me?

Share this post


Link to post
Share on other sites

I tried to see if the propreties SHOP or VOP does what I need but it seems not.. "how to use them" it's not well documented i think.

still I can't change more than one material per instance.

Instanced objects and Delayed load is a bit confusing, they seems so similar but I can't say wich is better. I don't know if for my needs (override multiple materials in the instanced object) I shoud use instance or delayed load, because I don't know how much they works similar and what they have in common.

Can anybody help me?

the only way I can think to solve the problem now is to make a delayed load for each part of my model that has material to be override.

I don't know if it's the right way to do it.. :huh:

Share this post


Link to post
Share on other sites

sorry for insistence...

http://odforce.net/wiki/index.php/MantraInstancing#Point_Instancing

I found this

it says

Passing attributes to shaders for instances:

Currently (mantra7) for point instances, the attributes are never passed to the shaders. Thus if you want different shader parameter values for the point instances, you either have to assign different shaders or to hand munge your own point shader attribute strings.

One way to workaround this limitation is to use an AttribCreate SOP that reproduces the vm_surface attribute using as reference, the output from a Shader SOP that has Point Instancing turned on and Indirect References turned off.

I don't have clear in mind how it works.. can anybody explain me where to use the AttribCreate SOP, and where to attach the shader SOP? in the Model geometry or in the Point geometry?

and what does it mean "using as reference the output from a Shader SOP" ??

Share this post


Link to post
Share on other sites

I can't offer you an easy solution to that either.

Generally one delayed load has one material applied to it.

I coded my own delayed load instancer in the HDK a while ago and that could "steal" materials from other objects in the scene (it was a bit of a hack, but I found it to be the only way without using a material archive). Each point would have a path the the delayed load and also a path to the shader.

It was in effect a procedural calling another procedural. You could extend this code so you would have some header/reference text file with your geometry and the shader that needs to be applied to each sub-piece. This would allow you to load a group of objects onto a single point and allow different materials. --If you really wanted you could even loop through the points of each individual piece and change the point attributes (like color), but at that point you are better off using a CVEX link for speed.

This would require programming in the HDK, though. I do not know another way to do it in Houdini at the moment.

http://www.peterclaes.be/blog/?p=151

I would also recommend to have a look at the ClusterThis procedural that Mark Story wrote:

There may be others that know how to do this using straight houdini. - but it is a bit messy to find out what functionality is no longer there.

Good luck!

Share this post


Link to post
Share on other sites

Hey MENOZ,

any chance of you uploading the your hip file here? trying to help. hehe

eitht.

Edited by Eitht

Share this post


Link to post
Share on other sites

Hey MENOZ,

any chance of you uploading the your hip file here? trying to help. hehe

eitht.

I'm at home and using apprentice. so the ifd doesn't work from here. If you read in the first post you could build a simple scene with more than one material applied to one object and trying to read it back with a delayed load changing the various materials.

As Peter said, it's a little bit complicated to do what I want and probably this would require programming in the HDK.

maybe Cluster this can do what I want by "Copy point attributes to the instanced geometry"..

A friend told me that in renderman you can use a Rifilter to do what i need. Anybody knows if there is an equivalent in houdini?

Share this post


Link to post
Share on other sites

I'm at home and using apprentice. so the ifd doesn't work from here. If you read in the first post you could build a simple scene with more than one material applied to one object and trying to read it back with a delayed load changing the various materials.

As Peter said, it's a little bit complicated to do what I want and probably this would require programming in the HDK.

maybe Cluster this can do what I want by "Copy point attributes to the instanced geometry"..

A friend told me that in renderman you can use a Rifilter to do what i need. Anybody knows if there is an equivalent in houdini?

I hope i understand you correctly, delayed load is a shader by itself and you're trying to assign a material (say Stone off the material palette) on to the object but at the same time have delayed load functioning? :D

eitht.

Share this post


Link to post
Share on other sites

I hope i understand you correctly, delayed load procedural is a shader and you're trying to assign a material (say Stone off the material palette) on to the object but at the same time have delayed load work? :D

eitht.

Share this post


Link to post
Share on other sites

:huh: Eitht I think you are missing something,I'm not an expert, but I don't see anything strange. Delayed load is a procedural shader, it generates geometry, and you can assign a material(or surface shader) to the geometry.

Edward posted a link to the docs, It may be useful to understand material overrides.

re quote myself :P

A friend told me that in renderman you can use a Rifilter to do what i need. Anybody knows if there is an equivalent in houdini?

Share this post


Link to post
Share on other sites

In regards to the rifilter equivalent. As far as I know there isn't. I'm no expert at it though.

What I understand of rifilters is that they basically run after the rib file is generated to "search and replace" certain patterns. It is not a very nice workflow but can work more as a hack to filter out/in some specific changes. (There is an interesting paper on how ILM did the crowds for Star wars: episode 1. If I remember correctly it is part of the Escape Studios courseware and was originally part of some course notes.)

I am more for the VRAYprocedural/dso approach and I think it also runs faster than rifilter (as searching and matching patterns tends to take some cpu time).

This is similar to why an ifd can not call another ifd, but a rib archive can call another archive that calls another archive. This repeated archive calling is what allows you to create hierarchies of models with different materials. But really this should be handled by a custom procedural.

One thing you may want to look into is writing ifd as asci and string replacing what you need to replace by postfiltering with python (I think this would be slow and asci would take up large filesizes.). Another option is to look into SOHO, as that can control what and how certain elements go into the ifd. But I have never really used SOHO, so I can not advise you on that.

Share this post


Link to post
Share on other sites

:huh: Eitht I think you are missing something,I'm not an expert, but I don't see anything strange. Delayed load is a procedural shader, it generates geometry, and you can assign a material(or surface shader) to the geometry.

Edward posted a link to the docs, It may be useful to understand material overrides.

re quote myself :P

Ahhh my bad, i missed edward's reply! was probably scrubbing through the page too quick. :/

Thanks!

eitht.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×