Hi,

On Sat, 2009-07-04 at 18:03 -0500, Carsten Neumann wrote:
>       Hi Gerrit,
> 
> I've stumbled over the RenderProperties, but there seems to be so much 
> machinery involved (NamedSplitFinitPool ?, compile time selection of 
> types based on number of bits needed ?) that I can't make sense of them.

Ignore the split part, it is not finished yet. I currently only works 
in its basic form with the full mask exactly matched. Later on the two
parts should match differently in a combined fashion, the first part
doing an exact match followed by the second with a prioritized best
match.

> Together with VariantMaterial I think they could solve a problem I have: 
> To render nice shadows cast by leaves on a tree model the leaves need to 
> have a material that does alpha testing even when rendering the shadow 
> map. Normally when rendering shadows I globally override the material, 
> but that does not work here, since I don't want to do alpha testing for 
> everything (some objects don't even have textures). It seems that 
> VariantMaterial could do the right thing for me here, but how do I set 
> it up so that it picks the "shadow" material when rendering the shadow 
> map and the normal material otherwise (and what do I have to do on the 
> render action/partition side) ?

did you look at the Examples/CSM/SimpleVariant* samples. Examples/CSM is
where I usually put my examples/tests. It's not as code but shows the
general setup and controls.

Basically for now you get the mask you need to add the variant from
RenderPropertiesPool, e.g.

varKey = RenderPropertiesPool::the()->getFrom1("shadow")

than you add the variant

varMat->addMaterial(mat, varKey);

Your normal material should be added as the fallback material (for now,
with the RenderPropertiesPool::the()->getDefault() key)

During rendering you set renAct->setRenderProperties(varKey) to 
select the variant you want as you do your shadow pass and than
reset it with renAct->resetRenderProperties().

That interface might change in future though, most likely I'll fix
the props per partition, but I'm not 100% if this doesn't have
drawbacks. But it won't change by much.

BTW it also works with ChunkOverrides.

> Or are the RenderProps meant for a different use; 

No that is one of the use cases. 

> not finished; broken; going away soon ?  ;) ;)

not finished and being worked on, but the basic selection should work. 
I currently have some graduate work out to look at the general material
model. So I have to finish/clean this soon as it will be the basic
infrastructure to go from.

kind regards,
  gerrit




------------------------------------------------------------------------------
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to