City Engine Object Transparency

5314
6
08-28-2013 11:59 AM
leewinslow1
New Contributor
Hello all,

I'm having a hard time setting the transparency of my models.  I have found the material.opacity cga rule.  This just makes my textures transparent.  I would like to set the texture and the model that is being textured to some level of transparency.

Thanks for any help
Tags (2)
0 Kudos
6 Replies
leewinslow1
New Contributor
The models I'm trying to make transparent are imported shapefile multipatch's
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi Lee,

I'm not sure if I understand you correctly. Can you post a reference image of what you need and what the input is ?


Note :

There's 2 different 'transparency options' you can set in CGA :
1] material.opacity ( the transparency of the material itself )
2] material.opacitymap ( the alpha channel / mask of the texture [[or a separate file for this]] )

so e.g. if you have mapped a leaf texture with an alpha channel on a polygon, you will see nothing but a cut out leaf. The rest of the polygon is completely transparent. If you then also set the material.opacity, you will make the leaf itself transparent.

Ok ?
0 Kudos
Tom-PierreFrappé-Sénéclauze
New Contributor II
Matt,

for some reason, when I set a shape's opacity to zero, it remains grey. Ie it doesn't actually become transparent, the color it was assigned just fades.

How do we make it actually transparent?

I've tried both setting it at the first rule, and setting all components to zero opacity, neither works:

@StartRule
Shape-->
set(material.opacity, 0 ) #still looks grey
comp(f) { all = Face }
comp(v) { all= Face }
comp(e) { all = Face }


Face-->
set(material.opacity,.001 ) #looks grey, with a tint of the blue left...
color("#0000ff")


Thanks
Tom
0 Kudos
MatthiasBuehler1
Frequent Contributor II
hi,

Shapes can not be transparent. Only Models can be transparent.

Shape + rule -> Generate -> Model.

So if you still see grey, then you still see the shape. Hide the visibility of shapes via the F11 key or the according button in the toolbar.


ok ?

matt
0 Kudos
Tom-PierreFrappé-Sénéclauze
New Contributor II
OK thanks, got it. Need to hide the shapes ("show/hide shapes") button. Then I can see the models, in all their glorious transparency.

For reference, this is the code I used:

@StartRuleShape--> 
 set(material.opacity,.02 )
 comp(f) { all = Face }
 comp(e) { all = Edges }


Face-->
set(material.opacity,0 )
 color("#0000ff")
 
Edges --> 
 comp(e) { all : i("builtin:cube")  s('1, 8, 8) X }


X--> 
set(material.opacity,1)
color("#FFFF00")


Now, as is often the case in 3D, I get issues with some of the lines disappearing under the landscape. Is there a way to add vertices in the lines and re-allign those to the DEM so that the perimeter of the model, at least, follows the DEM?


And similarly, if I was to do the same thing but want to have the entire face, not just the outline, follow the topograhy, is there a way to breakdown the shape (or the model) into smaller shapes so that it can drape better over the topography?

thanks for your thoughts!
Tom
MatthiasBuehler1
Frequent Contributor II
Hi,

This is currently not possible, no. This is a current limitation of CGA.

1] I'd align the terrain to shapes - you may have seen how that works in a tutorial
2] Since a shape can only sample once per model, each subshape during model generation can not sample the DEM again, thus you also can not subdivide the shape or add more points to then drape the shape on the DEM better.
3] The only thing you can do is do it in 2 steps:
   a] use one CGA rule that cuts your shape into smaller pieces *
   b] when this model is generated, select it, right-mouse-click > convert Models to Shapes
   c] use the alignShapesToTerrain tool to align those shapes to the DEM
   d] use your rule to make the transparent models.


* e.g.:

attr mySize= 3

@StartRule
Lot -->
    alignScopeToAxes(y)
    split(x) {~mySize: split(z) {~mySize: SmallerShapes. }* }*



ok ?
0 Kudos