Hi Matthias,
On Mon, 2004-08-23 at 03:34, Matthias Biedermann wrote:
> Hi folks,
>
>
> we have some material (Cg shader) assigned to a bunch of objects or
> different parts of an object, respectively. However, some of the shader's
> uniform parameters need to be changed for the different objects, that is
> to say, the model matrix (not the modelview!) for the geometry.
> Duplicating the whole material for every node is not an option due to its
> memory consumption (textures...).
>
> Is there a way to have every node below the material change its parameters
> independently? Something like registering enter/leave functions? How can
> this be accomplished then?
No, that would pretty badly clash with the basic design, I'd rather
avoid if possible.
> Or can the material be split into a shared "texture-part" and individual
> "shaderprogram-parts"...?
Matthias already mentioned that, and yes, it will work. It will be more
expensive than having a single material, but the actual state changes
will be much simplified (identical Chunks don't do anything when used in
multiple materials). Right now you can't share the ProgramChunks, as
they store the parameters, so you need to have copies of those, which is
not free.
I can see two solutions: 1) build smarts into the ProgramChunk so that
it shares the actual program IDs when the programs are the same.
Requires a central registry (which I don't like much), and might be
tricky. 2) Split the parameters off from the ProgramChunk into a
separate ProgramParameterChunk, which can then be used independent of
the program. Andreas, what do you think?
The real solution for your problem would be the ability to add Chunks on
a per-object basis. It's in my head, but not in code yet, so for now you
will not get around having multiple materials.
Yours
Dirk
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users